[Community Puzzle] Bandas

https://www.codingame.com/multiplayer/bot-programming/bandas

Send your feedback or ask for help here!

Created by @Oli8,validated by @Alain-Delpuch,@Monstruo and @Fireball0923.
If you have any issues, feel free to ping them.

The game was accepted despite negative pending comments on the random game generation.

@Oli8, I’d like to know what is your stance on future updates of the game: should we consider that the game will remain as-is, or do you intend to change game mechanics in the future ?

Context for those who don’t know the game: a full-fledged MCTS with MCTS-solver loses 10% of its games against a 5-liner heuristic. I made comments to try and reduce the one-sidedeness of some random starting positions.

5 Likes

Hey,

I do intend to improve the game in the futur.
For the random distribution problem, I’m thinking about balancing the 4*4 center square first.
I will also add a win/lose message at the end of the game, fix the “replay in same conditions” problem and other stuffs :slight_smile:
Anyway, I’ll be listening to comments, also if anyone want to contribute feel free to message me
and/or make a pull request on the github repository.

Nice game, although for rare occasion it can loop, for example this replay . My bot pobably had few the same fastest moves… @Oli8 what’s the result in this case? A draw?

If the 200 turn limit is reached, the winner is the player with the most pawns left on the board. We can see it now with the #1 and #2 markers on the Last battles window :slight_smile:

1 Like

I noticed that the bottom row often belonged entirely to a single player, seemingly too often to be just by chance.

Looking at the referee, the grid is filled from top to bottom, so as soon as one player has half the cells, all the remaining ones have to be given to the other player. This explains the lack of randomness in the last row.

I submitted a pull request to fix this. I took the occasion to use the game seed as well, so “Replay in same conditions” should become functional too if this is applied.

3 Likes

Thanks, I will look it up :slight_smile:

Update:
Better randomness for pawn position and “replay in same conditions” functionnal.

Thanks to dbdr !

3 Likes

Cool puzzle. I would suggest highlighting the pieces of the player whose turn it is. When watching the replay, all the moving pieces make it hard to keep track of whose turn it is.

1 Like

Hi,

Why in C language, the “line” entry does not return complete strings?

Example for : fprintf (stderr, “#% s”, line);

Error output:

# 1 1 0 0 1 1 # 0 0
# 0 0 1 0 1 # 0
# 1 0 1 1 0 # 0
# 1 1 1 0 0 # 0
# 0 1 1 0 0 # 1
# 0 1 0 0 1 # 0
# 0 1 1 0 1 # 0
# 0 1 0 0 1

This complicates the analysis of the entries from the start, no ? … :frowning:

Furthermore, why in Initialization input, we have:

Line 2: 1 integer height height of the grid
Line 3: 1 integer width width of the grid

While in the rules:

The game is played on a 8x8 grid.

Thank you very much,

@j3r3m The default code in C is broken (it is very often the case on CG), here is a version that works (a line is 8 digits 0/1 + 7 spaces in between + 1 \n + 1 \0):

for (int i = 0; i < height; i++) {
    char line[17];
    fgets(line, 17, stdin);
    fprintf(stderr, "%s", line);
}

But you’d better do something like that anyway:
[EDIT: Actually the following is only appropriate for the first turn, after that you can get chars other than 0/1, but that’s the idea.]

int grid[8][8];
for (int i = 0; i < height; i++)
    for (int j = 0; j < width; j++)
        scanf("%d", &grid[i][j]);
1 Like

@Niako That’s what I suspected :roll_eyes:, anyway, thanks for the fix.

@j3r3m Back then I wanted to make the grid size variable.

Aaaaaah :star_struck:
Thank you ! It work !