this post was submitted on 26 Sep 2023
34 points (97.2% liked)

commandline

1785 readers
1 users here now

founded 2 years ago
MODERATORS
34
submitted 1 year ago* (last edited 1 year ago) by christos to c/commandline
 

tui-sudoku is a configurable terminal interface sudoku game, with quite a few features.

https://gitlab.com/christosangel/tui-sudoku

Starting the game, and through the main menu, the player can :

  • Start a new game
  • Load previously saved game
  • Configure some parameters (colors, preferred editor, puzzle symmetry,preffered png)
  • exit the program

PLAYING THE GAME

After choosing the n New Game option, the player can select the level of difficulty.

The user will be presented with the known 9x9 sudoku matrix.

Using the shortcuts in the shown cheatsheet table, the player can

Shorcuts Action
hjkl ๐Ÿ „ ๐Ÿ …๐Ÿ ‡๐Ÿ † Move Cursor
[1-9] Insert Number
0,โฃ,โˆ Clear Cell
E Earmark cells
H Toggle Highlight Numbers
S Save Game
z,Z Undo / Redo
M Return to Main Menu
Q Show Solution & Quit
  • Typing H while the cursor is on a number, e.g. 2, will highlight all the 2s in the matrix.

    Typing H again will undo the highlighting:

-Typing E and entering up to 3 digits, will earmark the cell:

  • Entering an illegal number (a number that already exists in the row, the line or the 3x3 block) will mark the number with a different color, and give a warning message:

While the Moption returns to the Main Menu, and the S option saves the game, the Q option prints the solution and exits:

  • The user can also Undo or Redo their entries with the z or Z option respectively.

Back in the Main Menu, the player can also

  • Load a previously saved game with the l option

  • Configure preferred colors, preferred text editor and puzzle symmetry with the c option

  • or Browse the Top Ten Scores (s option)

The configuration is kept in the $HOME/.config/tui-sudoku/tui-sudoku.config file.

If there is no file kept there, default values will be loaded.

  • You can select the colors you like and the respective codes as they demonstrated here:

    https://talyian.github.io/ansicolors/

    Default colors

    Color Code Script Variable
    Grid Color \x1b[38;5;60m" C1
    Given Numbers Color \e[1;33m" C2
    Found Numbers Color \e[1;36m" C3
    Wrong Numbers Color \e[1;31m" C4
    Highlight Color \e[1;32m" C5
    TextColor1 \e[35m" C6
    TextColor1 \e[36m" C7
  • SYMMETRY variable configures the symmetry of the given cells in the 9x9 matrix. Valid options are: none, rotate90, rotate180, mirror, flip, or random

  • PREFFERED_PNG variable defines the png that shows in the notifications. These images are located in the $HOME/.cache/tui-sudoku/png/ directory.

Any feedback is appreciated!

Any feedback is appreciated!


Added feature in 0.2.0: earmarked cells change color when illegal (the number already exists in row, column or 3x3 square)


Added feature in 0.3.0: Toggle info (key cheatsheet).

you are viewing a single comment's thread
view the rest of the comments
[โ€“] [email protected] 1 points 1 year ago* (last edited 1 year ago) (4 children)

This is neat. I am going to put it on some production servers, because why not...

Edit: Poop. Renders a bit funny over a putty session.

[โ€“] christos 3 points 1 year ago (1 children)

I see no numbers in the 9x9 matrix, have you installed the qqwing dependency?

https://qqwing.com/download.html

On Debian based distros:

sudo apt install qqwing fzf lolcat

[โ€“] [email protected] 1 points 1 year ago (1 children)

Ah, yes. I should read instructions...

This server is CentOS so I will see where I can get those packages

[โ€“] christos 1 points 1 year ago (1 children)

You should ๐Ÿ˜€

The page I sent you (you should read that too, btw๐Ÿ˜€) has you covered I think, describes download instructions for many distros.

fzf and lolcat are quite easy to install I think.

[โ€“] [email protected] 2 points 1 year ago

Yeah, I ran into a further dependency issue with qqwing regarding gcc so I will take a dive when I have a bit of spare time. Thanks though.

load more comments (2 replies)