add flag for deceptive special rank
This commit is contained in:
parent
98c9f56f36
commit
c0f007c15c
3 changed files with 17 additions and 6 deletions
|
@ -173,6 +173,7 @@ def init_static_tables():
|
|||
special_rank_no_colors = var.get('specialNoClueColors', False)
|
||||
special_rank_all_colors = var.get('specialAllClueColors', False)
|
||||
special_rank = var.get('specialRank', None)
|
||||
special_deceptive = var.get('specialDeceptive', False)
|
||||
|
||||
assert(not all([special_rank_all_ranks, special_rank_no_ranks]))
|
||||
assert(not all([special_rank_all_colors, special_rank_no_colors]))
|
||||
|
@ -184,14 +185,14 @@ def init_static_tables():
|
|||
"INSERT INTO variants ("
|
||||
"id, name, clue_starved, throw_it_in_a_hole, alternating_clues, synesthesia, chimneys, funnels,"
|
||||
"no_color_clues, no_rank_clues, empty_color_clues, empty_rank_clues, odds_and_evens, up_or_down,"
|
||||
"critical_fours, num_suits, special_rank, special_rank_ranks, special_rank_colors"
|
||||
"critical_fours, num_suits, special_rank, special_rank_ranks, special_rank_colors, special_deceptive"
|
||||
")"
|
||||
"VALUES"
|
||||
"(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
|
||||
"(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
|
||||
(
|
||||
var_id, name, clue_starved, throw_it_in_a_hole, alternating_clues, synesthesia, chimneys, funnels,
|
||||
no_color_clues, no_rank_clues, empty_color_clues, empty_rank_clues, odds_and_evens, up_or_down,
|
||||
critical_fours, num_suits, special_rank, special_rank_ranks, special_rank_colors
|
||||
critical_fours, num_suits, special_rank, special_rank_ranks, special_rank_colors, special_deceptive
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -84,7 +84,16 @@ CREATE TABLE variants (
|
|||
Encodes how cards of the special rank (if present) are touched by colorss,
|
||||
in the same manner how we encoded in @table suits
|
||||
*/
|
||||
special_rank_colors SMALLINT NOT NULL DEFAULT 1
|
||||
special_rank_colors SMALLINT NOT NULL DEFAULT 1,
|
||||
/**
|
||||
If set to true, then cards of the special rank
|
||||
will appear as different ranks depending on their suit:
|
||||
The rank values touching the deceptive special rank are chosen consecutively (starting from smallest)
|
||||
among all available ranks in the order of the suits of the variant, wrapping around if necessary.
|
||||
If set, special_rank_ranks has to be set to 1
|
||||
*/
|
||||
special_deceptive BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
CHECK (special_rank_ranks = 1 OR special_deceptive IS FALSE)
|
||||
);
|
||||
CREATE INDEX variants_name_idx ON variants (name);
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class Variant:
|
|||
def __init__(
|
||||
self, name, clue_starved, throw_it_in_a_hole, alternating_clues, synesthesia, chimneys, funnels,
|
||||
no_color_clues, no_rank_clues, empty_color_clues, empty_rank_clues, odds_and_evens, up_or_down,
|
||||
critical_fours, special_rank, special_rank_ranks, special_rank_colors, suits: List[Suit]
|
||||
critical_fours, special_rank, special_rank_ranks, special_rank_colors, special_deceptive, suits: List[Suit]
|
||||
):
|
||||
self.name = name
|
||||
self.clue_starved = clue_starved
|
||||
|
@ -98,6 +98,7 @@ class Variant:
|
|||
self.special_rank = special_rank
|
||||
self.special_rank_ranks = special_rank_ranks
|
||||
self.special_rank_colors = special_rank_colors
|
||||
self.special_deceptive = special_deceptive
|
||||
|
||||
self.suits = suits
|
||||
self.colors = []
|
||||
|
@ -119,7 +120,7 @@ class Variant:
|
|||
"SELECT "
|
||||
"name, clue_starved, throw_it_in_a_hole, alternating_clues, synesthesia, chimneys, funnels, "
|
||||
"no_color_clues, no_rank_clues, empty_color_clues, empty_rank_clues, odds_and_evens, up_or_down,"
|
||||
"critical_fours, special_rank, special_rank_ranks, special_rank_colors "
|
||||
"critical_fours, special_rank, special_rank_ranks, special_rank_colors, special_deceptive "
|
||||
"FROM variants WHERE id = %s",
|
||||
(var_id,)
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue