Giter Club home page Giter Club logo

blockade-snake-game's Introduction

Blockade-Snake-Game

An implementation of the blockade snake game

The Blockade game is one of the oldest arcade games . But you know surely more the Snake game derived from Blockade and widely declined on cellphone.

The classic version of the game Blockade is to grow one or more snakes in an arena (game grid), so that snakes become obstacles. When the game starts, the snake is of minimal size and moves in a straight line. The player can turn it right or left, but can not stop it: if it does not do not turn, the snake continues to move forward. The snake increases periodically in size, whether turning or continuing in a straight line. If the snake comes out from the arena or collides with another snake or even with his own body, the game stops.

Basic game for the project

General principles The rules here are those of Blockade:

  1. There are two snakes.
  2. There is no apple, the size of each snake increases automatically.
  3. There is no score, the winner is the surviving snake.

The arena of your project is a square grid composed of N ร— NN ร— N squares and occupied by two serpents, of which one can differentiate the head and the tail. The movement of snakes is calculated periodically. Initially, a snake starts from the center of the upper quarter-left of the screen, and the other snake by the opposite position (center of the lower-right quarter) With each cycle of calculation, each snake grows.

Types of movements realized

Each snake moves in one of the following modes for the duration of the game.

  1. Using the indication of a player, with the keys of direction of the keyboard.
  2. Or independently, following a random movement or following an intelligent movement. These modes of movements are detailed at the following sections.

Movement controlled by the player

As long as the player does not hit any keys, the snake goes straight. As soon as player taps a direction key, his snake takes that direction; the arrows can then either correspond to the cardinal points, or indicate a new direction relative to the current direction (left or right).

Random movement

The snake randomly chooses its direction, even if the corresponding box is busy.

Smart movement

The snake can know if the front, right or left boxes are occupied. he Randomly chooses to go in one of the free directions. If the snake can not choose free direction, he sits down.

Very smart movement

The snake can memorize the different positions occupied by the snake each calculation cycle, and take this into account when calculating its next direction. If the snake can not choose a free direction, he is falling out.

Multiplayer (Network game)

In addition, two players can play a network: in this case, each player will launch his own game on his computer, connect to the other player and control his own snake. He will see on his screen the two snakes: his and his opponent. Both player programs will communicate in client / server mode. Each program must be able to be started either in client mode or in server mode. When two players want to play a game, they have to decide which player will launch its program in server mode, and which player will launch his program in customer. The server must be started before the client.

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.