Example #1
0
        protected List <Line> GetLines(string fileName)
        {
            var board = BoardExportImport.Import(Path.Combine(Folder, fileName));
            var game  = new Game(board);

            return(game.GetLines(board.WhoMovedLast()));
        }
Example #2
0
        private static int TestEstimation(string fileName)
        {
            var board = BoardExportImport.Import(Path.Combine(folder, fileName));
            var game  = new Game(board);

            return(GetEstimate(game, board.WhoMovedLast()));
        }
Example #3
0
        public static Game TestMove(string folderPath, string boardName, int depth, params Cell[] correctMoves)
        {
            var board = BoardExportImport.Import(Path.Combine(folderPath, boardName));
            var game  = new Game(board);
            var move  = game.DoMove(board.WhoMovesNext(), depth, Game.DefaultWidth);

            Assert.IsTrue(correctMoves.Any(cm => cm == move));
            return(game);
        }
Example #4
0
        private static NextCells GetNextCells(string fileName, bool next = false)
        {
            var board = BoardExportImport.Import(Path.Combine(folder, fileName));
            var game  = new Game(board);
            var owner = next ? board.WhoMovesNext() : board.WhoMovedLast();
            var state = game.GetBoardState(owner, Game.DefaultDepth, Game.DefaultWidth);

            return(state.GetNextCells());
        }
Example #5
0
        private void ExportBoardBtnClick(object sender, EventArgs e)
        {
            if (exportBoardFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            BoardExportImport.Export(currentBoard.Board, exportBoardFileDialog.FileName);
        }
Example #6
0
        private static List <Line> GetLines(string fileName, Cell cell)
        {
            var board = BoardExportImport.Import(Path.Combine(folder, fileName));
            var game  = new Game(board);
            var owner = board.WhoMovedLast();
            var lines = game.GetLines(owner);

            board[cell.X, cell.Y] = owner.Opponent();
            BoardFactory.AddCellToLines(cell, new BoardStateBase(new List <Line>(), lines, owner.Opponent(), board));
            return(lines);
        }
Example #7
0
        private static List <Line> GetChangedLines(string fileName, Cell cell, bool movesInOrder = false)
        {
            var board = BoardExportImport.Import(Path.Combine(folder, fileName));
            var game  = new Game(board);
            var owner = movesInOrder ? board.WhoMovesNext() : board.WhoMovedLast();
            var lines = game.GetLines(owner);

            board[cell.X, cell.Y] = owner;
            BoardFactory.AddCellToLines(cell, new BoardStateBase(lines, new List <Line>(), owner, board));
            return(lines);
        }
Example #8
0
        private void ImportBoardBtnClick(object sender, EventArgs e)
        {
            if (importBoardFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            var board = BoardExportImport.Import(importBoardFileDialog.FileName);

            UpdateGrid(new EstimatedBoard {
                Board = board
            });
        }