Example #1
0
        public override Dictionary <QStateActionPair, QState> GetObservedStates(QState prevState, QAction action)
        {
            TicTacToe stateAfterMyMove       = (TicTacToe)prevState.GetNewState(action);
            TicTacToe stateFromOpponentsView = new TicTacToe()
            {
                myMoves = stateAfterMyMove.yourMoves.ToList(), yourMoves = stateAfterMyMove.myMoves.ToList(), me = you, you = me, random = random, gui = gui, openSpaces = stateAfterMyMove.openSpaces.ToList(), score = stateAfterMyMove.score
            };
            TicTacToe stateNowFromOpponentsView = new TicTacToe()
            {
                myMoves = yourMoves.ToList(), yourMoves = myMoves.ToList(), me = you, you = me, random = random, gui = gui, openSpaces = openSpaces.ToList(), score = stateAfterMyMove.score
            };

            foreach (Point x in stateNowFromOpponentsView.myMoves)
            {
                if (!stateFromOpponentsView.myMoves.Contains(x))
                {
                    return new Dictionary <QStateActionPair, QState>()
                           {
                               { new QStateActionPair(stateFromOpponentsView, new QAction_String(x.X + "," + x.Y)), stateNowFromOpponentsView }
                           }
                }
            }
            ;

            return(new Dictionary <QStateActionPair, QState>());
        }
Example #2
0
        // If the above are implemented correctly, the GetCopy() function should be able to return a duplicate QState object by just calling Open(Save())
        public QState GetCopy()
        {
            QState s = Open(Save());

            s.Inherit(this);
            return(s);
        }
Example #3
0
        public override Dictionary <QStateActionPair, QState> GetObservedStates(QState prevState, QAction action)
        {
            Maze m = (Maze)prevState;
            Dictionary <QStateActionPair, QState> otherMoves = new Dictionary <QStateActionPair, QState>();

            foreach (QAction a in prevState.GetActions())
            {
                Maze potentialMove = (Maze)m.GetNewState(a);
                potentialMove.opponent = opponent.ToList();
            }

            return(otherMoves);
        }
Example #4
0
 // Returns the other observable QStates to learn from, such as moves it could have done or what opponents did
 public override Dictionary <QStateActionPair, QState> GetObservedStates(QState prevState, QAction action)
 {
     return(new Dictionary <QStateActionPair, QState>()
     {
     });
 }