dust/examples/clue_solver.ds

34 lines
587 B
Plaintext
Raw Normal View History

2023-10-07 01:59:01 +00:00
rooms = ["Library", "Kitchen"];
2023-10-16 20:48:02 +00:00
suspects = ["White", "Green"];
2023-10-07 01:59:01 +00:00
weapons = ["Rope", "Lead Pipe"];
2023-10-06 12:17:37 +00:00
2023-10-16 20:48:02 +00:00
show_card = function <card> {
(remove rooms card)
(remove suspects card)
(remove weapons card)
}
2023-10-07 01:59:01 +00:00
make_guess = function <current_room> {
if (length suspects) == 1
&& (length rooms) == 1
&& (length weapons) == 1
2023-10-16 20:48:02 +00:00
{
2023-10-07 01:59:01 +00:00
(output 'It was '
+ suspects.0
+ ' in the '
+ rooms.0
+ ' with the '
+ weapons.0
+ '!'
2023-10-16 20:48:02 +00:00
)
} else {
2023-10-07 01:59:01 +00:00
(output 'I accuse '
+ (random suspects)
+ ' in the '
+ current_room
+ ' with the '
+ (random weapons)
+ '!')
2023-10-16 20:48:02 +00:00
}
2023-10-07 01:59:01 +00:00
}