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); }
public All_Ships() { ships[0] = new Ship_Design(4); ships[1] = new Ship_Design(3); ships[2] = new Ship_Design(3); ships[3] = new Ship_Design(2); ships[4] = new Ship_Design(2); ships[5] = new Ship_Design(2); ships[6] = new Ship_Design(1); ships[7] = new Ship_Design(1); ships[8] = new Ship_Design(1); ships[9] = new Ship_Design(1); }