Code Monkey home page Code Monkey logo

2048_'s Introduction

2048_

A pygame implementation of the game 2048

Requirements

  • Python 2.7.6(usually pre-installed in Ubuntu)
  • Pygame package for the specified python version

For installing the requirements you can check the following link.

The code

Here is a brief summary to get you started:

  • showStartScreen() function basically shows the first screen on executing the code.
  • randomfill(TABLE) function randomly fills the table in empty spaces.
  • drawPressKeyMsg() function shows the press key message on the start screen at the bottom right corner.
  • checkForKeyPress() function checks for an event(key press in our case) and returns the same.
  • show() function displays the game screen after each key press and also matches the defined colours with the respective cells.
  • runGame is the function that controls the overall game. It is called in an infinite loop in the main function. It calls the randomfill function and even checks for the pressed key by calling the key function. It stores the copy of the previous table and matches with the present state. This is the function controlling the whole state of the game.
  • moveDown function is defined for the actions to be undertaken when the downward key is pressed.

Screenshots

Screenshot_from_2017-12-01_12_43_59.png

Screenshot_from_2017-12-01_12_43_14.png

Issues

  • Complete the code for other moving options moveup, moveright and moveleft.
  • Make the start screen look more attractive with options for different levels and leaderboard.
  • Make a leaderboard for storing high scores calculated on basis of Points earned and Time taken.
  • It will be great to implement AI techniques which can provide the player with hints for the next step.

Contributing

Any contributions are more than welcome. Just fork the repo and start contributing.

2048_'s People

Contributors

tibrewalpratik17 avatar

Watchers

 avatar

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.