As well as source code the Charm language, source code for several small, and two major Charm demonstration programs is included :-
- !Checkers Chinese checkers
- !Decapedes Shoot 'em up demo
- field Solutions for Laplace's equation
- graph Variety of graph plots
- hanoi Towers of hanoi
- life Game of life demo
- mandel Mandelbrot set image generator
- sieve Simple prime number sieve program
- !TboxDemo Toolbox demo
- tree Draw a random tree recursively
Demos can be run from the Charm demos.~bin folder either by double clicking on the application directory or file, or from the command line e.g.
Note that sieve demo is linked with the -relocatable flag and as such loads into the RMA. It can be (re)started by pressing F12 to get to the command line and issuing the *start command.
Charm can be used to develop applications or modules, and the windows libraries provided allow fully RISC-OS desktop applications to be written (see the Chinese Checkers example). A little further information on the demos is supplied below to help get you started.
This application is an implementation of the classic Chinese checkers game with the player as green and the computer as orange.
The player always goes first, and moves by clicking on one of their pieces to select it and then clicking on a valid destination vertex. This will be an empty adjacent vertex, or one that can be reached by jumping over pieces in a similar manner to draughts (the colour of the piece does not matter, and there are potentially six possible jump directions due to the hexagonal nature of the board).
The winner is the opponent to place all of their ten pieces in the opposing triangle.
This fun demo illustrates sequencing of music (with the catchy popcorn theme) and use of graphics double buffering to give flicker free movement.
There are three red computer controlled decapedes and one player controlled one. These shoot segments off each others backsides until the head is reached and the decapede dies with a whimper. The object is for the player to destroy all the red decapedes without dying themselves.
You can use the following keys:
- cursor keys to move up, down, left, right
- 'p' to pause / resume
- 's' to toggle sound
- 'esc' to exit
and the left and right mouse buttons also work.
This demo solves Laplace's equation using iteration with boundary conditions suitable for establishing a quadrupole field (four alternating charges at the corners of a square). 4Mb of heap are required to run this demo, so ensure that this is available by setting the Application tasks Next value to at least 4000K in the tasks window; otherwise execution will cause a Get heap block error.
A number of scientifically calculated graphs are plotted in different colours:
The towers of hanoi problem is solved using a recursive algorithm:
John Conway's classic game of life is illustrated with a couple of sample runs:
Toolbox based Mandelbrot set image explorer featuring intense complex real number calculations:
Drag configuration data files from the <Charm$DemosDir>.mandel.config directory on to the Mandelbrot set window to generate preset images. Alternatively use click and drag to zoom in on parts of the set you are interested in exploring. Select the options pane from the menu to control image size, colour and resolution. Save image configuration data files using the menu to share with others or reload later :
A classic implementation of the sieve of Eratosthenes:
A demo of how to program up some toolbox widgets using Charm:
Visit RISC OS OPEN Desktop Applications to obtain a licensed copy of the toolbox resource file editor ResEd.