// TODO-Main: Extract the features protected override RawPlayerState ExtractFeatures(GameState state, string myPlayerId) { var player = state.Players[myPlayerId]; var x = player.X; var y = player.Y; var topTile = (uint)GameStateUtils.GetBoardTile(state, x, y - 1, myPlayerId); var leftTile = (uint)GameStateUtils.GetBoardTile(state, x - 1, y, myPlayerId); var rightTile = (uint)GameStateUtils.GetBoardTile(state, x + 1, y, myPlayerId); var bottomTile = (uint)GameStateUtils.GetBoardTile(state, x - 1, y + 1, myPlayerId); var amIOnABomb = GameStateUtils.GetBoardTile(state, x, y, myPlayerId) == GameStateUtils.Tile.Bomb; var features = new List <float> { topTile, leftTile, rightTile, bottomTile, amIOnABomb ? 1: 0, }; // Don't touch anything under this line if (features.Count != featuresSize) { Console.WriteLine($"Feature count does not match, expected {featuresSize}, received {features.Count}"); throw new ArgumentOutOfRangeException(); } return(new RawPlayerState() { Features = features.ToArray() }); }
protected override PlayerState ExtractFeatures(GameState state, string myPlayerId) { var player = state.Players[myPlayerId]; var x = player.X; var y = player.Y; return(new PlayerState { TwoTopTile = (uint)GameStateUtils.GetBoardTile(state, x, y - 2, myPlayerId), TopTile = (uint)GameStateUtils.GetBoardTile(state, x, y - 1, myPlayerId), TwoLeftTile = (uint)GameStateUtils.GetBoardTile(state, x - 2, y, myPlayerId), LeftTile = (uint)GameStateUtils.GetBoardTile(state, x - 1, y, myPlayerId), RightTile = (uint)GameStateUtils.GetBoardTile(state, x + 1, y, myPlayerId), TwoRightTile = (uint)GameStateUtils.GetBoardTile(state, x + 2, y, myPlayerId), BottomCenterTile = (uint)GameStateUtils.GetBoardTile(state, x, y + 1, myPlayerId), TwoBottomTile = (uint)GameStateUtils.GetBoardTile(state, x, y + 2, myPlayerId), Alive = (uint)(player.Alive ? 1 : 0), Respawning = (uint)player.Respawning, BombsLeft = (uint)player.BombsLeft, }); }