Skip to content

Commit 0faff42

Browse files
committed
Update translator - add code expample
1 parent 080c58c commit 0faff42

1 file changed

Lines changed: 31 additions & 44 deletions

File tree

translator.py

Lines changed: 31 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,50 +3,37 @@
33
from io import StringIO
44
from re import compile
55

6-
# namespace opcodes {
7-
# enum Opcodes {
8-
# mutate_attack = -19, // mutate attack = -19
9-
# mutate, // mutate genome = -18
10-
# check_target_minerals, // check target minerals = -17
11-
# check_my_minerals, // check my minerals = -16
12-
# check_my_level, // check my level = -15
13-
# check_my_energy, // check my energy = -14
14-
# align, // align horizontally = -13
15-
# share, // share = -12
16-
# reproduction, // reproduction = -11
17-
# eat, // eat = -10
18-
# steal, // steal = -9
19-
# check, // check = -8
20-
# minerals, // minerals = -7
21-
# photosynthesis, // photosynthesis = -6
22-
# convert_minerals, // convert minerals = -5
23-
# change_dir, // change directory (absolutely) = -4
24-
# right, // right = -3
25-
# left, // left = -2
26-
# step // step = -1
27-
# };
28-
#}
29-
30-
#class Opcode(Enum):
31-
# MUTATE_ATTACK = -19
32-
# MUTATE = -18
33-
# CHECK_TARGET_MINERALS = -17
34-
# CHECK_MY_MINERALS = -16
35-
# CHECK_MY_LEVEL = -15
36-
# CHECK_MY_ENERGY = -14
37-
# ALIGN = -13
38-
# SHARE = -12
39-
# REPRODUCTION = -11
40-
# EAT = -10
41-
# STEAL = -9
42-
# CHECK = -8
43-
# MINERALS = -7
44-
# PHOTOSYNTHESIS = -6
45-
# CONVERT_MINERALS = -5
46-
# CHANGE_DIR = -4
47-
# RIGHT = -3
48-
# LEFT = -2
49-
# STEP = -1
6+
# +---------- Example -----------
7+
# | #size 60
8+
# | #default NOP
9+
# |
10+
# | start:
11+
# |
12+
# | CHECK {
13+
# | GOTO(simbot),
14+
# | GOTO(bot),
15+
# | GOTO(organic),
16+
# | GOTO(empty),
17+
# | GOTO(simbot)
18+
# | };
19+
# |
20+
# | empty:
21+
# | STEP;
22+
# | GOTO(start);
23+
# |
24+
# | organic:
25+
# | EAT;
26+
# | GOTO(start);
27+
# |
28+
# | bot:
29+
# | MINERALS;
30+
# | STEAL;
31+
# | GOTO(start);
32+
# |
33+
# | simbot:
34+
# | RIGHT;
35+
# | GOTO(start);
36+
5037

5138
@dataclass
5239
class Opcode:

0 commit comments

Comments
 (0)