public void PlaceItem(BoatLocation location, string item) { string row = location.GetRow(); string column = location.GetColumn(); Orientation orientation = location.GetOrientation(); int rowIndex = BoardDimentions.GetRows().IndexOf(row); int columnIndex = BoardDimentions.GetColumns().IndexOf(column); if (orientation == Orientation.X) { this.boardValue[row][column] = item; this.boardValue[BoardDimentions.GetRows()[rowIndex + 1]][column] = item; this.boardValue[BoardDimentions.GetRows()[rowIndex + 2]][column] = item; } if (orientation == Orientation.Y) { this.boardValue[row][column] = item; this.boardValue[row][BoardDimentions.GetColumns()[columnIndex + 1]] = item; this.boardValue[row][BoardDimentions.GetColumns()[columnIndex + 2]] = item; } }
public void MoveBoatRight() { int size = BoardDimentions.GetRows().Count; string lastRow = BoardDimentions.GetRows()[size - 1]; string firstRow = BoardDimentions.GetRows()[0]; string secondlastRow = BoardDimentions.GetRows()[size - 3]; if (personalBoatLocation.GetRow() == secondlastRow && personalBoatLocation.GetOrientation() == Orientation.X) { personalBoatLocation.SetRow(firstRow); } else if (personalBoatLocation.GetRow() == lastRow && personalBoatLocation.GetOrientation() == Orientation.Y) { personalBoatLocation.SetRow(firstRow); } else { int rowIndex = BoardDimentions.GetRows().IndexOf(personalBoatLocation.GetRow()); personalBoatLocation.SetRow(BoardDimentions.GetRows()[rowIndex + 1]); } }