private static ReinforceState BuildReinforceState(double[] armyStrengthsAndOwnedTiles, Tile tile)
        {
            var result = new ReinforceState();

            result.Tile = tile;
            for (int i = 0; i < 8; ++i)
            {
                result.State[i] = armyStrengthsAndOwnedTiles[i];
            }
            return(result);
        }
        private static void SetInput(Tuple <Player, int>[] ownedTiles, ReinforceState reinforceState, int counter, Tile currentTile)
        {
            if (currentTile.Player == null)
            {
                return;
            }
            int tileOwner = 0;

            for (int i = 0; i < ownedTiles.Length; ++i)
            {
                if (currentTile.Player == ownedTiles[i].Item1)
                {
                    tileOwner = i;
                    break;
                }
            }
            reinforceState.State[8 + counter + (25 * tileOwner)] = currentTile.ArmyCount / 5.0;
        }
Ejemplo n.º 3
0
    internal void RightClick()
    {
        if (PopUp)
        {
            return;
        }

        switch (state)
        {
        case GameState.Battle:
            BattleState.RightClick();
            break;

        case GameState.Transfer:
            TransferState.RightClick();
            break;

        case GameState.Reinforce:
            ReinforceState.RightClick();
            break;
        }
    }
Ejemplo n.º 4
0
    public void ProvinceClicked(Province p)
    {
        if (PopUp)
        {
            return;
        }

        switch (state)
        {
        case GameState.Battle:
            BattleState.ProvinceClicked(p, players[activePlayer]);
            break;

        case GameState.Transfer:
            TransferState.ProvinceClicked(p, players[activePlayer]);
            break;

        case GameState.Reinforce:
            ReinforceState.ProvinceClicked(p, players[activePlayer]);
            break;
        }
    }
Ejemplo n.º 5
0
 public double Evaluate(ReinforceState attackState)
 => network.Compute(attackState.State).First();
        private static void UpdateState(GameManager board, Tuple <Player, int>[] ownedTiles, int startX, int endX, int stepX, int startY, int endY, int stepY, ReinforceState reinforceState)
        {
            int counter = 0;

            for (int tmpX = startX; tmpX != endX; tmpX += stepX)
            {
                for (int tmpY = startY; tmpY != endY; tmpY += stepY)
                {
                    if (tmpX < 0 || tmpX >= 6 || tmpY < 0 || tmpY >= 6)
                    {
                        reinforceState.State[8 + counter + (25 * 4)] = 1;
                    }
                    else
                    {
                        SetInput(ownedTiles, reinforceState, counter, board.Tiles[tmpX, tmpY]);
                    }
                    counter++;
                }
            }
        }