software-challenge / backend

Server, Client und Spiel-Plugins der Software-Challenge Germany
https://www.software-challenge.de
11 stars 10 forks source link

Board generation seems to have no failsafe against illegal start configurations #413

Closed jnccd closed 1 year ago

jnccd commented 2 years ago

https://github.com/software-challenge/backend/blob/de424a85285bc7b5eb4fb054f002ac307e22863f/plugin/src/main/kotlin/sc/plugin2023/Board.kt#L65

If I and @FalconsSky read this part of the code correctly then there is no mechanism that prevents the board from being completely empty or more probable from having less than 8 single fish fields, which are nessecary to play the start of the game.

The rand varaible can either be in the range of 0..4 every time or be numbers bigger or equal to 20 until remainingFish is smaller than 21 and then just be in the range of 0..4

The board generator should in every possible case return a board that allows a full game to be played

xeruf commented 1 year ago

not quite true, but fixed fully now in https://github.com/software-challenge/backend/commit/545f2d423dd0ed76669d62eac7e3e912c3ff2776