Added create grid config option

This commit is contained in:
Mysaa Java
2026-09-26 02:33:48 +02:00
parent fa82900770
commit 0bb880d434
3 changed files with 18 additions and 4 deletions
@@ -100,9 +100,15 @@ public class HttpController {
}
@GetMapping("/create-room")
public RedirectView createRoom() {
public RedirectView createRoom(@RequestParam("type") String type) {
GridConfig cfg = switch(type) {
case "zero" -> GridConfig.ZERO;
case "base" -> GridConfig.CODENAMES_CLASSICAL;
case "big" -> GridConfig.BIG_CLASSICAL;
default -> GridConfig.CODENAMES_CLASSICAL;
};
Random r = new Random(rand.nextLong());
Grid g = gm.newGrid(null, GridConfig.ZERO, r);
Grid g = gm.newGrid(null, cfg, r);
return new RedirectView("/room/"+g.getId()+"/grid");
}
@@ -49,6 +49,12 @@ public class GridConfig {
public static final Set<Integer> BASE_HINTWORDCOUNT = Set.of(
0,1,2,3,4,5,6,7,8,9,-1
);
public static final GridConfig BIG_CLASSICAL = new GridConfig(
12, true, true, CUSTOM36, true,
true, true, 12, BASE_HINTWORDCOUNT, true,
Integer.MAX_VALUE, true, true,
true, false);
public static final GridConfig CODENAMES_CLASSICAL = new GridConfig(
9, true, true, CLASSICAL25, true,
true, true, 9, BASE_HINTWORDCOUNT, true,