GolfScript
GolfScript is a language created with a specific purpose, but that purpose is more entertainment than actual utility: writing programs using as few characters as possible. It is used in "Code Golf" competitions where you try to solve a programming challenge using a program that's as small as possible.
Despite the seeming uselessness, there are actually some interesting aspects. Like many virtual machine languages, it's stack-based, which often means you don't need to use variables or function names explicitly. The language also is pretty simple without too many built-in functions, so it shouldn't be too hard to learn the rules (though it might be hard to use them effectively).
Useful Links
- GolfScript tutorial to get started
- Stack Overflow site for code golfing
- Wikipedia page
- 99 bottles of beer program.
Tools
The GolfScript reference interpreter is just a Ruby program, available by clicking "download" on the GolfScript homepage.
Everything you need is already installed on CS department lab machines
in the /courses/roche/413/bin
folder, which should be in your
PATH.
To install on your virtual machine, follow these steps:
-
Install ruby:
sudo apt install ruby
-
Download the golfscript interpreter into your
bin
folder and make it executable:mkdir -p ~/bin curl 'http://www.golfscript.com/golfscript/golfscript.rb' -o ~/bin/golfscript.rb chmod +x ~/bin/golfscript.rb
How I will run your code
The programs you submit should be in a single file
called proj.gs
, for either part of the project.
I will test your code by running the following commands
using the software available in the lab environment or using the instructions
above:
golfscript.rb proj.gs
Phase 1 Requirements
For this language, you need to implement modifications A,B,C,D,E,F,G,H, and I. See the Phase 1 page for details on what this means.
Phase 2
See the Phase 2 Page for the list of suggested
problems. Of the ones listed, I recommend the following as being most
well-suited for LANGUAGE:
- Compiler
- Make
- Matrix Calculator
- Image Creator
- Game Scheduler
- Hangman
- TODO list
- Vending Machine
- Game with hidden agenda
- Frequency count
- Guess the language
- Find the missing digits
- Sports Ticker
- Rock, Paper, Scissors
- ??? (you choose!)