PySolFC icon indicating copy to clipboard operation
PySolFC copied to clipboard

[Feature Request] Add mahjong (not solitaire), domino, Chinese domino, etc.

Open GrimPixel opened this issue 3 years ago • 5 comments

There are still more games available. Here are what I have gathered (together with board games): https://polyglotclub.com/wiki/Language/Multiple-languages/Culture/Tabletop-Games

GrimPixel avatar Nov 11 '22 00:11 GrimPixel

Most of the games you describe are multi-person games. As PySolFC is a solitaire collection, the engine isn't really suited for building multi-player games. A lot of the options are very solitaire-specific, and to add multi-person games at all, we'd either need to add some sort of AI, an ability to play with others online, or ideally both. Either one of those would be an enormous undertaking, so I don't personally anticipate being able to add multi-person games anytime soon (personally, I think multi-player games would be better in a fork).

But if you know some single player games that would be a good fit, let me know, and I can add them to my list.

joeraz avatar Nov 12 '22 02:11 joeraz

Well, some of those games are simple enough to do in pysol, without major changes:

  • Nim (players take turns, and take 1,2, or 3 cards/matches from a heap - winner takes/avoids last one) Technically 2-player, but AI is really simple, and could be done like 'deal new cards'.
  • Boggle, Scrabble, Crossword-Puzzles (arrange letters to form words) Needs a new matrix-like cardset with letters, and wordlists for different languages. Play for highest score, or maybe hotseat.
  • With a wordlist, hangman could be done too.
  • Games with dice-rolling (Pachisi etc.) might be possible with a fairly simple AI. (ie. just evaluate a score for each possible move, and take the best of those. Score might be as simple as sum of distance to goal.) Maybe instead of rolling dice: each player gets a set of dice 1-6, can use any one of them for his turn, and gets a new set when all his dice have been used up. Such games could use king, queen etc. from existing cardsets as playing pieces, but it might be nicer to have a new cardset with playing pieces in different colors (and also dice showing numbers 1-6).
  • Those dice-faces could also be used to make domino-pieces.

hajo4 avatar Jan 25 '23 13:01 hajo4

I'm afraid I have to disagree on that. The issue is not so much writing the AI as it is adjusting the engine to support the AI, and the fact that PySolFC's assist features are heavily geared towards solitaire games - the game needs a clear "win" and "perfect" condition for the statistics, and must rely largely on just a few types of moves.

  • I thought about trying to add word games at one point - they seem to be the best fit for the PySol engine of everything listed here, as letters can be a new type of cardset. But we would still need to compile the wordlists based on either an open reference source, or completely by hand. Then, we'd need to consider the needs of different languages, including the fact that other languages have different alphabets. Certainly doable, but not a trivial task.
  • Dice can easily be a type of "cardset" too, and a draw can easily simulate a dice roll - it was something I toyed around with at some point. But the arrangement and design of the "stacks" to pull something like pachisi off would be quite complex. Not to mention games can only support a single "deck" of one cardset type. Adding the pieces and the dice cardsets together is not supported. And if they are all one cardset, each card needs to be the same size and shape for the cardset to be valid.
  • A key element of dominoes is being able to rotate them - each domino has two different numbers and their rotation matters - rotating cards is not currently supported in the engine. I'd like to implement this so I can add games like Crazy Quilt. However, due to Pillow's status as an optional library, I'd need a way to implement this without Pillow before I can add games dependent on card rotation (I'm probably going to have to make Pillow required at some point, but that's going to cause some compatibility concerns).

I've been working with PySol long enough to be familiar with a lot of the engine's limitations - what I described above are just the issues I can think of off the top of my head. But I still think adding any of these games would be quite the project.

joeraz avatar Jan 26 '23 02:01 joeraz

Thanks for the explainations !

So it looks like my idea for a game about pancake-sorting has better chances... It could be based on the matrix-games (or maybe lights-out):

The player is given a row of numbers to sort. Each move consists of selecting one of those numbers, and the order of all numbers to its right (or left) is reversed.

Btw. hints and demo don't work in matrix-games.

hajo4 avatar Jan 26 '23 09:01 hajo4

Yes, something like that would probably be manageable.

I wouldn't be opposed to adding the word games or some sort of domino solitaire, but unless I get lots of extra help, I don't see those getting added anytime soon. I personally think games that use AI or a second player are better suited for a fork.

So I don't come off as too much of a pessimist here, there are some non-solitaire games that I identified that would be a good fit for PySol's engine, such as:

  • Ishido - Ishido needs its own unique cardset type (36 tiles, with 6 colors and 6 symbols), but otherwise, it wouldn't require any significant changes to the engine, just some unique game logic. I'm currently planning to try adding this for version 3.0 - I'm only waiting because I want to limit the number of mandatory updates to the cardsets package.
  • Samegame - If I take the gravity and layout algorithms from Shisen-Sho, use a more limited Ishido-type cardset, I'm pretty close to an implementation of Samegame. Would just need to write an algorithm that can identify the entire cluster of tiles of the same color.
  • Master Mind - Once again, this can be done with the Ishido-type cardset, just using a few tiles of each color to set up the code. I'd probably need to use either tons of decks or repeat the same colors multiple times to get enough tiles though.
  • Sudoku - Using either a nine decks of trumps only cards or just repeating the first nine numbers nine times, I'd have what I need to set up a Sudoku puzzle. The only real challenge here is that I'd need a way to generate the puzzle to be sure that it's solvable.

And a few others.

joeraz avatar Jan 26 '23 23:01 joeraz