45 lines
827 B
Plaintext
45 lines
827 B
Plaintext
rooms = ['Library' 'Kitchen']
|
|
suspects = ['White' 'Green']
|
|
weapons = ['Rope' 'Lead_Pipe']
|
|
cards = [rooms suspects weapons]
|
|
|
|
take_turn = function <current_room opponent_card> {
|
|
(remove_card opponent_card)
|
|
(make_guess current_room)
|
|
}
|
|
|
|
remove_card = function <opponent_card> {
|
|
for card_list in cards {
|
|
removed = remove card in card_list {
|
|
card == opponent_card
|
|
}
|
|
}
|
|
|
|
if (type removed) == 'empty' {
|
|
(output 'Card not found.')
|
|
}
|
|
}
|
|
|
|
make_guess = function <current_room> {
|
|
if ((length suspects) == 1)
|
|
&& ((length rooms) == 1)
|
|
&& ((length weapons) == 1)
|
|
{
|
|
(output 'It was '
|
|
+ suspects.{0}
|
|
+ ' in the '
|
|
+ rooms.{0}
|
|
+ ' with the '
|
|
+ weapons.{0}
|
|
+ '!')
|
|
} else {
|
|
(output 'I accuse '
|
|
+ (random suspects)
|
|
+ ' in the '
|
|
+ current_room
|
|
+ ' with the '
|
|
+ (random weapons)
|
|
+ '!')
|
|
}
|
|
}
|