Esempio n. 1
0
        public override void GradeBoards( MoveRepresentationList list, BoardRepresentation initialBoard )
        {
            int race = 1;
            bool opponentFound = false;
            for ( int i = 0; i < initialBoard.SquareCount() && race == 1; i++ )
            {
                if ( !opponentFound && initialBoard.GetPiecesAt( i ) < 0 )
                    opponentFound = true;

                if ( opponentFound && initialBoard.GetPiecesAt( i ) > 0 )
                    race = 0;
            }

            for ( int i = 0; i < list.Count(); i++ )
            {
                int[] pubevalBoard = new int[28];
                MoveRepresentation currentBoard = list.GetMoveRepresentation( i );

                for ( int j = 0; j < currentBoard.SquareCount(); j++ )
                    pubevalBoard[j] = currentBoard.GetPiecesAt( j );

                pubevalBoard[26] = currentBoard.BearOffCountCurrent();
                pubevalBoard[27] = currentBoard.BearOffCountOpponent();

                double s = PubevalGrade( race, pubevalBoard );
                list.GetMoveRepresentation( i ).AddScore( s );
            }
        }
Esempio n. 2
0
        private int Race( BoardRepresentation currentBoard )
        {
            int race = 1;
            bool opponentFound = false;
            for ( int j = 0; j < currentBoard.SquareCount() && race == 1; j++ )
            {
                if ( !opponentFound && currentBoard.GetPiecesAt( j ) < 0 )
                    opponentFound = true;

                if ( opponentFound && currentBoard.GetPiecesAt( j ) > 0 )
                    race = 0;
            }
            return race;
        }
Esempio n. 3
0
        public bool Double()
        {
            if ( IsAgentPlaying( m_BgGame.CurrentOpponentPlayer ) && ( m_BgGame.CurrentOpponentPlayer == m_BgGame.GetCubeOwner() || m_BgGame.GetCubeOwner() == BgPlayer.None) )
            {
                BoardRepresentation currentBoard = new BoardRepresentation( m_BgGame );

                int[] flippedPattern = new int[currentBoard.SquareCount()];
                for ( int i = 0; i < currentBoard.SquareCount(); i++ )
                    flippedPattern[25-i] = -currentBoard.GetPiecesAt( i );

                BoardRepresentation flippedBoard = new BoardRepresentation( flippedPattern );

                int evaluator = m_GUI.SelectedEvaluator();
                if ( evaluator >= 0 )
                    return m_Plugins[evaluator].Double( flippedBoard );
            }
            return false;
        }