GithubHelp home page GithubHelp logo

phyver / gameshell Goto Github PK

View Code? Open in Web Editor NEW
2.1K 23.0 132.0 5.27 MB

a game to learn (or teach) how to use standard commands in a Unix shell

License: GNU General Public License v3.0

Shell 63.96% Awk 15.66% Dockerfile 0.33% Makefile 15.81% C 4.24%

gameshell's Introduction

GameShell: a "game" to teach the Unix shell

Illustration inspired by the game

Teaching first-year university students or high schoolers to use a Unix shell is not always the easiest or most entertaining of tasks. GameShell was devised as a tool to help students at the Université Savoie Mont Blanc to engage with a real shell, in a way that encourages learning while also having fun.

The original idea, due to Rodolphe Lepigre, was to run a standard bash session with an appropriate configuration file that defined "missions" which would be "checked" in order to progress through the game.

Here is the result...

GameShell's first mission

GameShell is available in English, French and Italian.

Feel free to send us your remarks, questions or suggestions by opening issues or submitting pull requests. We are particularly interested in any new missions you might create!

Getting started

GameShell should work on any standard Linux system, and also on macOS and BSD (but we have run fewer tests on the latter systems). On Debian or Ubuntu, the only dependencies (besides bash) are the gettext-base and awk packages (the latter is generally installed by default). Some missions have additional dependencies: these missions will be skipped if the dependencies are not met. On Debian or Ubuntu, run the following command to install all game and mission dependencies.

$ sudo apt install gettext man-db procps psmisc nano tree bsdmainutils x11-apps wget

Check the user manual to see how to install the game dependencies on other systems (macOS, BSD, ...).

Assuming all the dependencies are installed, you can try the latest version of the game by running the following two commands in a terminal.

$ wget https://github.com/phyver/GameShell/releases/download/latest/gameshell.sh
$ bash gameshell.sh

The first command will download the latest version of the game in the form of a self-extracting archive, and the second command will initialise and run the game from the downloaded archive. Instructions on how to play are provided in the game directly.

Note that when you quit the game (with control-d or the command gsh exit) your progression will be saved in a new archive (called gameshell-save.sh). Run this archive to resume the game where you left it.

If you prefer not running foreign shell scripts on your computer, you can generate a Docker image with the following:

$ mkdir GameShell; cd GameShell
$ wget --quiet https://github.com/phyver/GameShell/releases/download/latest/Dockerfile
$ docker build -t gsh .
$ docker run -it gsh

The game will NOT be saved when you exit, and additional flags are required if you want to run X programs from inside GameShell. Refer to this section of the user manual.

Documentation

To find out more about GameShell, refer to the following documents:

  • The user manual provides information on how to run the game on all supported platforms (Linux, macOS, BSD), explains how to run the game from the sources, tells you how to generate custom game archives (which is useful if you want to use GameShell for teaching a class), and more.
  • The developer manual provides information on how to create new missions, how to translate missions, and how to participate in the development of the game.

Who is developing GameShell?

Developers

The game is currently being developed by:

Mission contributors

  • Pierre Hyvernat
  • Rodolphe Lepigre
  • Christophe Raffalli
  • Xavier Provencal
  • Clovis Eberhart
  • Sébastien Tavenas
  • Tiemen Duvillard

Translation

Italian Version

  • Daniele Scasciafratte (@mte90)
  • Paolo Mauri (@maupao)
  • Marco Ciampa (@ciampix)
  • Antonio Vivace (@avivace)
  • Lorenzo Millucci (@lmillucci)
  • Sirio Negri (@ziriuz84)
  • Domenico Mammola (@domenicomammola)
  • Leonardo Canello (@anulo2)
  • @michirod
  • @serhack
  • WhiteShield (@wshield05)
  • @gioisco

Special thanks

  • All the students who found many bugs in the early versions.
  • Joan Stark (a.k.a, jgs), who designed hundreds of ASCII-art pieces in the late 90s. Most of the ASCII-art encountered in GameShell are due to her.

Licence

GameShell is released under the GPLv3.

Please link to this repository if you use GameShell.

GameShell is open source and free to use. One way you can acknowledge the work it required is by sending an actual postcard to

  Pierre Hyvernat
  Laboratoire de Mathématiques, CNRS UMR 5127
  Université de Savoie
  73376 Le Bourget du Lac
  FRANCE

gameshell's People

Contributors

alxrey avatar anulo2 avatar bdchilton avatar cocoec avatar daarkmoon avatar docswitch avatar domenicomammola avatar eriizu avatar grock avatar laplongejunior avatar maupao avatar mpoquet avatar mte90 avatar oliviermattelaer avatar oumph avatar oupala avatar pada0 avatar pamputt avatar photon9 avatar phyver avatar rlepigre avatar scattenlaeufer avatar tithugues avatar wdfry avatar ziriuz84 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gameshell's Issues

(macOS) Ne retient pas la progression du jeu.

Après avoir fait exit et j'ai tenté de retourner dans le jeu pour continuer où j'avais laissé mais ça recommence à la « mission 01 ».

$ ./start.sh 
Attention, vous êtes en train d'exécuter
GameShell dans la version de développement.
Faut-il le continuer ? [o/N] o
'/Users/ifredos/Documents/GitHub/GameShell/.session_data' existe déjà... Faut-il le conserver ? [O/n] O

~
[mission 01] $ 

`gsh config` command

Just an idea: a command to configure a couple of things:

  • no_color or a way to change colors for success / failure
  • pager
  • quiet option
  • verbose option (in debug mode only)
  • no_parchment option
  • encoding (if we indeed use it, see #24)
  • no_progress_bar or similar option

Use $HOME/.bashrc instead of the ad hoc file `$GSH_ROOT/.bashrc/bashrc`

Global configuration is stored in $GSH_ROOT/.bashrc/bashrc.
Having a real $HOME/.bashrc file (and $HOME/.bash_profile, or similar) would be cleaner, and we can then have a mission about configuring bash normally rather than in the chest.

It would also guarantee that running a new shell will keep the configuration.

The drawback is of course that $HOME is in the "world", and the player may see a strange file while exploring.

@rlepigre , what do you think?

Have the width of goal files adapt to the terminal size

Currently, goal files have a with of 69 characters.
On wide terminals, this might be too narrow.

We could try having the width adapt to the terminal size.

  • One way to do it would be to reflow the text. That should be quite easy since I insist on having a trailing space inside paragraphs. The only problem I see is for "indented paragraphs", like in
man COMMAND
  Display the manual of the command.

  Important key bindings:
    q           quit
    Space       scroll down one page
    / STRING    search for the string
    n           find the next occurrence for the search string

If we keep the indentation, the only problem would be reflowing find the next occurence ....
We could even minimize raggedeness using dynamic programming, like in par. I implemented it in Python some time ago, but since we don't need most of par's option, that should be easy to do in awk.

  • One other way would be to use man to display goal files, but that would require converting goal files to troff, and juggle with the COLUMNS variables to have enough room to add the box.
    On the positive side, it would open the door to have some formatting for goal files, if we find a way for awk's length function to ignore with escape characters.

Should there be a manpage for `gsh`?

It could be installed somewhere and MANPATH be updated.
(POSIX specifically mentions this variable is not standardized but that many system use it...)

Problème d'exécution dans Terminal sous macOS

Est-ce possible de faire fonctionner ce jeu sous macOS? Voici ce que ça me fait quand je tente d'exécuter "./start.sh"

> ============================ Initialisation de GameShell ============================
> ./start.sh: line 110: /.session_data/passeport.txt: No such file or directory
> ./start.sh: line 234: sha1sum: command not found
> ./start.sh: line 235: /.session_data/passeport.txt: No such file or directory
> ./start.sh: line 236: /.session_data/uid: No such file or directory
> ./start.sh: line 243: cd: /World: No such file or directory
> cat: /.session_data/uid: No such file or directory

clean up `box.awk` / `box.sh` / `box-data.awk

Most of the box designs can be removed from box-data.awk, and it might be interesting to replace box-data.awk by a human readable file box-data.txt containing boxes given as (???)

@@@Parchment1
U:      _____@@@_@@@_
U:    / \    @@@ @@@ \.
U:   |   |   @@@ @@@ |.
U:    \_ |   @@@ @@@ |.
M:       |   @@@ @@@ |.
L:       |   @@@_@@@_|___
L:       |  /@@@ @@@    /.
L:       \_/_@@@_@@@___/.
margin=1 1 0 1
neg_margin=3 1 0 3
@@@Parchment2
...

That means we parse the file each time, but that's probably not a problem...

modify `progress_bar` script

The progress_bar script displays a small ASCII animation during long initializations.

It currently reads characters (one at a time) from stdin and displays a "frame" for each of them. A small delay is added to make sure the animation doesn't go too fast.

There are 2 problems:

  • the delay may considerably slow down the initialization,
  • we mostly loose the return value of the initialization, as well as error messages.
  • Also, this is can probably be converted to POSIX /bin/sh instead of bash.

A possible fix would be to replace the "filter" init | progress_bar [OPTIONS] by a command progress_bar [OPTIONS] init.

  • we can display an animation until the end of init, without slowing it down at each step
  • we can redirect error messages to a file and display them at the end
  • we can return the return value of init.

The check for locales seems suboptimal

Running make tests-fr on my system fails here:

if locale -a | grep -x "$OPTARG" >/dev/null

I think we should rather test that there is a locale starting with whatever the option argument is. In my case, locale -a gives:

C
en_US.utf8
fr_FR.utf8
POSIX

so I do not have just fr, which is used as a value by make tests-fr.

Comment choisir la langue ?

Peut-être plus une incompréhension de ma part qu'une issue. J'utilise GameShell avec mes lycéens, le jeu se lance automatiquement en français sur les ordinateurs (Ubuntu 20.04) de ma salle. En revanche, j'ai testé avec Cygwin et malgré un export LC_ALL=fr_FR.UTF-8 le jeu se lance en anglais. Comment faire ?

compte à rebours sur Mission 35

En commençant la mission 35, le compte à rebours du nombre de commandes de la mission 34 continuait. Je n'arrivais pas à valider la mission. En quittant le jeu et en revenant, il n'y avait plus de compte à rebours. La même requête a permis de passer le niveau.

(macOS) Impossible de sauvegarder la progression

Voici ce que ça écrit après avoir fait la commande gash save :

[mission 12] $ gash save
Usage:
  List:    tar -tf <archive-filename>
  Extract: tar -xf <archive-filename>
  Create:  tar -cf <archive-filename> [filenames...]
  Help:    tar --help
******************************************************
******************************************************

Une archive contenant l'état courant à été créée dans
votre répertoire personnel. Le fichier se trouve ici :

/Users/ifredos/GameShell_ifredos-SAVE.tgz

Vous pouvez transférer ce fichier sur un autre
ordinateur, à la racine de votre répertoire personnel,
et rétablir votre sauvegarde avec la commande

$ tar xvf GameShell_ifredos-SAVE.tgz

******************************************************
******************************************************

Note : Évidemment, pour le moment, je vais m'arrêter d'y jouer pour vous laisser le temps de regarder les problèmes que j'ai déjà rapporter avant de continuer.

Error on the verification of the use of the head command

I just discovered GameShell (and I think it's really great!) but I'm stuck at mission 22 because I don't use the head command even though I use it.

Details :

  • Mission : 22
  • Objective : Display the recipe of the herbal tea
  • Error : Unable to validate the mission despite using the command
  • OS : Fedora
  • Screenshot :
    gameshell

Thanks for your work on this really cool project :)

error codes for `gsh` commands

It would be nice if gsh commands returned a value: 0 for OK, or some error code.

The problem is that gsh check will also do a clean and an init.

One possibility would be to have different function used different bits in the return value:

  • lsb for check
  • bit 1 for init
  • bit 2 for test
  • bit 3 for static
  • bit 4 for goal
  • bit 5 for treasure
  • bit 6 for treasure-msg

We'll have one last bit to use for something else!

Boxes around goals in narrow terminals is "broken"

  .-------------------------------------------------------------------------------------.
 /  .-.
 .-.  \
|  /   \
/   \  |
| |\_.  |   Mission goal
|    /| |
|\|  | /|   ============

I might be splitting hair, but it would somehow be nice if the display were right even with a width of 80 characters.
One solution would be to have goal files at 78 characters wide, and don't draw a box unless the width of the terminal is more than some value to be decided.

Un seule pièce d'or générée dans la mission 20

Une seule pièce d'or est générée dans la mission 20
⌁ [paul:~/GameShell/World] master(+1/-2)* 2m46s ± find . | grep or ./Chateau/Cave/.Long 479b2e2d850d39004736f4bab8ef5e46fe2c2939 Couloir 23996d45c6454f970f0aa3e13661309a806ddcd2/labyrinthe/c3a74cd00b012f0c533ecbedd4d398090e104214/fa9595baa5566befb5df584c2469f1a043aadcfc/a53f8154a05b40b5279eeb76e0a991f8ab4f673b/piece_d_or ./Chateau/Entree/b3324084269b866d11ac523f4496a4ed10bf7551_ornement ./Chateau/Entree/3ca08c59b85ddf86c208f5c7f710ef998d79eca9_ornement ./Chateau/Entree/8674f7c63466d2d1ad6a57c9a4721bf6c11f07cf_ornement ./Chateau/Entree/73f4417a15ef2df55edaf818d7925e90e5329999_ornement ./Chateau/Entree/261d28f9e14d18ddbf7757ffa7fafec5db85bd60_ornement ./Chateau/Entree/5d16725337efe6610230da3dda25e1ffedb24409_ornement ./Chateau/Entree/278396974ca068fca1a63ed2618a46428893cd03_ornement ./Chateau/Entree/aef5d4749fcb89c87dbd412b0a3d1efc028b9ff2_ornement ./Chateau/Entree/8e1fb61a973ff350a16ebebd6aa4020bb52a5984_ornement ./Chateau/Entree/07a235cc6046149cdd0464898fde061c7216e2fd_ornement ./Foret ./Foret/Cabane ./Foret/Cabane/b3324084269b866d11ac523f4496a4ed10bf7551_ornement ./Foret/Cabane/3ca08c59b85ddf86c208f5c7f710ef998d79eca9_ornement ./Foret/Cabane/etendard_3 ./Foret/Cabane/8674f7c63466d2d1ad6a57c9a4721bf6c11f07cf_ornement ./Foret/Cabane/73f4417a15ef2df55edaf818d7925e90e5329999_ornement ./Foret/Cabane/261d28f9e14d18ddbf7757ffa7fafec5db85bd60_ornement ./Foret/Cabane/5d16725337efe6610230da3dda25e1ffedb24409_ornement ./Foret/Cabane/etendard_4 ./Foret/Cabane/278396974ca068fca1a63ed2618a46428893cd03_ornement ./Foret/Cabane/aef5d4749fcb89c87dbd412b0a3d1efc028b9ff2_ornement ./Foret/Cabane/etendard_2 ./Foret/Cabane/Coffre ./Foret/Cabane/Coffre/piece_de_bronze ./Foret/Cabane/Coffre/.piece_eec222fed93066c280925ad209046bee157a7da2_1 ./Foret/Cabane/Coffre/.piece_cb00d12be357e95be59ec2a1481d9107bd83b3f5_3 ./Foret/Cabane/Coffre/piece_3 ./Foret/Cabane/Coffre/tableau ./Foret/Cabane/Coffre/.piece_5e4949f59059bc35731958865bc215731723a200_2 ./Foret/Cabane/Coffre/piece_1 ./Foret/Cabane/Coffre/piece_2 ./Foret/Cabane/8e1fb61a973ff350a16ebebd6aa4020bb52a5984_ornement ./Foret/Cabane/etendard_1 ./Foret/Cabane/07a235cc6046149cdd0464898fde061c7216e2fd_ornement

remove as many non POSIX idioms

There are several bashisms in GameShell code.
I am trying to remove some of them, more as a learning experience than as a real goal. (Even though it would make it easier to port GameShell to zsh or some other shell.)

All of this concerns primarily GameShell's code, but missions' code could also benefit from them where appropriate.

  • local variables do not exist in POSIX sh! The function mission_source relies on them to be re-entrant. There might be some ideas here: htps://stackoverflow.com/questions/18597697/posix-compliant-way-to-scope-variables-to-a-function-in-a-shell-script

  • compgen is used in save_environment.sh. This is used to compare the before / after environments when sourcing mission files. To get variables, set can be used, but I'm not sure there is a way to get a list of functions in POSIX sh

  • find ... -print0 and xargs -0 are not in POSIX but exist in freebsd, openbsd and macos

  • sleep 0.1 isn't in POSIX but is supported in freebsd, openbsd and macos

  • readlink -f is not in POSIX and doesn't work on macos. I wrote a small script, but it doesn't mix well when intermediate directories don't have the execute bit.

  • mktemp isn't in POSIX, but seems to be available in freebsd, openbsd and macos
    At the moment, I only use it bare mktemp, so it would be easy to write script to do something reliable enough.

  • when not available, gettext and eval_gettext could be redefined using printf and eval+printf. (That would of course remove localization.)

  • BASHPID is used to detect subshell, but I don't know if there is a POSIX equivalent
    apparently, the POSIX way of doing it is to use sh -c 'echo $PPID', see https://unix.stackexchange.com/questions/484442/how-can-i-get-the-pid-of-a-subshell

  • $RANDOM variable : there now is a RANDOM function (using awk) to do the same

  • source FILE : can be replaced by . FILE

  • echo -n : can mostly be replaced by printf

  • read -p : can be replaced by printf ... ; read

  • read -s : was replaced by stty -echo; read; stty echo

  • $'STR': were replaced

  • the variable $OSTYPE isn't necessary anymore since almost every problematic function has been re-implemented in a POSIX compliant way

  • export -f: it can mostly be replaced by writing an external script in $GSH_ROOT/bin or $MISSION_DIR/bin

  • head -c and tail -c: they were replaced by instances of dd

  • the command seq is not in POSIX! (It is not present on openbsd.) It was replaced by a small script (no option are available)

Is the release script safe ?

Line 77 of gameshell.sh is rm -rf "$GSH_ROOT" where $GSH_ROOT is defined as $ORIGINAL_DIR/$GSH_NAME.

Can there be a scenario leading to both $ORIGINAL_DIR and $GSH_NAME definitions to fail, resulting in the execution of rm -rf / or something similar ? It might be a good idea to check that $GSH_ROOT is different from / and ./.

Note that such a thing did happen with Valve's Steam install script : https://en.wikipedia.org/wiki/List_of_software_bugs#Video_gaming

`gsh reset` error `getcwd: cannot access parent directories`

Scenario

Given I start mission 4
Given I create a Hut inside the Forest
Given I go to the Hut
Given I create a Chest inside the Hut
When I enter gsh reset
Then I see errors:

shell-init: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory                                                                                                 
chdir: error retrieving current directory: getcwd: cannot access parent directories: No such file or directory
...

Expected: mission 4 is reset

Here is the list of commands:

cd Forest/
mkdir Hut
cd Hut
mkdir Chest
gsh reset

Environment

  • Archlinux
  • GNU bash, version 5.1.8(1)-release (x86_64-pc-linux-gnu)

`pstree` is not a dependency for mission `03_pstree_kill `

The presence of pstree is not checked in processes/03_pstree_kill/init.sh, and the goal file does say the command is not standard.
We can either

  • add pstree has a real dependency and cancel the mission if it is not found,
  • or talk about PPID and ps -f (that should make it possible to finish the mission)

@rlepigre , what do you think?

(Maybe we can have a real dependency for pstree, and have some other mission use PPID...)

Mission 17: xeyes

Bonsoir,
merci pour cette idée de jeu pour l'apprentissage des commandes élémentaires Shell: c'est absolument génial.
Personnellement, je rencontre une difficulté avec la mission 17 xeyes ne se lance pas au travers de l'application. J'obtiens l'erreur suivante :
[mission 17] $ xeyes Error: Can't open display:

Dans le terminal simple, l'appli xeyes fonctionne. Comment est-il possible de contourner ce problème qui semble plus être lié à mon système qu'au programme lui-même? Je suis sous Opensuse Leap 15.2.

Merci beaucoup pour votre aide et éventuelle correction.

Remove python3 dependency

python3 was initially used to display the "parchments" around goal texts.
When python3 is not available, this is now done using an awk script.

There should be awk (or shell) alternative for the missions that still use python3

  • in the group pipe_merchant_stall, the generation of the stall is done exclusively with a python script.
  • in the group finding_files, the maze generation is done either with a shell script (slow) or with a python script (fast). An awk script should replace the python script.
  • scripts in group "processes".

improve `gsh stat` command

A command to display statistics about missions.

  • gsh stat session: number of completed / skipped / cancelled missions, duration of game, etc.
  • gsh stat missions: number of tries for each mission, average time for succesful check, etc.
  • gsh stat mission [N]: detailled statistic for given mission

That can easily be done using awk on the $GSH_ROOT/.config/missions.log file.

Lancement sur Opensuse

Sur la distribution Opensuse on obtient cette erreur au lacement du jeu :
la variable 27999OSTYPE est égale à linux

mission_source should detect new processes in subshells

For example, the missions in group processes create a child process in the current shell.
If initialization is done in a subshell, the process will not be a child of the main shell. It will appear in ps (because it still belongs to the group of the main shell) but it'l parent will be init!

WISH: Add a few examples to the README

Hi, thanks for developing this.

For someone "shopping around", it's hard to get an idea what this software actually does and what the "student" will experience, without installing and running it.

I'd like to suggest updating the README.md with a few, simple, static examples that show what the input and output of the game look like.

Merlin s'est fait écraser

J'ai écrasé Merlin par erreur dans la mission 30. Un gash restart ne le fait pas réapparaître, une suppression suivie d'un restart non plus.

Spaces in file names (mission 11)

I get the following on master:

~/Castle/Great_hall
[mission 11] $ ls
11357_tapestry_ 9    17411_tapestry_ 5	      3773_stag_head	standard_3
1260_suit_of_armour  26272_decorative_shield  6166_tapestry_ 2	standard_4
14289_tapestry_ 1    27267_tapestry_ 7	      6250_tapestry_ 8
14468_tapestry_ 6    28572_tapestry_10	      standard_1
15745_tapestry_ 3    30970_tapestry_ 4	      standard_2

Lancement sur Raspberry Pi

Bonjour,
Sur un Raspberry Pi avec Raspbian installé j'obtiens cette erreur au lacement du jeu :

la variable 20104OSTYPE est égale à linux-gnueabihf je ne reconnais pas ce système...

cd .. can take you out of GameShell

cd .. can take you out of GameShell.
Additionally, the gameshell directory doesn't have the read bit set, so you get ls: .: Permission denied when you try to figure out where you are and how to get back to the game!

mission 27, 28, 29 failed

I've well install all the dependencies that were listed in the read.me.
my system: Ubuntu 20.04.2

compilation failed
Error: mission 27 is cancelled because some dependencies are not met.
compilation failed
Error: mission 28 is cancelled because some dependencies are not met.
bash: /home/ada/gameshell/.tmp/nice_fairy: No such file or directory
bash: /home/ada/gameshell/.tmp/mischievous_imp: No such file or directory

the mission 29 didn't work either

[mission 29] $ pstree $$
bash───pstree

~
[mission 29] $ gsh reset
bash: /home/ada/gameshell/.tmp/nice_fairy: No such file or directory
bash: /home/ada/gameshell/.tmp/mischievous_imp: No such file or directory

thank you, i have much fun playing this game, and i'll share it for others to learn too.

Check for unwanted output in the test script?

I noticed that it often happens that there is unwanted output (typically error messages) that is introduced on master.
I'm wondering if we should try to check that there is no such output in our test script?

Not sure how to do that though. Can we rely on such messages to be shown on stderr?

`gsh exit` is not exiting

Scenario

Given I start the game and start mission 1
When I type gsh exit
Then I see the prompt [mission 1] $

Expected: Then the game exits

Note: CTRL-D exits the game correctly.

Here is the list of the commands entered:

bash gameshell.sh
[mission 1] $ gsh exit
[mission 1] $

Environment

  • Archlinux
  • GNU bash, version 5.1.8(1)-release (x86_64-pc-linux-gnu)

using `ttyrec` to record missions

I initially wanted to use ttyrec to record the game, but that's no very useful as ttyplay doesn't have the possibility of skipping part or going backward.

It could still be fun if we find a way to record each try in a separate file: each time a mission is (re)started, a new ttyrec is started.

I'm not sure that easy / possible, especially if we want to keep the previous environment (variables, functions, aliases and CWD).

Error message when the game start

There is a weird error message printed at the start of the game.

/home/rodolphe/dev/GameShell/bin/_gsh_pcm: line 10: return: can only `return' from a function or sourced script

  |                                                   |
--+---------------------------------------------------+--
  | Run the command                                   |
  |     $ gsh goal                                    |
  | to discover your first mission.                   |
  |                                                   |
  | You can check the mission has been completed with |
  |     $ gsh check                                   |
  |                                                   |
  | The command                                       |
  |     $ gsh help                                    |
  | displays the list of available (gsh) commands.    |
--+---------------------------------------------------+--
  |                                                   |

[mission 1] $ 

Find a way to deal with UTF-8 with old `awk` versions

The script box.awk displays a frame around a text file. Some versions of awk (for example the one on macOS or BSD) do not return the correct length on UTF-8 string:

$ awk 'BEGIN {print length("hééé")}'
4
$ mawk 'BEGIN {print length("hééé")}' 
7

When the text file contains non-ASCII characters, the right border isn't aligned properly. One way to deal with that could be to try using iconv (POSIX, but not installed everywhere by default) : UTF-8 -> ISO-something -> box -> UTF-8.

Doing that would make it possible to completely remove the box8.py script.

A similar thing could be used when the detected locale is not UTF-8.

Un mot de passe admin un poil plus solide

J'étais en train de me balader dans les sources et j'ai trouvé le hash du mot de passe (c'est bien!), mais google le connaît aussi (c'est moins bien).
Ça m'a donné faim d’ailleurs.

(macOS) Erreur après la mission 10

Jusqu'à cette mission il y a avait aucun problème. Voici ce que ça écrit après un gash check pour la mission 10 :

La mission 10 est validée

stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]
****************************************
*  Tapez la commande                   *
*    $ gash show                       *
*  pour découvrir l'objectif suivant.  *
****************************************

Problem for ending mission 11

Hi,
First, thanks for this work, it will be very usefull for newbies :)

I have a problem with mission 11, 'gsh check' command remains blocked:
`
~/Chateau/Grande_salle
[mission 11] $ cp tapisserie ../../Foret/Hutte/Coffre/

~/Chateau/Grande_salle
[mission 11] $ gsh check

Bravo, vous avez réussi la mission 11 !

`

I can do 'ctrl-c' to interrupt but another 'gsh check' gives 'failed'.

(macOS) Erreur après la mission 11

Voici ce que ça écrit après un gash check pour la mission 11 :

[mission 11] $ gash check
stat: illegal option -- c
usage: stat [-FlLnqrsx] [-f format] [-t timefmt] [file ...]

La mission 11 est validée

sed: 1: "/Users/ifredos/Document ...": command i expects \ followed by text
****************************************
*  Tapez la commande                   *
*    $ gash show                       *
*  pour découvrir l'objectif suivant.  *
****************************************

Internationalisation

Avez-vous déjà pensé à traduire ce jeu?
Êtes-vous ouvert a ce genre de fonctionnalités? Si oui, comment le l'envisageriez-vous?

`C` versions of the processes in the `processes` group of missions

Currently, the processes are either shell scripts, or python scripts (when available).

The advantage of Python is that we don't see a child sleep that is called by the shell version.

Some platform (BSD / macos) do not use the filename when a process was executed with a "shebang". Those missions are cancelled on such systems.

A C version of the "spell" and "imp" / "fairy" script would allow those missions to run on those platform, provided a C compiler is present.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.