private bool directionDOWN(Ship_Design ship, int x, int y) { if (x + (ship.GetValueShip() - 1) > 9) { return(false); } int sectionCount = 0; for (int i = 0; i < ship.GetValueShip(); i++) { if (checkArea(x + i, y) == 0) { sectionCount++; } } if (sectionCount == ship.GetValueShip()) { for (int i = 0; i < ship.GetValueShip(); i++) { marking(ship.GetValueShip(), x + i, y); ship.SetCoordinates(x + i); ship.SetCoordinates(y); } return(true); } return(false); }
private bool directionLEFT(Ship_Design ship, int x, int y) { if (y - (ship.GetValueShip() - 1) < 0) { return(false); } int sectionCount = 0; for (int i = 0; i < ship.GetValueShip(); i++) { if (checkArea(x, y - i) == 0) { sectionCount++; } } if (sectionCount == ship.GetValueShip()) { for (int i = 0; i < ship.GetValueShip(); i++) { marking(ship.GetValueShip(), x, y - i); ship.SetCoordinates(x); ship.SetCoordinates(y - i); } return(true); } return(false); }