hn-classics/_stories/1985/10331849.md

86 lines
5.5 KiB
Markdown

[Source](http://tpoindex.github.io/crobots/ "Permalink to Crobots by tpoindex")
# Crobots by tpoindex
# Crobots
## CROBOTS is a programming game, for programmers (or aspiring programmers.)
[Download .zip][1] [Download .tar.gz][2] [View on GitHub][3]
* * *
This is the source code of the original CROBOTS game that I wrote in 1985, now released under GPLv2.
I probably will **not** be updating CROBOTS, so feel free to [fork the code][3].
## Original Readme
CROBOTS ("see-robots") is a game based on computer programming. Unlike arcade type games which require human inputs controlling some object, all strategy in CROBOTS must be complete before the actual game begins. Game strategy is condensed into a C language program that you design and write. Your program controls a robot whose mission is to seek out, track, and destroy other robots, each running different programs. Each robot is equally equipped, and up to four robots may compete at once. CROBOTS is best played among several people, each refining their own robot program, then matching program against program.
CROBOTS consists of a C compiler, a virtual computer, and battlefield display (text graphics only, monochrome or color). The CROBOTS compiler accepts a limited (but useful) subset of the C language. The C robot programs are aided by hardware functions to scan for opponents, start and stop drive mechanisms, fire cannons, etc. After the programs are compiled and loaded into separate robots, the battle is observed. Robots moving, missiles flying and exploding, and certain status information are displayed on the screen, in real-time.
CROBOTS is distributed under terms of the GNU General Public License, version 2.
## Running in your browser with PCjs
Thanks to Jeff Parsons and his fantastic [PCjs simulator][4], you can run CROBOTS in your browser. This requires a fairly modern machine to achieve the speed of the IBM PC at 4.77 MHz. The virtual diskette boots [FreeDOS][5] and runs CROBOTS with the four demo robots.
* Start [CROBOTS PCjs][6]
* **Ignore** the banner that says CROBOTS is [Shareware][7], I don't want your money and I don't live in Illinois any longer.
## Running under DOSBox
You can run the original MS-DOS executable using [DOSBox][8]. DOSBox is ported to Linux, FreeBSD, Windows, Mac OSX, and a few other O/Ses. DOSBox can be tweaked to run executables as experienced on a 1980's era [4.77 MHz Intel 8088][9].
* Download and install [Dosbox][10].
For Linux users, you can probably use your package manager to install, _sudo apt-get install dosbox_, etc.
* **cd bin**
* Tweak the crobots_dosbox.conf as needed, especially the _cycles_ value. The default cycles value is 245, which should be close for modern CPUs.
* Run **crobots_dosbox.sh** or **crobots_dosbox.bat**
* **Ignore** the banner that says CROBOTS is [Shareware][7], I don't want your money and I don't live in Illinois any longer.
This should start up CROBOTS with the four demo robots programs. Programs are listed to the screen as they compile. Once all four are compiled, the match begins.
## Documentation
The original manual for CROBOTS is in [docs/crobots_manual.html][11].
## History
CROBOTS was my first adventure into the world of compilers and virtual machines, and not all that long after I learned C.
In early 1985, I found Jeff Lee's posting of a Yacc grammar for ANSI C, on the USENET group [net.sources][12]. Taking Jeff's advice in his post _"(Y)ou can sit and crank your own output through it to amuse yourself if you have the personality of a cumquat(sp?)"_, I played with Yacc/Lex and the C grammar to the point of moderately understanding how it all worked.
I had previously played the Apple ][ game, [RobotWar][13] that a friend owned in the early 1980's. RobotWar, and to some degree [CoreWar][14], was the inspiration for writing CROBOTS. _IMHO_, these are the ultimate games for programmers.
The CROBOTS virtual machine evolved while writing the compiler, making up instructions and constructs as I progressed. I ended up with a stacked-based CPU that had 10 instructions. Both compiler and virtual machine are fairly crude, but obviously usable.
CROBOTS was developed on a couple of Unix machines I had access to, [Venix/86][15] and [Xenix/286][16], mostly for the _yacc_ and _lex_ programs found on those systems.. A good deal of the development was done with the [DeSmet C compiler][17]. Final compilation was done with [Lattice C][18], as I recall the performance was slightly better.
Crobots is maintained by [tpoindex][19]
This page was generated by [GitHub Pages][20]. Tactile theme by [Jason Long][21].
[1]: https://github.com/tpoindex/crobots/zipball/master
[2]: https://github.com/tpoindex/crobots/tarball/master
[3]: https://github.com/tpoindex/crobots
[4]: http://jsmachines.net
[5]: http://www.freedos.org
[6]: http://tpoindex.github.io/pcjs/crobots-pcjs.html
[7]: https://en.wikipedia.org/wiki/Shareware
[8]: http://www.dosbox.com/
[9]: http://www.dosbox.com/wiki/4.77_MHz
[10]: http://www.dosbox.com/download.php?main=1
[11]: http://tpoindex.github.io/docs/crobots_manual.html
[12]: https://groups.google.com/forum/#!search/net.sources%2420yacc%2420ansi%2420c/net.sources/3gmx4As0aSM/F--W3xnQlEsJ
[13]: https://en.wikipedia.org/wiki/RobotWar
[14]: https://en.wikipedia.org/wiki/Core_War
[15]: https://en.wikipedia.org/wiki/Venix
[16]: https://en.wikipedia.org/wiki/Xenix
[17]: http://desmet-c.com/
[18]: https://en.wikipedia.org/wiki/Lattice_C
[19]: https://github.com/tpoindex
[20]: http://pages.github.com
[21]: https://twitter.com/jasonlong