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") @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()); 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"); return new RedirectView("/room/"+g.getId()+"/grid");
} }
@@ -49,6 +49,12 @@ public class GridConfig {
public static final Set<Integer> BASE_HINTWORDCOUNT = Set.of( public static final Set<Integer> BASE_HINTWORDCOUNT = Set.of(
0,1,2,3,4,5,6,7,8,9,-1 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( public static final GridConfig CODENAMES_CLASSICAL = new GridConfig(
9, true, true, CLASSICAL25, true, 9, true, true, CLASSICAL25, true,
true, true, 9, BASE_HINTWORDCOUNT, true, true, true, 9, BASE_HINTWORDCOUNT, true,
+4 -2
View File
@@ -6,9 +6,11 @@
<body> <body>
<main> <main>
Vous voulez jouer à Node Cames ? Ben c'est pas encore prêt :/ Vous voulez jouer à Node Cames ? Ben c'est là.
<br/> <br/>
<a href="/create-room">(Bon, en vrai, vous pouvez créer une room en cliquant ici)</a> <a href="/create-room?type=zero">Grille Zéro</a>
<a href="/create-room?type=base">Grille Normale</a>
<a href="/create-room?type=big">Grille Grosse</a>
<br/> <br/>