Programming Resources
For Fun and Learning
Charles Cusack
Computer Science
Hope College
main

Python
C++

JAVA


PHP
SQL
Alice

Zuul


Description

Command.java
Game.java
Parser.java

Description

Updated files from the Zuul project that make testing your world easier. All you have to do is put commands one per line in a file and this will run them all and give the output.

You should be able to replace your versions of Command.java and Parser.java with these files, but do not overwrite your Game.java since is certainly has code that you will need! Instead, just copy autoPlay (new method) and replace your versions of play and printWelcome (It just addes a dashed line at the top so you can more easily tell when you are starting over).

Your commands.txt (or whatever you want to call it) should have commands, one per line, followed by the pound sign (#), followed by comments about what should happen. For instance, here is a short script that I used to tset my locked doors and missing exits:

go west # Should take us to pub.
back # We should be back in outside
go south # Should tell us it is locked
go north # should tell us that it is invalid
take key # key should be picked up
unlock north # should tell us there is no exit
unlock east # should tell us it isn't locked
unlock south # it should unlock the door
go south # should take us to lab
take zebra # It should say you can't carry the zebra
quit # It should quit.