games/minesweeper - Basic implementation of classic Minesweeper game using different user interfaces.
The main purpose of this addon is to compare and contrast different the GUI building technologies available for J.
The following UI implementations are available:
Script UI toolset uiconsole.ijs Text-based uiwd.ijs J6's Window Driver (wd) GUI uigtk.ijs J7 gui/gtk (defines the form programatically) uigtkglade.ijs J7 gui/gtk (defines the form as an XML file created using the interactive Glade form designer)
The console interface should work from all front ends including the JHS. The Gtk interfaces should work from either the Jconsole or the Gtk IDE.
Browse the addon source using Trac.
Use Package Manager to install the games/minesweeper addon.
Below are some examples of running various UI versions. Obviously you can only run some scripts in a compatible environment, so the uiwd.ijs script can currently only be run using J6, and the gui/gtk based scripts will only run in J7.
load 'games/minesweeper/uiwd' MinesweeperWd '' load 'games/minesweeper/uigtk' MinesweeperGtk '' load 'games/minesweeper/uigtk' MinesweeperGtk 20 20 load 'games/minesweeper/uigtkglade' MinesweeperGtkGlade '' load 'games/minesweeper/uiconsole' fld=: MinesweeperCon ''
The engine for this game began as a solution to a RosettaCode programming task. It then seemed to be a nice simple application that might serve as a type of Rosetta stone itself, showing how to translate a GUI from the J6 window driver (wd) toolset to the new J7 Gtk toolset.
As J tools and APIs for working with Gtk evolve, the Gtk scripts should hopefully get shorter and less complex.
Ideas for extending the game:
- Create a child dialog for the Game|Options menu item, that among other things could enable the user to changing the size/difficulty of the minefield
- Make the minefield image resize to fit the current size of the window
- Display a timer that counts the length of time required to solve the field
- Record "high" scores for various sized minefields
- When the player loses, display the mine that was cleared differently to other mines in the revealed map
- Add sound
- It may be possible to create an interactive, GUI version of the game for the JHS front end.