State file query

Hi guys

From what I can see in your sample state files

State.json always has a player1 and player2 state but nothing populated in player and opponent section.

From another users post you state p1 and p2 is only for visual

How do I get a correct version of the state file specificatly for a round for my bot?

Trying to see how much info is provided to me
I.e. Which ship has been destroyed on my opponents side

Hi MarkMyb,

That is correct yes, the state files are slightly different. The best way would probably be to just run the game engine and then kill it, odds are one of the bots did not process the round yet so the state file will still be there before the game engine could delete it.

Attached is an example for you to look at however.

state.json (14.0 KB)

thanks dude that file attached helped appreciate it

Hi

hitting another snag not sure how to fix it.

basically the game engine runs, ship placement check.

however the state file generated for the bots still does not contain anything? getting null for both player and opponent.
is there a switch i need to enable on the engine?

Hi MarkMyb,

Do the state files contain something during the first phase, the planting phase?

Hi

nope , player and opponent maps are null.

however player 1 and player 2 is populated

Hi,

During phase 1, the ship placing phase, there should be no information in the player’s map and opponent’s map file to assist you in placing your ships. Are they still null during phase 2?

thought that as well but when it enters phase 2 the information is still null ?

{“PlayerMap”:null,“OpponentMap”:null,“GameVersion”:“1.0.0”,“GameLevel”:1,“Round”:18,“MapDimension”:10,“Phase”:2

taken from map files:

########## Player

~~SSS~
RRRDD~

~BBBB~~~~~
~~~CCCCC~~

########## Player

~~~~~~~~B~
~~~~~~~~B~
~C~~~~~DB~
~C~~~~~DB~
~C~~~~~~~~
~C~~~~RRR~
~C~~~~~~~~

~SsS~~

edit:
forgot to add the batch file commands i’m running

Battleships.exe -b “…\Reference Bots\C#” “…\Reference Bots\mine” --clog --pretty --debug

Hi,

I will have a look and see what could be causing this

Hi Foamy

found the issue, was a json error.

the statefile i originally got had the following header mapped in the file.

OpponentMap --> MapCells

however the state files generated from the console app
OpponentMap --> Cells

once i fixed my code to work with the console state file and not the state file provided by Wackymax it worked like a bomb.

tho i did find a few games where the reference bot was not able to place its ships but it got awarded the win.

regards
Mark

Hi MarkMyb,

Thanks for the update, I have read and experienced that the reference bot doesn’t always place it’s bot, I will have a look into that. I am glad you figured it out! Hope you are enjoying it and stay tuned for any changes.

Hi,

I’ve read this thread, and Question about Player2 info in state.json, and Different State file many times over, but I still can’t figure this out.

I’m working in Java. My problem is closest to @MarkMyb’s. My GameState.PlayerMap and GameState.OpponentMap is always null, because the state.json file that’s passed in at the start of every turn, has these values set to null. If I change my GateState to include:
public PlayerMap Player2Map; public OpponentMap Player1Map;
then these 2 fields are populated. I understand that Player*Map will be null in each round, and only populated at the end of the match, so I can’t use it at all.

Unfortunately I can’t decipher Mark’s fix :slight_smile: If it’s a ‘json error’, and the json file is created externally, then what was the solution? My bot always used OpponentMap.Cells, but I don’t see how changing that would help if the json OpponentMap is always null.

Please help! Here is my state.json (10.7 KB) created in Phase 2 Round 5.

I use: Battleships.exe --pretty -b ../javaOP ../ME

In summary, why is my json PlayerMap and OpponentMap null?

Hi mvariyawa,

So there are two state.json files with different content. This is confusing I know and we apologize for not making this better before the launch.

The first state.json file will be in the directory passed to your bot in it’s arguments {match}/{round}/{bot key}/state.json and it will have the PlayerMap and OpponentMap fields. The second file is the round directory {match}/{round}/state.json and that one will contain the Player1Map and Player2Map fields.

Hope this clears things up?

Ah! I see. Wow I thought I was going nuts there. No apology needed. The great support on this forum far outweighs these minor teething problems I’m having :+1:

I just had a peek in the folder I was suppose to be using, and that state file has the details I was expecting. Thank you so much.

Regards
Mohamed