Beispiel #1
0
        public void makeMove(State currentState)
        {
            if (type != PlayerType.AI)
            {
                MainMethod.die("Player.makeMove : makeMove called on a human player.");
            }

            Move move = aiFunc(currentState);

            if (move == null)
            {
                return;
            }

            //Log.writeSpecial("Move sent back by AI is: " + move.ToString());

            Core.drawCube.cube[move.row, move.col, move.distance] = (byte)playerNumber;
            Move.addShadows(Core.drawCube.cube, currentPosition, move);
            currentPosition = move;
        }
Beispiel #2
0
        public bool tryMove(Move move)
        {
            if (possibleMoves.Contains(move))
            {
                //Fill in all of the moves between where we are and where we are going.
                Core.drawCube.cube[move.row, move.col, move.distance] = (byte)playerNumber;
                if (currentPosition != null)
                {
                    //Core.drawCube.cube[currentPosition.row, currentPosition.col, currentPosition.distance] = (byte)Cube.SHADOW;
                    Move.addShadows(Core.drawCube.cube, currentPosition, move);
                }
                Core.moveCounter++;

                Log.writeSpecial("Player has moved to: " + move.ToString());

                currentPosition = move;

                return(true);
            }
            else
            {
                return(false);
            }
        }