Preserves2000: A multi-user version of Jelly2000. (For use in core-wars, where each player has their own PC and memory offset.) For a core-wars project: + write a jelly2000 program. Your program can *initially* only be stored in memory locations 0 through 999. Other enemy programs will be placed at random starting locations (initially) outside of 0...999. + There are 10000 memory locations (0 through 9999). Memory addresses "wrap around": that is, if you try to access memory location 30002, that is the same as memory location 2. --Aside: To other programs, *your* program will appear to be at a random location! (There is no specific alignment at multiples of 1000.) How? We will actually put *all* programs in random locations; If yours is put in the range 5432 to 6431, then we just will add 5432 to all memory addresses your program ever uses! Since memory wraps around, there is no particular "correct" frame of reference, so each program can pretend they are at 0. + Your ACC will initially contain the number of other players. + Make your program in a file. This file contains exactly what you would type into the Jelly2000 inspector program -- e.g. "p 54" to set the PC, or "(ldi 17)" to have 1701 placed into mem[PC]. (Note that you can have comments: semicolon to end-of-line, just like in drscheme). + There is a jelly2000 inspector command "l" to load a file. You can use this to load your file into the jelly2000 inspector. (You probably don't want to have "x" (execute) as one of the commands in your file!) + You don't have to, but i suggest you call your file "core-war.ss", inside your own comp200/ folder. | I am working on the Core Wars project, and I've written my program, but how | do I test it to make sure it works? | Okay, the simulator is working now. It just runs a game and prints out the winner. To run Core-Wars: (a) create a file of your Jelly2000 program, in the same format you'd type in by hand. Name your file "core-war.ss" in your comp200 directory. (For example, you can see: ~comp200/comp200/core-war.ss) (b) To run the simulator: In drscheme, (load "/home/comp200/Software/Preserves2000/preserves.ss") You can now run the simulator by calling "core-wars" and passing it a debug-flag (use #f), and a list of players: (core-war #f (list 'ian 'comp200)) (c) You can play with up to ~6 players, including multiple copies of the same player. You can try against 'comp200, and a slight variant 'ian. Note that when you give a user-name like that, it looks inside that user's comp200 directory for a file with the particular name "core-war.ss". Alternately, you can use a different file by using double-quotes: (core-war #f (list 'ian "/home/lalala/someOtherProgram.ss")) If you want to play vs your friends, you/they'll need to make your code readable to each other: "chmod o+rx ~/comp200" from the owlnet/unix prompt. You can find these instructions again, inside "/home/comp200/Software/Preserves2000/README". | What does the load command that Dr. Barland mentioned do? | In addition to being able to type "p" (set PC) and enter values into memory, you can also type "l", and be asked what file to load from. The machine-inspector will act as if you are typing the commands which are actually in the file. | what does Jelly do if you tell it to divide an odd number by 2. | Jelly truncates to integers. Thus it thinks 7/2 = 3.