Beispiel #1
0
        private void readButton_Click(object sender, RoutedEventArgs e)
        {
            this.gameProvider = new GameProvider(this.gameProvider.Allocator);
            this.chessboardControl.SetupGameProvider(this.gameProvider);
            this.redoMoves = new List <MoveWithDecision>();

            string path = Directory.GetCurrentDirectory() +
                          System.IO.Path.DirectorySeparatorChar + "chess.game";

            string[]         lines = System.IO.File.ReadAllLines(path);
            Queem.Core.Color color = Queem.Core.Color.White;
            foreach (var line in lines)
            {
                var move = new Move(line);

                if (this.gameProvider.PlayerBoards[(int)color].Figures[(int)move.From] == Queem.Core.Figure.King)
                {
                    if (Math.Abs((int)move.From - (int)move.To) == 2)
                    {
                        move.Type = MoveType.KingCastle;
                    }
                }

                this.gameProvider.ProcessMove(move, color);
                color = (Queem.Core.Color)(1 - (int)color);
            }

            this.chessboardControl.RedrawAll();
        }
Beispiel #2
0
        public SortingTests()
        {
            this.provider = new GameProvider(new MovesArrayAllocator(100, 100));
            string path = "chess.game";

            string[]         lines = System.IO.File.ReadAllLines(path);
            Queem.Core.Color color = Queem.Core.Color.White;
            foreach (var line in lines)
            {
                var move = new Move(line);

                if (this.provider.PlayerBoards[(int)color].Figures[(int)move.From] == Queem.Core.Figure.King)
                {
                    if (Math.Abs((int)move.From - (int)move.To) == 2)
                    {
                        move.Type = MoveType.KingCastle;
                    }
                }

                this.provider.ProcessMove(move, color);
                color = (Queem.Core.Color)(1 - (int)color);
            }
        }
Beispiel #3
0
 public void PromotePawn(Queem.Core.Color color, Square square, Queem.Core.Figure figure)
 {
     this.viewModel.PromotePawn(color, square, figure);
 }