Skip to content
This repository
Newer
Older
100644 304 lines (277 sloc) 16.205 kb
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
1 <html>
2 <!--
3 Copyright (C) 2011, Bill Burdick, Tiny Concepts: http://tinyconcepts.com/fs.pl/lambda.fsl
4
5 (licensed with ZLIB license)
6
7 This software is provided 'as-is', without any express or implied
8 warranty. In no event will the authors be held liable for any damages
9 arising from the use of this software.
10
11 Permission is granted to anyone to use this software for any purpose,
12 including commercial applications, and to alter it and redistribute it
13 freely, subject to the following restrictions:
14
15 1. The origin of this software must not be misrepresented; you must not
16 claim that you wrote the original software. If you use this software
17 in a product, an acknowledgment in the product documentation would be
18 appreciated but is not required.
19
20 2. Altered source versions must be plainly marked as such, and must not be
21 misrepresented as being the original software.
22
23 3. This notice may not be removed or altered from any source distribution.
24 -->
25 <head>
26 <style>
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
27 #grid td {
28 position: relative;
29 width: 12px;
30 height: 12px;
31 overflow: visible;
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
32 }
a188539f »
2011-06-06 allow lambda characters in programs
33 #grid div,#grid img {
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
34 position: absolute;
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
35 text-align: center;
36 vertical-align: middle;
a188539f »
2011-06-06 allow lambda characters in programs
37 width: 24px; height: 24px;
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
38 overflow: visible;
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
39 }
40 .hidden {
41 height: 0;
42 width: 0;
43 visibility: hidden;
44 display: none;
45 }
46 </style>
47 <script src="lc.js"></script>
48 <script>
49 var grid
a188539f »
2011-06-06 allow lambda characters in programs
50 var icons = ['empty.png', 'ship.png', 'invDown.png', 'invUp.png', 'empty.png']
786994ab »
2011-05-30 more work
51 var state
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
52
221ceb18 »
2011-06-01 cleaned up LC code
53 function icon(c) {
54 return icons[num(c, 0, 1, 2, 3, 4)]
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
55 }
56
57 function updateGrid(rows) {
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
58 for (var r = 0; r < 19; r++) {
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
59 var row = rows(LC.code.get1)
60
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
61 for (var c = 0; c < 19; c++) {
a188539f »
2011-06-06 allow lambda characters in programs
62 grid.rows[r].cells[c].firstElementChild.src = icon(row(LC.code.get1))
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
63 row = row(LC.code.left)
64 }
65 rows = rows(LC.code.left)
66 }
67 }
68 function updateShip(row) {
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
69 for (var i = 0; i < 19; i++) {
70 grid.rows[19].cells[i].firstElementChild.src = icon(row(LC.code.get1))
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
71 row = row(LC.code.left)
72 }
73 }
4341ba8e »
2011-05-31 invaders: tweaked autorepeat, started on alien movement
74 var buttonCounter = 0
786bc7f7 »
2011-05-31 added button autorepeat
75 var buttonOp = null
4341ba8e »
2011-05-31 invaders: tweaked autorepeat, started on alien movement
76 var continueButton = false
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
77 var LEFT = 37
78 var RIGHT = 39
786bc7f7 »
2011-05-31 added button autorepeat
79 function setOperation(op) {
4341ba8e »
2011-05-31 invaders: tweaked autorepeat, started on alien movement
80 var old = buttonOp
81
82 continueButton = true
83 buttonOp = op
84 if (!old) doOp()
786bc7f7 »
2011-05-31 added button autorepeat
85 }
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
86 function keypress(event) {
c81fb017 »
2011-06-07 event handling fixes
87 var transition = (event.keyCode & 63) == LEFT ? left
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
88 : (event.keyCode & 63) == RIGHT ? right
c81fb017 »
2011-06-07 event handling fixes
89 : (event.keyCode == 32) ? fire
90 : stay
91
92 if (transition != stay) {
93 setOperation(transition)
94 event.stopPropagation()
95 event.preventDefault()
96 }
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
97 }
786bc7f7 »
2011-05-31 added button autorepeat
98 function next() {
99 window.setTimeout(function(){
4341ba8e »
2011-05-31 invaders: tweaked autorepeat, started on alien movement
100 if (buttonOp) doOp()
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
101 }, 50)
786bc7f7 »
2011-05-31 added button autorepeat
102 }
4341ba8e »
2011-05-31 invaders: tweaked autorepeat, started on alien movement
103 function doOp() {
104 if (buttonCounter % 2 == 0) {
105 buttonOp()
106 if (!continueButton) buttonOp = stay
107 } else {
108 stay()
109 }
110 buttonCounter++
111 }
786994ab »
2011-05-30 more work
112 function left() {
113 state = state(LC.code.moveLeft)
114 display()
786bc7f7 »
2011-05-31 added button autorepeat
115 next()
786994ab »
2011-05-30 more work
116 }
117 function stay() {
118 state = state(LC.code.stay)
119 display()
786bc7f7 »
2011-05-31 added button autorepeat
120 next()
786994ab »
2011-05-30 more work
121 }
122 function right() {
123 state = state(LC.code.moveRight)
124 display()
786bc7f7 »
2011-05-31 added button autorepeat
125 next()
126 }
127 function fire() {
128 state = state(LC.code.fire)
129 display()
130 next()
131 }
786994ab »
2011-05-30 more work
132 function display() {
f31f06cf »
2011-06-06 fixed generated code comments
133 updateGrid(state(LC.code['first']))
134 updateShip(state(LC.code['second']))
786994ab »
2011-05-30 more work
135 }
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
136 function loaded() {
a188539f »
2011-06-06 allow lambda characters in programs
137 var code = document.getElementById("code").innerHTML
138
139 document.getElementById("code").innerHTML = code.replace(/\\/g, '\u03BB')
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
140 wrap = LC.wrap
141 grid = document.getElementById('grid')
a188539f »
2011-06-06 allow lambda characters in programs
142 LC.loadDefs(code)
786994ab »
2011-05-30 more work
143 state = LC.code.start()
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
144 num = LC.lcode('num')
786994ab »
2011-05-30 more work
145 display()
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
146 }
147 </script>
148 </head>
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
149 <body onload="loaded()" onkeydown="keypress(event)" onkeyup="continueButton = false">
a188539f »
2011-06-06 allow lambda characters in programs
150 <table style="width: 100%; height: 100%; border: 0">
2227de09 »
2011-06-07 cleaned up page (code on right)
151 <tr style="height: 1px"><td style="width: 25%; vertical-align: top"><table style='padding-right: 12px; padding-bottom: 24px; outline: solid black 1px'><tr><td>
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
152 <table id="grid">
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
153 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
154 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
155 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
156 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
157 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
158 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
159 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
160 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
161 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
162 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
163 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
164 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
165 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
166 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
167 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
168 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
169 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
170 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
171 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
172 <tr><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td><td><img></td></tr>
2227de09 »
2011-06-07 cleaned up page (code on right)
173 </table></td></tr><tr><td></table><br>
a19463bf »
2011-06-07 doc
174 Here's my simplistic version of "space invaders". It's not as deluxe as the real one, but the point is to show how you might make a video game with Lambda Calculus.<br><br>
2e624eba »
2011-06-07 doc
175
a19463bf »
2011-06-07 doc
176 The only thing that works right now is the left and right arrow keys :).<br><br>
2e624eba »
2011-06-07 doc
177
178 Below is all of the Lambda Calulus code. JavaScript provides the key event (or an empty key event) and the game state to a Lambda Calculus function to calculate the next state of the game. Then, it uses other Lambda Calculus functions to inspect the current state so it can display it.<br><br>
4e201c9d »
2011-06-07 docs
179
180 To advance the state, JavaScript calls (state eventFunc). State starts out equal to (start). The eventFuncs are: (moveLeft), (moveRight), (stay), and (fire).<br><br>
181
182 The screen is a grid of values, with a row of values underneath. A row has 19 values in it, so it's a function which applies its argument to its 19 values. The grid is really a "row of rows". You can use (left) and (right) to rotate the values and (get1) to get the first value. The base values are numbers from 0 to 4, represented with 5 argument functions that return the Nth argument, depending on which number the function represents.<br><br>
183
2227de09 »
2011-06-07 cleaned up page (code on right)
184 </td>
185 <td>
186 <table style="width: 100%; height: 100%"><tr style="height: 1px"><td><b>Code</b></td></tr>
187 <tr><td><div style="height: 100%; position: relative">
a188539f »
2011-06-06 allow lambda characters in programs
188 <pre class="hidden" id='preamble'>
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
189 # Y combinator
190 Y = \g . (\x . g (x x)) \x . g (x x)
191 rec = \f . f (Y f)
192
193 # lists
194 # using false as "nil" in lists, so you use a list like this:
195 # DUMMY can be anything, but it needs to be there
196 # here's how you use a list:
197 # aList (\h t DUMMY . {list-case}) {empty-case}
198 # If the list is not empty, h and t are the head and tail of the list and it returns list-case. DUMMY is not used, but needs to be there
199 # If the list is empty, it returns empty-case
200 cons = \a b f.f a b
201 nil = false
202 head = \l . l (\h t D . h) nil
203 tail = \l . l (\h t D . t) nil
204 null = \l . l (\h t D . false) true
205 last = rec \last l . l (\h t D . null t h (last t)) nil
206 append = rec \append l1 l2 . l1 (\h t D . cons h (append t l2)) l2
207 reverse = \l . (rec \rev l res . l (\h t D . rev t (cons h res)) res) l nil
221ceb18 »
2011-06-01 cleaned up LC code
208 # list constructor: [1,2,3]
209 # this uses some parsing rules: =(]=, =.=, and =)=
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
210 [ =(]= \item f . f (cons item nil)
211 , =.= \l item f . f (cons item l)
212 ] =)= reverse
a188539f »
2011-06-06 allow lambda characters in programs
213 </pre>
2227de09 »
2011-06-07 cleaned up page (code on right)
214 <pre style="height: 100%; width: 100%; overflow: auto; position: absolute; margin: 0; outline: solid black 1px; padding: 5px" id='code'>
a188539f »
2011-06-06 allow lambda characters in programs
215 # Booleans
2227de09 »
2011-06-07 cleaned up page (code on right)
216 t = \x y . x
217 f = \x y . y
218 not = \a . a f t
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
219
220 # 10 x 9 grid (a 9x9 grid for missiles and aliens and a 9x1 row for the ship)
221 # a grid row applies a function of 9 arguments to its values
221ceb18 »
2011-06-01 cleaned up LC code
222 # a grid cell represents a value from 0 to 4 (empty, ship, alien1, alien2, missile)
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
223 # higher values 'beat' lower values
221ceb18 »
2011-06-01 cleaned up LC code
224 # cells are functions of 5 arguments and they indicate their value by returning the nth argument (like booleans)
225
226 # cell functions
96c4975c »
2011-06-08 Throw error when someone tries to use a free variable as a function
227 e = \1 2 3 4 5 . 1
228 s = \1 2 3 4 5 . 2
229 a1 = \1 2 3 4 5 . 3
230 a2 = \1 2 3 4 5 . 4
231 m = \1 2 3 4 5 . 5
232 cell = \n f . f n
233 isE = \n . n t f f f f
234 kills? = \n1 n2 . n1 n2 (n2 n1 n1 n2 n2 n2) (n2 n1 n1 n1 n2 n2) (n2 n1 n1 n1 n1 n2) n1
221ceb18 »
2011-06-01 cleaned up LC code
235
236 # row functions
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
237 row = \1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 g . g 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
238 left = \1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 g . g 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 1
239 right = \1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 g . g 19 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
240 cellA = \1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 . cell 1
241 cellZ = \1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 . cell 19
242 get1 = \1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 . 1
2227de09 »
2011-06-07 cleaned up page (code on right)
243 # return a new row with each element applied to a function
244 row-to-func = \g 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 r . r (1 g) (2 g) (3 g) (4 g) (5 g) (6 g) (7 g) (8 g) (9 g) (10 g) (11 g) (12 g) (13 g) (14 g) (15 g) (16 g) (17 g) (18 g) (19 g)
245 # return a new row with a function applied to each element
246 func-to-row = \g 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 r . r (g 1) (g 2) (g 3) (g 4) (g 5) (g 6) (g 7) (g 8) (g 9) (g 10) (g 11) (g 12) (g 13) (g 14) (g 15) (g 16) (g 17) (g 18) (g 19)
247 # to calculate the value:
248 # 1) get the first result by applying the first cell to the function 'first'
249 # 2) get the next result for every other element by applying previous result to the function 'f' and applying the result of that to the row element
250 # 3) get the final value by applying the final result to the function 'last'
251 rowReduce = \first g last 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 . 1 first g 2 g 3 g 4 g 5 g 6 g 7 g 8 g 9 g 10 g 11 g 12 g 13 g 14 g 15 g 16 g 17 g 18 g 19 last
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
252 empty = row e e e e e e e e e e e e e e e e e e e
253 arow1 = row e e e e e a1 e a1 e a1 e a1 e a1 e e e e e
254 gridStart = row arow1 empty arow1 empty arow1 empty arow1 empty empty empty empty empty empty empty empty empty empty empty empty
255 shipStart = row e e e e e e e e e s e e e e e e e e e
221ceb18 »
2011-06-01 cleaned up LC code
256
257 # grid functions
258 identity = \x . x
259 ignore = \x . row
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
260 onFirstEmpty = \1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 . 1 identity ignore ignore ignore ignore
2227de09 »
2011-06-07 cleaned up page (code on right)
261 # compare a cell with the first row element. If they're both e, return a cell with e otherwise return one of the non-e values
f6167440 »
2011-06-07 expanded grid from 9x9 to 19x19
262 check1 = \n r . r \m1 m2 m3 m4 m5 m6 m7 m8 m9 m10 m11 m12 m13 m14 m15 m16 m17 m18 m19 . cell (n m1 n n n n)
263 check9 = \n r . r \m1 m2 m3 m4 m5 m6 m7 m8 m9 m10 m11 m12 m13 m14 m15 m16 m17 m18 m19 . cell (n m19 n n n n)
2227de09 »
2011-06-07 cleaned up page (code on right)
264 isAllFirstEmpty = rowReduce cellA check1 isE
265 isAllLastEmpty = rowReduce cellZ check9 isE
266 allLeft = row-to-func left
267 allRight = row-to-func right
221ceb18 »
2011-06-01 cleaned up LC code
268
d98332ba »
2011-06-06 better counter (12 values, divisible by 2, 3, 4, and 6)
269 # counter
270 counter = \1 2 3 4 5 6 7 8 9 10 11 12 c . c 1 2 3 4 5 6 7 8 9 10 11 12
271 cNext = \1 2 3 4 5 6 7 8 9 10 11 12 c . c 2 3 4 5 6 7 8 9 10 11 12 1
272 cTrue = \1 2 3 4 5 6 7 8 9 10 11 12 . 1
273 slowest = counter t f f f f f f f f f f f
274 slower = counter t f f f f f t f f f f f
275 slow = counter t f f f t f f f t f f f
276 fast = counter t f f t f f t f f t f f
277 faster = counter t f t f t f t f t f t f
278 fastest = counter t t t t t t t t t t t t
279
221ceb18 »
2011-06-01 cleaned up LC code
280 # game functions
2227de09 »
2011-06-07 cleaned up page (code on right)
281 cflip = \n . n e s a2 a1 m
282 flip = func-to-row cflip
283 allFlip = row-to-func flip
284 start = \statef . statef gridStart shipStart t slowest
285 checkDir = \grid left? . left? (grid isAllFirstEmpty) (not (grid isAllLastEmpty))
286 next = \grid ship left? ctr statef . (\dir . statef (ctr cTrue (grid (dir allLeft allRight) allFlip) grid) ship dir (ctr cNext)) (checkDir grid left?)
a27c4c0f »
2011-06-03 checkpoint
287
786994ab »
2011-05-30 more work
288 #events
a188539f »
2011-06-06 allow lambda characters in programs
289 moveLeft = \grid ship left? ctr . next grid (ship (ship onFirstEmpty left)) left? ctr
290 moveRight = \grid ship left? ctr . next grid (ship (ship right onFirstEmpty right)) left? ctr
291 stay = \grid ship left? ctr . next grid ship left? ctr
292 fire = \grid ship left? ctr . next (missile grid ship) ship left? ctr
786994ab »
2011-05-30 more work
293
294 # accessors
f31f06cf »
2011-06-06 fixed generated code comments
295 first = \a b c d . a
296 second = \a b c d . b
a188539f »
2011-06-06 allow lambda characters in programs
297 num = \n 0 1 2 3 4 . n 0 1 2 3 4
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
298 </pre>
a188539f »
2011-06-06 allow lambda characters in programs
299 </div>
2227de09 »
2011-06-07 cleaned up page (code on right)
300 </td></tr></table>
301 </td></tr></table>
679d7e8d »
2011-05-30 refactored evaluator.html into lc.js for embedding
302 </body>
303 </html>
Something went wrong with that request. Please try again.