GithubHelp home page GithubHelp logo

binghuan / tetris Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 2.0 4.56 MB

Coding quest from "BaseCase"

Home Page: http://studiobinghuan.blogspot.tw/2016/03/tetris.html?view=flipcard

HTML 24.87% JavaScript 75.13%
tetris webapp assignment javascript game take-home-test

tetris's Introduction

Tetris


My blog:

http://studiobinghuan.blogspot.tw/2016/03/tetris.html?view=flipcard

link to launch the web app: http://binghuan.github.io/tetris/

There are 5 different pieces in this version of Tetris

and they fall down a 20x20 tetris board:


The game starts with a random piece appearing at the top of the board. The user is then prompted to make a move:
(return): move piece left
(return): move piece right
(return): rotate piece counter clockwise
(return): rotate piece clockwise

If the move the user selects is valid, then it is executed and the screen redrawn (you can use printf()/cout/System.out.println(), etc to redraw the entire board).

If the action is not valid, then the user is again prompted to enter a valid move. Note that the game only updates after the user has entered a valid action.

A valid move is defined thus: The piece is altered as per the user's input, and then displaced by 1 row downwards.

If the piece, drawn at its new location, is not outside the bounds of the board, and does not overlap any pieces that previously fell, then the move is valid.

If the piece's new position is such that it allows no valid move, then a new piece appears along the top of the board, randomly positioned along the x-axis.

If this new piece happens offer no valid move, then the game is over and the program exits. Good Luck!




Coding quest from "BaseCase"

tetris's People

Contributors

binghuan avatar

Stargazers

 avatar

Watchers

 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.