How to Install and play snake game on Linux Terminal
To Install and play snake game on Linux Terminal
Snake game is the most popular game, played on mobile devices. In this article we will show how to install and play snake game on Linux terminal.
To install Snake game
Go to the following link to download snake game,
http://sourceforge.net/projects/nsnake/
After downloading, Extract the package using the following command.
[root@linuxhelp ~]# cd Downloads/ [root@linuxhelp Downloads]# ls nsnake-3.0.1.tar.gz [root@linuxhelp Downloads]# tar -xzf nsnake-3.0.1.tar.gz [root@linuxhelp Downloads]# ls nsnake-3.0.1 nsnake-3.0.1.tar.gz [root@linuxhelp Downloads]# cd nsnake-3.0.1/
This game requires the library packages c++ and ncurses. Run the following command to install it.
[root@linuxhelp nsnake-3.0.1]# yum install gcc-c++ ncurses-devel ncurses -y
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: centos.webwerks.com
* extras: centos.webwerks.com
* updates: centos.webwerks.com
Package ncurses-5.9-13.20130511.el7.x86_64 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package gcc-c++.x86_64 0:4.8.5-4.el7 will be installed
--> Processing Dependency: libstdc++-devel = 4.8.5-4.el7 for package: gcc-c++-4.8.5-4.el7.x86_64
--> Processing Dependency: libstdc++ = 4.8.5-4.el7 for package: gcc-c++-4.8.5-4.el7.x86_64
--> Processing Dependency: gcc = 4.8.5-4.el7 for package: gcc-c++-4.8.5-4.el7.x86_64
.
.
.
Installed:
gcc-c++.x86_64 0:4.8.5-4.el7 ncurses-devel.x86_64 0:5.9-13.20130511.el7
Dependency Installed:
cpp.x86_64 0:4.8.5-4.el7 gcc.x86_64 0:4.8.5-4.el7 glibc-devel.x86_64 0:2.17-106.el7_2.6
glibc-headers.x86_64 0:2.17-106.el7_2.6 kernel-headers.x86_64 0:3.10.0-327.22.2.el7 libmpc.x86_64 0:1.0.1-3.el7
libstdc++-devel.x86_64 0:4.8.5-4.el7
Dependency Updated:
glibc.x86_64 0:2.17-106.el7_2.6 glibc-common.x86_64 0:2.17-106.el7_2.6 libgcc.x86_64 0:4.8.5-4.el7 libgomp.x86_64 0:4.8.5-4.el7
libstdc++.x86_64 0:4.8.5-4.el7
Complete!
Now install the snake game using the following command.
[root@linuxhelp nsnake-3.0.1]# make # Compiling src/Flow/GameStateMainMenu.cpp... # Compiling src/Flow/InputManager.cpp... # Compiling src/Flow/StateManager.cpp... # Compiling src/Flow/GameStateGame.cpp... # Compiling src/main.cpp... # Compiling src/Misc/Timer.cpp... # Compiling src/Misc/Utils.cpp... . . . # Compiling src/Game/Player.cpp... # Compiling src/Game/Game.cpp... # Compiling src/Game/Board.cpp... # Compiling src/Game/ScoreFile.cpp... # Compiling deps/commander/commander.c... # Linking... # Build successful! [root@linuxhelp nsnake-3.0.1]# make install # Linking... # Build successful! # Installing... # nsnake successfuly installed! To launch Snake game
To Launch the game run nsnake command on your terminal.
[root@linuxhelp nsnake-3.0.1]# nsnake
To change the settings, click Game settings
To know about the key Controls, click control option.
Click Help for more info.
To select levels, click Level Select.
To add level, copy the default level from /usr/share/games/nsnake/levels/ to /root/.local/share/nsnake/levels/
[root@linuxhelp nsnake-3.0.1]# cp /usr/share/games/nsnake/levels/* /root/.local/share/nsnake/levels/
Now you can select the levels on the game menu.
Click Arcade mode, to play the game.
To pause the game press “ Enter”
Syntax; "groupinstall development tools"