private static Board CreateFromData(string[] boardLines) { Board board = new Board (); BoardSquare[,] squares = new BoardSquare[boardLines [0].Length, boardLines.Length]; for (int y = 0; y < boardLines.Length; y++) { for (int x = 0; x < boardLines[y].Length; x++) { char incoming = boardLines [y] [x]; if (incoming.Equals ('_')) { squares [x, y] = new BoardSquare (board, BoardSquareType.EDGE, new Coords (){x = x, y = y}); } else if (incoming.Equals ('=')) { squares [x, y] = new BoardSquare (board, BoardSquareType.RAIL, new Coords (){x = x, y = y}); } else if (incoming.Equals ('#')) { squares [x, y] = new BoardSquare (board, BoardSquareType.NORMAL, new Coords (){x = x, y = y}); } else { throw new NotSupportedException ("Board Map includes tile that was not recognised."); } } } board.SetSquares (squares, (square) => { if (square.Pos.x < squares.GetLength (0) / 2) { return Player.P1; } else { return Player.P2; } } ); return board; }