summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-05-23 14:42:30 +0200
committerTor Andersson <tor@ccxvii.net>2024-05-30 21:59:25 +0200
commitc397fedb0d4d801472584c1495e539058617c5ba (patch)
tree66cbcbf34189bf330fe346dce8649872cbf1ec8d
parenta8068262f23b72967957595f8bea20a30bc836a4 (diff)
downloadfriedrich-c397fedb0d4d801472584c1495e539058617c5ba.tar.gz
fifth deck
-rw-r--r--play.js2
-rw-r--r--rules.js9
2 files changed, 7 insertions, 4 deletions
diff --git a/play.js b/play.js
index 606167a..18053a6 100644
--- a/play.js
+++ b/play.js
@@ -317,12 +317,14 @@ function on_init() {
make_tc_deck(1)
make_tc_deck(2)
make_tc_deck(3)
+ make_tc_deck(4)
ui.tc_back = [
make_tc_deck_back("deck_1"),
make_tc_deck_back("deck_2"),
make_tc_deck_back("deck_3"),
make_tc_deck_back("deck_4"),
+ make_tc_deck_back("deck_5"),
]
ui.tcbreak = document.createElement("div")
diff --git a/rules.js b/rules.js
index 8a6bf7e..7aa3f8e 100644
--- a/rules.js
+++ b/rules.js
@@ -787,14 +787,14 @@ function check_victory_4() {
/* TACTICAL CARDS */
function find_largest_discard(u) {
- for (let i = 0; i < 4; ++i)
- if (u[i] <= u[0] && u[i] <= u[1] && u[i] <= u[2] && u[i] <= u[3])
+ for (let i = 0; i < 5; ++i)
+ if (u[i] <= u[0] && u[i] <= u[1] && u[i] <= u[2] && u[i] <= u[3] && u <= u[4])
return i
throw "IMPOSSIBLE"
}
function next_tactics_deck() {
- let held = [ 0, 0, 0, 0 ]
+ let held = [ 0, 0, 0, 0, 0 ]
// count cards in hands
for (let pow of all_powers) {
@@ -806,7 +806,7 @@ function next_tactics_deck() {
held[to_deck(c)]++
// find next unused deck
- for (let i = 1; i < 4; ++i) {
+ for (let i = 1; i < 5; ++i) {
if (held[i] === 0) {
game.deck = make_tactics_deck(i)
shuffle_bigint(game.deck)
@@ -819,6 +819,7 @@ function next_tactics_deck() {
log("Deck 2: " + make_tactics_discard(1).map(x=>"C"+x).join(" "))
log("Deck 3: " + make_tactics_discard(2).map(x=>"C"+x).join(" "))
log("Deck 4: " + make_tactics_discard(3).map(x=>"C"+x).join(" "))
+ log("Deck 5: " + make_tactics_discard(4).map(x=>"C"+x).join(" "))
// find two largest discard piles
let a = find_largest_discard(held)