Git Product home page Git Product logo

snake's People

Contributors

talglobus avatar

Watchers

 avatar

snake's Issues

Change representation of previous snake location from last segment of snake

Currently, the way the snake grid is rendered only affects squares that fall into one of three categories:

  1. Part of the snake body
  2. Food
  3. The single newly-empty square that was most recently food
  4. The single newly-empty square that was most recently previously part of the snake body

This issue concerns category (4), the square that the snake just moved off of, which must be rendered as an empty square after each movement of the snake. At the moment, this square is simply represented with a dummy coordinate-pair at the end of the snake body. However, this is semantically problematic as this square is certainly not a part of the snake.

This square should be represented as a third property of the Snake struct, as additional to pos and direction. This change would make the representation of the snake more semantically correct, and also prevent any number of bugs related to this unusual representation of the square most recently vacated by the snake. For example, a recently predicted and proven bug is that if the snake runs into this square, which is not a part of the snake body, the game will show a loss as if it were.

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.