about summary refs log tree commit diff stats
path: root/chessboard.mu
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-06-22 21:16:31 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-06-22 21:16:31 -0700
commit2c7e84c2bc3abd87090bd8f73ce5d6ec8ce19c9e (patch)
treec97203f0d8a64a38293f4b06c35970c30d6f98fa /chessboard.mu
parentc49efefc235e2cf91a44f4459b67ad780dd3bb1f (diff)
downloadmu-2c7e84c2bc3abd87090bd8f73ce5d6ec8ce19c9e.tar.gz
1620
chessboard finally passing all its tests. What made this hard was that
for some reason one of the background routines in the main chessboard
test wasn't terminating like it used to. And so it was polluting *later*
tests. Just clean up that source of contamination for now. Later we'll
think about routine termination.
Diffstat (limited to 'chessboard.mu')
-rw-r--r--chessboard.mu23
1 files changed, 18 insertions, 5 deletions
diff --git a/chessboard.mu b/chessboard.mu
index c5f7ed4f..da0cd93f 100644
--- a/chessboard.mu
+++ b/chessboard.mu
@@ -29,10 +29,12 @@ scenario print-board-and-read-move [
   # we'll make the screen really wide because the program currently prints out a long line
   assume-screen 120:literal/width, 20:literal/height
   # initialize keyboard to type in a move
-  assume-keyboard [a2-a4
+  assume-console [
+    type [a2-a4
 ]
+  ]
   run [
-    screen:address, keyboard:address <- chessboard screen:address, keyboard:address
+    screen:address, console:address <- chessboard screen:address, console:address
 #?     $browse-trace #? 1
 #?     $close-trace #? 1
     # icon for the cursor
@@ -64,6 +66,17 @@ scenario print-board-and-read-move [
   ]
 ]
 
+#? scenario foo [ #? 1
+#?   $print [aaa] #? 1
+#?   run [ #? 1
+#?     1:number <- copy 34:literal #? 1
+#?   ] #? 1
+#?   memory-should-contain [ #? 1
+#?     1 <- 34 #? 1
+#?   ] #? 1
+#?   $print [zzz] #? 1
+#? ] #? 1
+
 ## Here's how 'chessboard' is implemented.
 
 recipe chessboard [
@@ -71,13 +84,13 @@ recipe chessboard [
 #?   $start-tracing #? 1
   default-space:address:array:location <- new location:type, 30:literal
   screen:address <- next-ingredient
-  keyboard:address <- next-ingredient
-#?   $print [screen: ], screen:address, [, keyboard: ], keyboard:address, [ 
+  console:address <- next-ingredient
+#?   $print [screen: ], screen:address, [, console: ], console:address, [ 
 #? ] #? 1
   board:address:array:address:array:character <- initial-position
   # hook up stdin
   stdin:address:channel <- new-channel 10:literal/capacity
-  start-running send-keys-to-channel:recipe, keyboard:address, stdin:address:channel, screen:address
+  start-running send-keys-to-channel:recipe, console:address, stdin:address:channel, screen:address
   # buffer lines in stdin
   buffered-stdin:address:channel <- new-channel 10:literal/capacity
   start-running buffer-lines:recipe, stdin:address:channel, buffered-stdin:address:channel