コード例 #1
0
ファイル: MoveParser.cs プロジェクト: TomHulme/P4P
 /*
  * 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;
 }
コード例 #2
0
ファイル: GameController.cs プロジェクト: TomHulme/P4P
        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();
            }
        }
コード例 #3
0
ファイル: GameController.cs プロジェクト: TomHulme/P4P
        /**
         * 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);
        }
コード例 #4
0
ファイル: MoveGenerator.cs プロジェクト: TomHulme/P4P
 static MoveGenerator()
 {
     mgInstance = new MoveGenerator();
 }