public MainWindowsViewModel()
 {
     clickCommand   = new RelayCommand(t => ClickOnButton((Button)t), can => CheckCanPlay(can));
     NewGameCommand = new RelayCommand(t => { Game.ResetGame(); InvalidateContent(); });
     Game           = new TicTacToeGame();
 }
Beispiel #2
0
        public TicTacToePlayer(TicTacToeGame ticTacToeGame, string playername, string playerSymbol)
        {
            this.ticTacToeGame = ticTacToeGame;
            this.PlayerName    = playername;
            this.PlayerSymbol  = playerSymbol;

            _fieldWinningSetting = new System.Collections.Generic.List <System.Collections.Generic.List <TicTacToeField> >()
            {
                new System.Collections.Generic.List <TicTacToeField>()
                {
                    //xxx
                    //###
                    //###
                    ticTacToeGame.GameField[0, 0],
                    ticTacToeGame.GameField[0, 1],
                    ticTacToeGame.GameField[0, 2],
                },
                new System.Collections.Generic.List <TicTacToeField>()
                {
                    //x##
                    //x##
                    //x##
                    ticTacToeGame.GameField[0, 0],
                    ticTacToeGame.GameField[1, 0],
                    ticTacToeGame.GameField[2, 0],
                },
                new System.Collections.Generic.List <TicTacToeField>()
                {
                    //###
                    //xxx
                    //###
                    ticTacToeGame.GameField[1, 0],
                    ticTacToeGame.GameField[1, 1],
                    ticTacToeGame.GameField[1, 2],
                },
                new System.Collections.Generic.List <TicTacToeField>()
                {
                    //###
                    //###
                    //xxx
                    ticTacToeGame.GameField[2, 0],
                    ticTacToeGame.GameField[2, 1],
                    ticTacToeGame.GameField[2, 2],
                },
                new System.Collections.Generic.List <TicTacToeField>()
                {
                    //##x
                    //##x
                    //##x
                    ticTacToeGame.GameField[0, 2],
                    ticTacToeGame.GameField[1, 2],
                    ticTacToeGame.GameField[2, 2],
                },
                new System.Collections.Generic.List <TicTacToeField>()
                {
                    //x##
                    //#x#
                    //##x
                    ticTacToeGame.GameField[0, 0],
                    ticTacToeGame.GameField[1, 1],
                    ticTacToeGame.GameField[2, 2],
                },
                new System.Collections.Generic.List <TicTacToeField>()
                {
                    //##x
                    //#x#
                    //x##
                    ticTacToeGame.GameField[0, 2],
                    ticTacToeGame.GameField[1, 1],
                    ticTacToeGame.GameField[0, 2],
                }
            };
        }