Exemple #1
0
    IEnumerator Evaluate(Position position)
    {
        //board.SetState(position, behaviorParameters.TeamId);
        //evaluatedMove = position;
        //evaluation = float.MinValue;
        //RequestDecision();
        //yield return new WaitUntil(() => evaluation != float.MinValue);
        //board.SetState(position, 0);
        //heatMap.SetHeat(evaluatedMove, evaluation);

        ulong bitsPlayer0 = game.board.GetBitMask(-1).bits;
        ulong bitsPlayer1 = game.board.GetBitMask(+1).bits;

        evaluatedMove = position;
        evaluation    = float.MinValue;
        switch (position.x + game.board.size.y * position.y)
        {
        case 2:
            game.board.MirrorHorizontally();
            position = new Position(0, 0);
            break;

        case 3:
            game.board.MirrorDiagonally();
            position = new Position(0, 1);
            break;

        case 5:
            game.board.MirrorHorizontally();
            game.board.MirrorDiagonally();
            position = new Position(0, 1);
            break;

        case 6:
            game.board.MirrorVertically();
            position = new Position(0, 0);
            break;

        case 7:
            game.board.MirrorVertically();
            position = new Position(0, 1);
            break;

        case 8:
            game.board.MirrorHorizontally();
            game.board.MirrorVertically();
            position = new Position(0, 0);
            break;
        }
        game.board.SetState(position, id);
        RequestDecision();
        yield return(new WaitUntil(() => evaluation != float.MinValue));

        game.board.GetBitMask(-1).bits = bitsPlayer0;
        game.board.GetBitMask(+1).bits = bitsPlayer1;
        heatMap.SetHeat(evaluatedMove, evaluation);
    }
Exemple #2
0
    protected IEnumerator RequestMoveCoroutine()
    {
        possibleMoveAmount = -1;
        heatMap            = new HeatMap(game.board.size);
        for (Position position = new Position(0, 0); position.x < game.board.size.x; ++position.x)
        {
            for (position.y = 0; position.y < game.board.size.y; ++position.y)
            {
                if (game.board.GetState(position) == 0)
                {
                    ++possibleMoveAmount;
                    yield return(Evaluate(position));
                }
                else
                {
                    heatMap.SetHeat(position, float.MinValue);
                }
            }
        }
        Position move = heatMap.GetHottestPosition();

        game.DoMove(heatMap.GetHottestPosition());
    }