Skip to content

Commit bd7a047

Browse files
committed
Stdgame split
1 parent afa650b commit bd7a047

File tree

2 files changed

+49
-49
lines changed

2 files changed

+49
-49
lines changed

strats/simple.clj

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,6 @@
11
(defn main [world undocumented]
22
'(initial_state step_fn))
33

4-
(defn world-map [world]
5-
(head world))
6-
7-
(defn lambda-man [world]
8-
(nth world 2))
9-
10-
(defn direction [actor]
11-
(nth actor 3))
12-
13-
(defn location [actor]
14-
(nth actor 2))
15-
16-
(def UP 0)
17-
(def LEFT 1)
18-
(def DOWN 2)
19-
(def RIGHT 3)
20-
(def DIRECTIONS [UP RIGTH DOWN LEFT UP RIGHT])
21-
22-
23-
(def WALL 0)
24-
(def EMPTY 1)
25-
(def PILL 2)
26-
(def POWER-PILL 3)
27-
(def FRUIT 4)
28-
(def LM 5)
29-
(def GHOST 6)
30-
31-
(defn at [world-map x y]
32-
(nth (nth (world-map) y) x))
33-
34-
(defn neighbour [pos direction]
35-
(let [x (head pos)
36-
y (tail pos)]
37-
(if (== direction UP)
38-
'(x, (prev y))
39-
(if (== direction LEFT)
40-
'((prev x), y)
41-
(if (== direction DOWN)
42-
'(x, (succ y))
43-
'((succ x), y))))))
44-
45-
(defn next [direction]
46-
(nth DIRECTIONS (succ direction)))
47-
48-
(defn back [direction]
49-
(if (== direction UP)
50-
RIGHT
51-
(nth DIRECTIONS (pred direction))))
52-
534
(def initial_state
545
0)
556

strats/stdgame.clj

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
(def UP 0)
2+
(def LEFT 1)
3+
(def DOWN 2)
4+
(def RIGHT 3)
5+
(def DIRECTIONS [UP RIGTH DOWN LEFT UP RIGHT])
6+
7+
8+
(def WALL 0)
9+
(def EMPTY 1)
10+
(def PILL 2)
11+
(def POWER-PILL 3)
12+
(def FRUIT 4)
13+
(def LM 5)
14+
(def GHOST 6)
15+
16+
17+
(defn world-map [world]
18+
(head world))
19+
20+
(defn lambda-man [world]
21+
(nth world 2))
22+
23+
(defn direction [actor]
24+
(nth actor 3))
25+
26+
(defn location [actor]
27+
(nth actor 2))
28+
29+
(defn at [world-map x y]
30+
(nth (nth (world-map) y) x))
31+
32+
(defn neighbour [pos direction]
33+
(let [x (head pos)
34+
y (tail pos)]
35+
(if (== direction UP)
36+
'(x, (prev y))
37+
(if (== direction LEFT)
38+
'((prev x), y)
39+
(if (== direction DOWN)
40+
'(x, (succ y))
41+
'((succ x), y))))))
42+
43+
(defn next [direction]
44+
(nth DIRECTIONS (succ direction)))
45+
46+
(defn back [direction]
47+
(if (== direction UP)
48+
RIGHT
49+
(nth DIRECTIONS (pred direction))))

0 commit comments

Comments
 (0)