1
0
dust/examples/clue_solver.ds

37 lines
784 B
Plaintext
Raw Normal View History

2023-10-25 18:41:23 +00:00
rooms = ['Library' 'Kitchen']
suspects = ['White' 'Green']
weapons = ['Rope' 'Lead_Pipe']
2023-10-19 01:50:45 +00:00
cards = [rooms suspects weapons]
2023-10-06 12:17:37 +00:00
2023-10-31 22:18:39 +00:00
take_turn = function current_room opponent_card
remove_card opponent_card
make_guess current_room
2023-10-19 01:50:45 +00:00
2023-10-31 22:18:39 +00:00
remove_card = function opponent_card
for card_list in cards
removed = remove card from card_list
2023-10-19 01:50:45 +00:00
card == opponent_card
2023-10-31 22:18:39 +00:00
if type removed == 'empty'
output 'Card not found.'
2023-10-16 20:48:02 +00:00
2023-10-31 22:18:39 +00:00
make_guess = function current_room
if length suspects == 1 && length rooms == 1 && length weapons == 1
2023-10-07 01:59:01 +00:00
(output 'It was '
2023-10-31 05:09:29 +00:00
+ suspects:0
2023-10-07 01:59:01 +00:00
+ ' in the '
2023-10-31 05:09:29 +00:00
+ rooms:0
2023-10-07 01:59:01 +00:00
+ ' with the '
2023-10-31 05:09:29 +00:00
+ weapons:0
2023-10-25 18:41:23 +00:00
+ '!')
2023-10-31 22:18:39 +00:00
else
2023-10-07 01:59:01 +00:00
(output 'I accuse '
2023-10-24 00:45:47 +00:00
+ (random suspects)
+ ' in the '
+ current_room
+ ' with the '
+ (random weapons)
+ '!')
2023-10-31 05:09:29 +00:00
(make_guess 'Library')