Run Game Snake on PcDuino

by Linksprite in Circuits > Electronics

848 Views, 8 Favorites, 0 Comments

Run Game Snake on PcDuino

wire-snake_1.jpg

In this tutorial, we are going to show how to run a game named “Snake” on pcDuino, and controlled by Linker JoyStick Module.

About the Game Snake

Snake is a classic casual video game that many people love and are familiar with.
The player controls a long, thin creature, resembling a snake, which roams around on a bordered plane, picking up food (or some other item), trying to avoid hitting its own tail or the “walls” that surround the playing area. Each time the snake eats a piece of food, its tail grows longer, making the game increasingly difficult. The user controls the direction of the snake’s head (up, down, left, or right), and the snake’s body follows. The player cannot stop the snake from moving while the game is in progress, and cannot make the snake go in reverse.

Step 1: Wire Diagram

wire-snake_1.jpg

The JoyStick is connected as following:

  1. GND of JoyStick -> GND of pcDuino
  2. VCC of JoyStick -> 3.3V of pcDuino
  3. x of JoyStick -> A2 of pcDuino
  4. y of JoyStick -> A3 of pcDuino

Step 2: Running Interface

running-interface_1.jpg

Step 3: Source Code

Download snake source code :

http://cnlearn.linksprite.com/wp-content/uploads/2013/10/snake.zip

1. Put the source code into pcduino

2. Open the LXTerminal and cd into source code floder, and run " make all".

You must run command as ROOT when receive an "Access Denied" or a Permission Denied" scripting error message .

3. You must install curses library whe you receive cureses.h not found .

install curses library:

sudo apt-get install libncurses5-dev

4: Makefile variables in ARDUINO_PATH arduino installation directory. You can modify the actual situation

Downloads

Customer Support