Challenge 2
Due: Monday, February 3 at 4:15 p.m. (in class)
You may work on this challenge as a team.
Before you start…
- If you want stay with the same team (or solo) arrangement as Challenge 1, you use your existing repository and create a
Challenge02directory in it. - If you want to work with a new group (or switch to solo work) Accept the Challenge on GitHub Classroom.
- There is no starter code in the repository, so don't worry if you don't see anything much there. It's up to you to add material to the repository (in the
Challenge02directory) and then push your changes to GitHub.
Check Out the Breakout Game from Class
In class, Prof. Melissa showed a breakout game. Here's the tape file for the game:
You can load this game into the ZX Spectrum emulator and play it. It's a good example of a simple game that can be written in BASIC. The full code, in a more human-readable version, is available on the wiki.
Your task…
Your task is to do the following:
-
Write a game in BASIC for the ZX Spectrum that showcases what can be achieved in BASIC on the machine. The game should include graphics of some kind and interactive control of some kind. Possible ideas include:
- A minesweeper game.
- A Sokoban-style game.
- A simple platformer.
- A 15-puzzle game.
Tips:
- The functions
POINT,SCREEN$andATTRcan be used to read the screen memory, which can be useful for collision detection or avoiding storing (some of the) game state in data structures. - The
INKEY$function can be used to read the keyboard and see which key is being pressed. - The ZX Spectrum supports user-defined graphics, which correspond to graphics characters A through U. On the Spectrum you can type them in your code by going into graphics mode (Capsshift-9), or when using
spectrum-basicyou may either use\followed by the character, or use the these unicode characters (ⒶⒷⒸⒹⒺⒻⒼⒽⒾⒿⓀⓁⓂⓃⓄⓅⓆⓇⓈⓉⓊ) to represent the user-defined graphics characters in your source code. Various designers for making user-defined graphics are available online, such as this one. - The command-line utility
speccy-basic(available bypip install spectrum-basic) can be used to write ZX Spectrum BASIC programs on your own computer and then convert them TAP files that can be loaded into an emulator.
Interesting reading:
Take a look at the archive of Your Spectrum magazine:
- Pick an issue and look at the ads and articles. Just looking at the ads can be a fun way to see what was available at the time.
(When logged in, completion status appears here.)