Giter VIP home page Giter VIP logo

five-lines's Introduction

five-lines

In this kata your task is to refactor the code for a small game. When finished it should be easy to add new tile types, or make the key draw as a circle, so we can easily distinguish it from the lock.

The code already abides by the most common principles "Don't Repeat Yourself", "Keep It Simple, Stupid", and there are only very few magic literals. There are no poorly structured nor deeply nested ifs.

This is not an easy exercise.

About the Game

In the game, you are a red square and have to get the box (brown) to the lower right corner. Obstacles include falling stones (blue), walls (gray), and a lock (yellow, right) that can be unlocked with the key (yellow, left). You can push one stone or box at a time, and only if it is not falling. The flux (greenish) holds up boxes and stones but can be 'eaten' by the player.

Screenshot of the game

How to Build It

Assuming that you have the Typescript compiler installed: Open a terminal in this directory, then run tsc. There should now be a index.js file in this directory.

How to Run It

To run the game you need to first build it, see above. Then simply open index.html in a browser. Use the arrows to move the player.

Thank You!

If you like this kata please consider giving the repo a star. You might also consider purchasing a copy of my book where I show a simple way to tackle code like this: Five Lines of Code, available through the Manning Early Access Program.

Five Lines of Code

If you have feedback or comments on this repo don't hesitate to write me a message or send me a pull request.

Thank you for checking it out.

five-lines's People

Contributors

thedrlambda avatar

five-lines's Issues

package.json is missing

Hello!

The project doesn't provide information about the required libraries and packages.
This makes it harder then necessary to setup the project.

I suggest adding a npm or yarn configuration to describe the dependencies of the project.

Kind regards
Felix

Readme is hard to read in code

Hello!

Every paragraph in the Readme is formatted as one long line. This makes it pretty hard to read in editors without preview.

I suggest to to make one line per sentence and separate paragraphs with two lines from each other.

This brings other benefits as well, for example:

  • Easier to see how complex the sentences are, longer/shorter ones are easy to spot
  • Changes are less noisy and easier to reason about

Kind regards
Felix

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.