This is a Shisen Sho game.
In every move you have to select two identical symbols.
It must be possible to connect the two symbols with a line.
This line must lead over free space and can have 0, 1 or two turns.
If you do a legal move the two symbols are removed.
The goal is to clean up all symbols.
Shisen generates only solvable games.
Depending on you strategy you still may end in a situation with no possible moves.
If you type H the program suggests a move.
Typing N generates a new game and typing Q quits the game.
Removing the szepter