⬆️ ⬇️

Playing 0 lines of code on pure JS



I did not want to take part in the week trend of Habr - “We write everything in 30 lines of code!”, There is no time to spare. But the theaqua post about Hello world in 1 line on pure javascript inspired me to beat this record. I wrote the game using JavaScript, HTML and CSS, while using only 0 lines of code. After this post I could not sleep. I suffered from insomnia and, taking myself in hand, sat down to write a game. Understanding that I have to use 0 lines of Javascript code - I was very afraid. To write a program with 1000 lines of code and more is not a problem. But write 0 lines of code ... This is crazy. It turns the brain. Changes attitude to the web. You understand that before you wrote something wrong ...



For those who are not used to waiting - DEMKA .



This is not a fake, but a full game. Details under the cut.

')





Requirements



Browsers: Chrome, FF, Safari, IE10 +



How to play



You can start the game by moving the cursor on the field with the game.

The ship is controlled by mouse movement.

When confronted with the enemy ship - the round ends. To start again, you need to move the cursor away from the playing field and again bring it to the field.

To pick up a bonus, you need to send the ship aft on the bonus and click. If the bonus is selected - it will be counted and the reward icon will appear in the status bar. If you pass the game, the program will inform you about this with a welcome popup.



For clarity, there is a video tutorial:







P.S



I have been doing programming for a long time. And for this reason, I thought that I would be able to master such a difficult task as creating a game written using JS, which will have 0 lines of code.



I used to treat HTML programmers condescendingly. But now I realized that soon they could conquer the world. You will remember how once JS programmers were not taken seriously. Remember these dark times? Now look back ... JavaScript is not just a trend. He is already everywhere. In browsers, on the server, in microcontrollers, mobile OS ... OS is written on it, games are written ... And now HTML-programmers quietly sneak up on us.



Writing 0 lines of JS code once becomes the norm. JS will be as unfashionable as Flash is now. Why write to JS if it is slower than an HTML program written by an HTML programmer using CSS.



UPD:

Repository:

github.com/i0z/nojsgame



Feedlo:

jsfiddle.net/9dQx3/10

codepen.io/i0z/pen/mFLCw



Original nojsgame.majorov.su

Source: https://habr.com/ru/post/203048/



All Articles