File tree 3 files changed +77
-0
lines changed
3 files changed +77
-0
lines changed Original file line number Diff line number Diff line change
1
+ say (" I Am the Very Model of a Modern Major-General" )
2
+
3
+ wait (seconds (10 ))
4
+
5
+ send (" soldier" , " Report in" )
6
+
7
+ function even (id )
8
+ return id % 2 == 0
9
+ end
10
+
11
+ self = even (me ().Id )
12
+
13
+ done = false
14
+
15
+ id = me ().Id
16
+
17
+ spawn (" secretary" , function ()
18
+ say (" I am the secretary" )
19
+ wait (minutes (1 ))
20
+ say (" We're done here" )
21
+ done = true
22
+ send (id , " Go home" )
23
+ end )
24
+
25
+ while not done do
26
+ msg = wait (any_msg ())
27
+ if msg .Src .Kind == " soldier" then
28
+ if self == even (msg .Src .Id ) then
29
+ send (msg .Src .Id , " Prepare for battle" )
30
+ else
31
+ say (" I don't like %s" , msg .Src .Name )
32
+ end
33
+ elseif msg .Src .Kind == " orc" then
34
+ say (" We'll handle you %s" , msg .Src .Name )
35
+ end
36
+ end
37
+
38
+ say (" I guess we're done" )
Original file line number Diff line number Diff line change
1
+ say (" I live to serve" )
2
+
3
+ wait (seconds (me ().Id * 2 ))
4
+
5
+ say (" I'm getting impatient" )
6
+
7
+ wait (seconds (20 ))
8
+
9
+ say (" I'm done waiting" )
10
+
11
+ send (" soldier" , " Die human!" )
Original file line number Diff line number Diff line change
1
+ say (" Soldier on duty!" )
2
+
3
+ msg = wait (msg_from (" general" ))
4
+
5
+ send (msg .Src .Id , " Reporting for duty" )
6
+
7
+ which , msg = wait (any (msg_from (" general" ), seconds (20 )))
8
+
9
+ attacking = false
10
+ if which == 1 then
11
+ say (" The general says %q" , msg .Msg )
12
+ attacking = true
13
+ else
14
+ say (" forever alone :.(" )
15
+ end
16
+
17
+ repeat
18
+ which , msg = wait (any (msg_from (" orc" ), seconds (20 )))
19
+ if which == 1 then
20
+ if attacking then
21
+ say (" Attack %s" , msg .Src .Name )
22
+ else
23
+ say (" Run Away! Run Away!" )
24
+ end
25
+ end
26
+ until which == 2
27
+
28
+ say (" To the tavern to celebrate" )
You can’t perform that action at this time.
0 commit comments