In a private discussion I had with Stephan Kulow, we discussed a method to
prototype variants of card solitaire, so they can be loaded to a program
and configured by the user, without having to touch the code of the
solitaire suite itself.
PySol, for example, uses a menu in which each menu item accesses a
function which sets the current games. PySol use object inheritance
extensively, but it requires python hacking to modify the list of games.
Then there is a Solitaire suite for Windows called Pretty Good Solitaire
(
http://www.goodsol.com/) which has roughly 350 variants and also has a
GUI wizard that allows the user to add his own Solitaire variants. I
thought a similar functionality would be very nice in the UNIX-based
Solitaire games.
What I've been thinking about is a variant definition file which will
enable us to set and inherit solitaire variants. The final product will
probably (but I'm not entirely sure about it) XML, but I'm giving it here
in C++-like syntax for clarity. In any case this is more of a DTD, so it
can be represented in several forms.
In any case, We can define Freecell like that:
variant freecell inherits none =
{
name = "Freecell",
type = "freecell-klondike-gypsy",
talon = "none",
stacks = "8",
freecells = "4",
decks = "2",
sequences_are_built_by = "alternate_color",
sequence_move = "limited",
empty_stacks_filled_by = "all",
init_state =
{
stacks="7,7,7,7,6,6,6,6"
}
}
Then, in order to define Baker's game we need to do:
variant bakers_game inherits freecell =
{
name = "Baker's Game",
sequences_are_built_by = "suit",
}
Etc. We could have multiple inheritance by defining interfaces, which only
set specific items based on their discretion. By editting this file (or
providing the user with a facility that will edit it for him) we can have
a rather flexible variant management.
Let me know what you think.
Regards,
Shlomi Fish
----------------------------------------------------------------------
Shlomi Fish shlomif_at_vipe.technion.ac.il
Home Page:
http://t2.technion.ac.il/~shlomif/
Home E-mail: shlomif_at_techie.com
A more experienced programmer does not make less bugs. He just realizes
what went wrong more quickly.
Received on Thu Apr 05 2001 - 02:41:12 IST