Ejemplo n.º 1
0
 /*
  * Returns true if a move is valid for a given position
  */
 public static Boolean isMoveValid(Move move, Position position)
 {
     if (move == null)
     {
         return false;
     }
     ArrayList moves = new MoveGenerator().legalMoves(position);
     foreach (Move listMove in moves)
     {
         //Move is only valid if it appears in legal moves list
         if (move.Equals(listMove))
         {
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 2
0
        public GameController(bool b, Position pos, bool blackIsAI, bool whiteIsAI)
        {
            this.board = new Board(b, pos, this, !blackIsAI);
            board.setup();
            this.position = pos;
            this.movegen = new MoveGenerator();
            this.Subscribe(this);

            this.blackIsAI = blackIsAI;
            this.whiteIsAI = whiteIsAI;

            TurnGenerator = SetupTurnGenerator();

            if (blackIsAI & whiteIsAI)
            {
                bw = new BackgroundWorker();
                bwSetup();
            }else{
                AI = new ComputerPlayer(engine.engineProcess.StandardOutput, engine.engineProcess.StandardInput);
                ResetEngineDifficulty();
            }
        }
Ejemplo n.º 3
0
        /**
         * GameController Constructors
         * Create and Setup Board, initialise class variables.
         */
        public GameController(bool b, Position pos)
        {
            this.board = new Board(b, pos, this);
            board.setup();
            this.position = pos;
            this.movegen = new MoveGenerator();
            this.tutorialFlag = false;

            this.Subscribe(this);
        }
Ejemplo n.º 4
0
 static MoveGenerator()
 {
     mgInstance = new MoveGenerator();
 }