37 lines
784 B
Plaintext
37 lines
784 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 from 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)
|
|
+ '!')
|
|
|
|
(make_guess 'Library')
|