Skip to content

Instantly share code, notes, and snippets.

@Oipo
Created December 15, 2018 18:03
Show Gist options
  • Save Oipo/e6594fc36993c23a5d7990af77dbfe82 to your computer and use it in GitHub Desktop.
Save Oipo/e6594fc36993c23a5d7990af77dbfe82 to your computer and use it in GitHub Desktop.
board schrodingerscat {
ownable card {
type enum alive | dead | empty | heisenberg
}
global gamble {
integer count_normal 0
integer count_empty 0
type enum alive | dead | empty
}
global turn_order {
order array integer []
current integer 0
}
global globals {
players array player []
}
actortype player {
alive boolean true
cards array card []
player_id integer 0
}
action increase_gamble {
require source.type player
require source.alive true
require turn_order[turn_order.current] == source.player_id
input type enum alive | dead | heisenberg
input count integer
if type == alive {
require count > gamble.count_normal
effect gamble.count_normal input count
}
if type == dead {
require count > gamble.count_normal
effect gamble.count_normal input count
}
if type == heisenberg {
require count > gamble.count_empty // this is not quite correct, needs some conversion from boxes to normal and vice versa
effect gamble.count_empty input count
}
posteffect {
set turn_order.current += 1
if turn_order.current > turn_order.order.size {
set turn_order.current = 0
}
}
}
action call_bullshit {
require source.type player
require turn_order[turn_order.current] == source.player_id
count integer 0
for x in globals.players {
for card in x.cards {
if gamble.type == alive {
if card.type == alive || card.type == heisenberg {
count += 1
}
}
if gamble.type == dead {
if card.type == dead || card.type == heisenberg {
count += 1
}
}
if gamble.type == empty {
if card.type == empty || card.type == heisenberg {
count += 1
}
}
}
}
previous_player integer turn_order.current
if previous_player == 0 {
previous_player = turn_order.order.size - 1
} else {
previous_player -= 1
}
if gamble.type == empty {
if gamble.count_empty > count {
remove turn_order[previous_player]
} else {
remove turn_order[turn_order.current]
}
} else {
if gamble.count_normal > count {
remove turn_order[previous_player]
} else {
remove turn_order[turn_order.current]
}
}
}
start {
for x in all_players { // all_players is a keyword provided by the DSL
insert turn_order.order x.id
create all_players.size card (random_enum) temp_label
create 1 player (true, temp_label, x.id) temp_player
insert globals.players temp_player
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment