To make the program easier to design and implement, I have decided to let the robot program be written in a text file, so that advanced programmers don't have to limit themselves to a visual programming interface. The language will be Scheme, which provides for flexibility in writing your programs. For non-programmers, there will also be a visual programming interface, which will generate Scheme code.
GNU Robots will use GNU Guile as the language back-end (Scheme handler). This will make the GNU Robots game engine more consistent with other GNU projects, as it will use the same extension language.
The GNU Robots playing field will be one large matrix of spaces, which can be filled with a food item (increases energy), prizes (to increase your score), walls (which you can bump into), and baddies (which can inflict damage.)
The following are the features that are planned for future releases of GNU Robots:
Version 1.0
Version 2.0
To build GNU Robots, you first need to have already compiled/installed the GNU Guile libraries. GNU Robots was built using Guile 1.2.
Then, just make sure the root Makefile is okay for your system (check that CC is correct for your system, and that the Makefile matches where you have installed the Guile libraries), and type:
make
In future, I will use GNU Autoconf, so your Makefile(s) will be created for you, just like other GNU programs.
This will create these programs in the src/ directory:
Program | What it does |
---|---|
robots | a curses-based version of the game |
xrobots | an X Windows version of the game |
robots_logfile | a version that generates a log file |
The robots program is a curses-based version of the game, using an ASCII approximation of the game elements. Your robot will appear as a v when it points South, ^ when it points North, and < and > for West and East. Empty spaces are shown as ., walls as #, baddies as @, and food and prizes as + and $.
The sample map that is provided as mapfile.map is just a single room, with prizes all along the four walls. The sample robot program test.scm knows how to pick up all these prizes and then quit. Other map files can be found in the src/maps directory, and other robot programs will be distributed in the scheme directory.
The usage for robots, xrobots, robots_logfile is as follows:
Usage: robots [OPTION]... [FILE] GNU Robots - game/diversion where you construct a program for a little robot, then watch him explore a world. -f, --map-file=FILE load this map file -V, --version output version information and exit -h, --help display this help and exit
This section is intended for anyone making changes to GNU Robots
This is a summary of how the GNU Robots program is using GNU Guile. This is meant to be an overview of the Robots program, to provide a framework for understanding the program. Not that GNU Robots is a terribly difficult program to understand. But if you haven't used GNU Guile in a program before, you may have trouble figuring GNU Robots out. Here's what's happening:
gh_enter(argc, argv, main_prog);
gh_new_procedure1_0("robot-feel", robot_feel); gh_new_procedure1_0("robot-look", robot_look); gh_new_procedure0_0("robot-grab", robot_grab); gh_new_procedure0_0("robot-zap", robot_zap);
The language will allow the following robot actions. You can also look at some robot examples to see how to use the robot actions. Note that every robot action will drain your robot of some energy.
Since the robot will be implemented using Guile, you write the rest of your program in Scheme, which allows you to create a really intricate robot program.
robot-look thing
The robot will look ahead across empty spaces for a specific
thing. If the thing was found, the true/false flag is True.
robot-feel thing
The robot will feel ahead exactly 1 space for a thing. If the
thing was found, the true/false flag is True.
robot-smell thing
The robot will smell the surrounding 8 spaces for a thing. If the
thing is found, the true/false flag is True.
robot-move n
The robot will move n spaces forwards (positive n) or backwards
(negative n). If the robot was able to move without bumping into
something, then the true/false flag is True.
robot-turn n
The robot turns n increments of 90-degrees to the right (positive
n) or to the left (negative n). Always True.
robot-zap
The robot shoots its little gun, to zap whatever is exactly one
space ahead of it. Always True. This action consumes a lot of
energy.
robot-grab
The robot grabs (and consumes, if food) whatever is exactly one
space ahead of it. Always True, even if there was nothing to take.
The following are things that can be tested for in the above actions:
wall
A piece of a wall. You can't zap these.
prize
An item that increases your score. Be careful not to zap these!
food
An item that adds to your robot energy. You can zap these if you
aren't careful.
baddie
A creature that can harm your robot. You can zap these to get
them out of your way.
space
An empty space.
Please send FSF & GNU inquiries & questions to gnu@gnu.org. There are also other ways to contact the FSF.
Please send comments on these web pages to jhall1@isd.net, send other questions to gnu@gnu.org.
Copyright (C) 1998 Jim Hall
Verbatim copying and distribution is permitted in any medium, provided this notice is preserved.
Updated: 16 Aug 1998 jhall