Contract con_rftest2


Contract Code


  
1 random.seed()
2 last_event = Variable()
3 function_test = Variable()
4
5 @construct
6 def seed():
7 last_event.set(0)
8 function_test.set(0)
9
10 @export
11 def event():
12
13 events = {
14 1 : freak_rain, #extra water
15 2 : hot_day, #lose water
16 3 : swarm, #more bugs
17 }
18
19 event_num = (random.randint(1, 3))
20 events[event_num]()
21 last_event.set(event_num)
22
23 def freak_rain(plant_data):
24 function_test.set(10)
25
26 def hot_day(plant_data):
27 function_test.set(20)
28
29 def swarm(plant_data):
30 function_test.set(30)

Byte Code

e30000000000000000000000000400000040000000735400000065006a018300010065026400640164028d025a0365026400640364028d025a046404640584005a0565066400830164066407840083015a076408640984005a08640a640b84005a09640c640d84005a0a640e5300290fda0b636f6e5f72667465737432da0a6c6173745f6576656e742902da08636f6e7472616374da046e616d65da0d66756e6374696f6e5f74657374630000000000000000000000000200000043000000731800000074006a0164018301010074026a016401830101006400530029024ee9000000002903da0c5f5f6c6173745f6576656e74da03736574da0f5f5f66756e6374696f6e5f74657374a900720a000000720a000000da00da045f5f5f5f06000000730400000000010a01720c000000630000000000000000020000000400000043000000733000000074007401740264019c037d0074036a046402640383027d017c007c0119008300010074056a067c01830101006400530029044e2903e901000000e902000000e903000000720d000000720f0000002907da0c5f5f667265616b5f7261696eda095f5f686f745f646179da075f5f737761726dda0672616e646f6dda0772616e64696e74720700000072080000002902da066576656e7473da096576656e745f6e756d720a000000720a000000720b000000da056576656e740b000000730800000000020c010c010a017217000000630100000000000000010000000200000043000000730e00000074006a016401830101006400530029024ee90a0000002902720900000072080000002901da0a706c616e745f64617461720a000000720a000000720b000000721000000013000000730200000000017210000000630100000000000000010000000200000043000000730e00000074006a016401830101006400530029024ee91400000029027209000000720800000029017219000000720a000000720a000000720b000000721100000017000000730200000000017211000000630100000000000000010000000200000043000000730e00000074006a016401830101006400530029024ee91e00000029027209000000720800000029017219000000720a000000720a000000720b00000072120000001b0000007302000000000172120000004e290b7213000000da0473656564da085661726961626c6572070000007209000000720c000000da085f5f6578706f72747217000000721000000072110000007212000000720a000000720a000000720a000000720b000000da083c6d6f64756c653e01000000730e00000008010c010c030805100808040804