diff --git a/examples/clue_solver.ds b/examples/clue_solver.ds index 1cb3fec..0ec4a97 100644 --- a/examples/clue_solver.ds +++ b/examples/clue_solver.ds @@ -1,6 +1,6 @@ -rooms = ['Library', 'Kitchen'] -suspects = ['White', 'Green'] -weapons = ['Rope', 'Lead_Pipe'] +rooms = ['Library' 'Kitchen'] +suspects = ['White' 'Green'] +weapons = ['Rope' 'Lead_Pipe'] cards = [rooms suspects weapons] take_turn = function { @@ -10,7 +10,7 @@ take_turn = function { remove_card = function { for card_list in cards { - removed = remove card from card_list { + removed = remove card in card_list { card == opponent_card } } @@ -20,10 +20,13 @@ remove_card = function { } } +(remove_card 'Library') +(output cards) + make_guess = function { - if (length suspects) == 1 - && (length rooms) == 1 - && (length weapons) == 1 + if ((length suspects) == 1) + && ((length rooms) == 1) + && ((length weapons) == 1) { (output 'It was ' + suspects.0 @@ -31,8 +34,7 @@ make_guess = function { + rooms.0 + ' with the ' + weapons.0 - + '!' - ) + + '!') } else { (output 'I accuse ' + (random suspects) @@ -43,3 +45,5 @@ make_guess = function { + '!') } } + +(make_guess 'Library') diff --git a/examples/random.ds b/examples/random.ds new file mode 100644 index 0000000..5ea2251 --- /dev/null +++ b/examples/random.ds @@ -0,0 +1,13 @@ +stuff = [ + (random_integer) + (random_integer) + (random_integer) + (random_float) + (random_float) + (random_float) + "foobar_1" + "foobar_2" + "foobar_3" +] + +(random [])