commit 656b92483ba4cfe16cd747673ffef5ffd5c31510
parent c5db911ec988be160ef1bddf315dd284affc4fc2
Author: FIGBERT <figbert@figbert.com>
Date: Mon, 15 Feb 2021 13:38:50 -0800
Adjust dreidel ruleset
The new ruleset rounds up on hey, and antes after
every turn. This remains subject to change, but now
brings game time down to a reasonable length.
Diffstat:
2 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/log.md b/log.md
@@ -8,10 +8,10 @@
- The spin order is the order clients joined the lobby
- Each player takes/gives gelt to the pot based on spin
- Gimel - take all
- - Hey - take half (floored)
+ - Hey - take half (rounded up)
- Nun - take nothing
- Shin - put one in
-- If the pot has less than two pieces of gelt, everyone puts in one piece
+- Everybody antes up (puts a piece of gelt into the pot)
- If a player cannot put in a piece, they are out
## Win Condition
- A winner is determined once everybody else is out
diff --git a/src/scripts/main.gd b/src/scripts/main.gd
@@ -115,11 +115,11 @@ remote func shake_action() -> void:
func _client_spun(sender: int) -> void:
rpc("print_message_from_server", "%s has spun the dreidel..." % players[sender]["name"])
- var needs_ante := _spin_dreidel(sender)
- if needs_ante:
- rpc("print_message_from_server", _gelt_status())
- rpc("print_message_from_server", "Time to ante up!")
- yield(_everyone_puts_in_one(), "completed")
+ yield(get_tree().create_timer(1), "timeout")
+ _spin_dreidel(sender)
+ rpc("print_message_from_server", _gelt_status())
+ rpc("print_message_from_server", "Time to ante up!")
+ yield(_everyone_puts_in_one(), "completed")
var has_won := _check_for_winner()
if has_won:
var winner := _find_winner()
@@ -129,10 +129,9 @@ func _client_spun(sender: int) -> void:
_iterate_turn()
-func _spin_dreidel(id: int) -> bool:
+func _spin_dreidel(id: int) -> void:
randomize()
var username: String = players[id]["name"]
- var needs_ante := false
var spin: int = floor(rand_range(0, 4))
var result: String = DREIDEL_FACES[spin]
rpc("print_message_from_server", "%s landed on %s!" % [username, result])
@@ -140,12 +139,9 @@ func _spin_dreidel(id: int) -> bool:
1: # gimmel
players[id]["gelt"] += pot
pot = 0
- needs_ante = true
2: # hey
- players[id]["gelt"] += floor(pot / 2.0)
- pot -= floor(pot / 2.0)
- if pot == 1:
- needs_ante = true
+ players[id]["gelt"] += ceil(pot / 2.0)
+ pot -= ceil(pot / 2.0)
3: # pey/shin
if players[id]["gelt"] > 0:
players[id]["gelt"] -= 1
@@ -153,7 +149,6 @@ func _spin_dreidel(id: int) -> bool:
else:
rpc("print_message_from_server", "%s can't pay – you lose!" % username)
players[id]["in"] = false
- return needs_ante
func _everyone_puts_in_one() -> void: