Coder Social home page Coder Social logo

2048's Introduction

Build Instructions

To make and run with GHS tools

sudo apt-get install libncurses5-dev libncursesw5-dev

make

./2048 or multi 2048

To make and run with gdb

sudo apt-get install libncurses5-dev libncursesw5-dev

Update Makefile to this:

CFLAGS?= -g
LDLIBS= -lncurses

make

./2048 or gdb 2048

Bug Hunt

At one point, this program was a fully functional game of 2048. A series of bugs have been introduced in order to challenge the users critical thinking skills and debugging knowledge. These introduced bugs will require changes only to existing lines of code. There is no need to add or remove any full lines of code. This program uses the ncurses library to display game information to the terminal. You do not need an in-depth understanding of this library to be able to solve each of these bugs. It is recommended that you solve the problems in the order listed, but it is not completely necessary.

Bugs

  1. The game stalls and does not react to any keyboard controls. You can only exit the game by using ctrl+c.
  2. The game crashes after a few game movements.
  3. Restarting the game (r) occasionally causes you to start with a score of 1 or 2 when you should start with 0. Sometimes a tile with a value of 8 or 16 spawns when it shouldn't. There might be some other undefined behavior in the game but these are the primary issues you should focus on.
  4. There appears to be an issue with the way the game is saved or loaded. When you quit the game and reopen, the autosaved score is incorrect. You have to quit and run the game two times to get the bug to reproduce.
  5. Restarting (r) the game after playing for a bit seems to cause the score for the next game to be incorrect. Quitting (q) the game and rerunning it appears to "fix" the broken score.

Helpful Links

2048's People

Contributors

kremeran avatar

Watchers

James Cloos avatar  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.