/Net/solen/u8/Faculty/ek/karl/Public/MC27/nim.scmsave it somewhere in your directory, and evaluate everything in it. This file contains the Nim program and the game-state implementation from the book, except that
human-moveare modified as indicated in exercise 6.13(c).
(load "/Net/solen/u8/Faculty/ek/karl/Public/MC27/move-instruction")You should be aware that this is not a file you can open up and read, but instead is a compiled version of the move-instruction ADT implementation. You are required to implement the move-instruction ADT yourself sometime in this lab, but we have set up the lab so that you can start out by simply using the ADT.
Once you have evaluated and loaded the two files (and be sure that you do so in the order we indicated), you can then play some Nim games with the computer by evaluating, for example, the expression:
(play-with-turns (make-game-state 5 8) 'human)Play a couple of games so that you get a hang of how the interaction works.
For your convenience when doing the implementation of the
move-instruction ADT, we have included ``stubs'' for the three ADT
operations near the bottom of the file; the constructor is called
make-move-instruction and the two selectors are called
pile-number. You should write
them correctly by removing the
error expressions which
they currently contain and replacing them with the actual procedure
bodies. You should then test your implementation by playing a game
like you did before.
Keep in mind that
constructs a move-instruction object, while
next-game-state actually performs the move.
randomprocedure, keep in mind that each time you use it you may get a different result; if you want to use the same randomly chosen integer twice, you should hold onto it, for example by naming it with a
let, as you won't be able to regenerate it.
As usual, write up a lab report that explains all of what you did to an audience generally knowledgeable about Scheme and such, but ignorant of specifically what you did. Answer all of the questions posed, but do not simply write up your lab as a sequence of exercises. Instead, try to convey the big picture of what you accomplished. Remember, there are some tips in the document entitled "Suggestions for clear lab reports in computer science courses."