Add Life as a sequence of Gneerations

This commit is contained in:
Andrew Cooper
2022-09-13 07:56:27 +10:00
parent db186bb86e
commit a9ec4e3eb1
3 changed files with 53 additions and 22 deletions

View File

@@ -55,6 +55,24 @@ internal class Generation
return new(board);
}
public void AddPieces(IReadWrite io)
{
var player1Coordinate = io.ReadCoordinates(1, _board);
var player2Coordinate = io.ReadCoordinates(2, _board);
if (player1Coordinate == player2Coordinate)
{
io.Write(Streams.SameCoords);
// This is a bug existing in the original code. The line should be _board[_coordinates[_player]] = 0;
_board.ClearCell(player1Coordinate + 1);
}
else
{
_board.AddPlayer1Piece(player1Coordinate);
_board.AddPlayer2Piece(player2Coordinate);
}
}
private void CountNeighbours()
{