Snake (Rắn)

« tiếng Việt »

2022-10-31

According to personal experience, the fastest way to learn is to make something. From debut years of mobile phones, I was mesmerized by the Snake games on them Nokia bricks.

After the switch to Linux and using the command line (cli) more often, I was curious to learn more on how my computer actually works. Realizing most important software such as Linux, and many other programing languages are based on C, I find my way to learn C. Mostly from YouTube.

~*~


Index

~*~

updated: 2022-10-31
(initial)

~*~


Souce Code

~*~

updated: 2022-11-02
(mở màn)

I publish by date.

All the source code are archived here.

~*~


Download

~*~

updated: 2022-11-02

To download the latest version, run:


    wget https://soft.trung.fun/ran/src/snake.tar     

~*~


Verify & Extract

~*~

updated: 2022-11-02

To avoid running mallicious source code, you should verify PGP signature with my public key to make sure the file you just downloaded is the same file I published.

My public key is at the bottom of every page or here.

Every version has it’s own signature file. Download this file with:


    wget https://soft.trung.fun/ran/src/snake.tar.asc     

Then run:


    gpg --verify snake.tar.asc     

If the above command return Bad Signature that means this file was not published by me. You MUST stop here and let me know about this.

If the above command return Good Signature then you can continue to extract the file:


    tar -vxf snake.tar     

Source code are archived by published date - [PublishedDate].

~*~


Dependency

~*~

updated: 2022-11-27

The game depends on ncurses library. On Debian, install it with:


    sudo apt install libncurses-dev     

~*~


Build

~*~

updated: 2022-11-02

You need to build the program from these souce code files. So go into the directory:


    cd [PublishedDate]     

And then build:


    make     

~*~


Play & Control

updated: 2022-11-02

~*~

Run the game with this command:


    ./snake     

To change the direction of the snake, use the arrow key on your keyboard:


    [←] = Left
    [↑] = Up
    [↓] = Down
    [→] = Right     

You can increase the speed by press and hold the arrow keys.

To pause the game, press [Space]. You can continue playing by pressing any arrow key.

To stop the game, press [End]. Then press [q] to quit; or [y] to play a new round.

~*~