static void Main(string[] args) { var pieces = new[] { new Piece(new Position(3, 4), Side.Black), new Piece(new Position(4, 3), Side.Black), new Piece(new Position(3, 3), Side.White), new Piece(new Position(4, 4), Side.White) }; var board = new Board(new Position(7, 7), pieces); var game = new Game(board); var view = new BoardView(board); view.Print(); while (true) { Console.WriteLine($"{game.Turn} turn: enter x,y"); var input = Console.ReadLine(); if (input == null) { continue; } var tokens = input.Trim() .Split(',') .Select(x => x.Trim()) .Select(int.Parse) .ToArray(); var position = new Position(tokens.First(), tokens.Last()); game.PlayPieceAt(position); view.Print(); } }
public PiecesInLine(Board board, Piece piece, Direction direction) { this.board = board; this.piece = piece; this.direction = direction; }
public BoardView(Board board) { this.board = board; }