Hacker News new | past | comments | ask | show | jobs | submit login
Block-breaking game in vim 8.0 (github.com/johngrib)
223 points by johngrib on July 4, 2017 | hide | past | favorite | 37 comments

For those who like this I can tell you about another thriving gaming platform...

Emacs! You can out of the box play all your favorites such as

   M-x tetris
   M-x snake
   M-x solitaire

Just as well as multiplayer classics

   M-x pong
To find out more and get the latest games check out https://www.emacswiki.org/emacs/CategoryGames#toc1

Great OS, the only thing that's really missing is a decent text editor.

Nothing beats Microsoft platforms for gaming though. Excel 97 has a built-in flight sim. Can Emacs do THAT?

It was written with Excel macros or Basic, or someone wrote the C program and compiled it within the Excel binary?

The point of Emacs is that you can build this stuff with its Lisp language. I imagine that you can write a crappy flight simulator with it.

There's a decent Pac-Man implementation in Excel: http://www.geocities.jp/nchikada/pac/

Edit: I see he's added Space Invaders too.

Or Hall Of Tortured Souls (Easter Egg) Excel 95:


The question is: can Excel 97 do that with its extension language.

And there was pinball in Microsoft Word 97.

Related, a self destroying game I built some time ago: https://void4.github.io/ The yellow dot is the instruction pointer, the red dots represent the program memory. If you hit the ball just right you can introduce graphic glitches. Most times, the instruction pointer gets out of bounds however.

That's kinna like the story about the guys who coded a Tron lightcycle game on the Apple II. Failure to properly bounds-check the lightcycle position meant that the cycles could be driven off screen, corrupting main memory and the game code itself -- much like what happened in the move Tron.

One of the most brilliant applications of this concept is the Pokémon Yellow Total Control Hack: http://aurellem.org/vba-clojure/html/total-control.html

Similarly, arbitrary code execution in Super Mario World: https://www.youtube.com/watch?v=OPcV9uIY5i4

It's like transforming a chess game into Mikado just by playing it.

One thing I've often wanted to do, but didn't have the time to, was to take Turing Drawings: https://github.com/maximecb/Turing-Drawings ( faster asm.js variant here: https://github.com/darius/Turing-Drawings ), which runs a random Turing machine to generate abstract art and put the machine description in the image itself, so it could self-modify.

The links you gave are fascinating! Believe it or not, I have done something like that, too: http://imgur.com/gallery/sRUrI

To be fair, that seems to require turning off in the middle of a save. Not entirely by the rules of the game.

I was looking through the source and learned that Python's modulo operator is based on floor-division (rather than round-toward-0 division like in C). In case anyone cares how Python actually does in in C, for small ints its defined at https://github.com/python/cpython/blob/master/Objects/longob...

This is really cool and I'd love to play with it, but my eyesight isn't good enough to hit the ball more than once at a time. Is there anyway you could post an upscaled version?

Updated it. If it's still too small, just right click, inspect element and choose a custom width and height.

CTRL-[+] in your browser?

Welcome to the Emacs family, Vim. We have been waiting for you.

You mean

M-x welcome

everywheres$ vim


mostwheres$ emacs

bash: emacs: command not found

vi is pretty usual to find in a default installation, but Vim? Debian is the only OS I've come across that includes it (and aliases it to vi, for some stupid reason!).

(Note: Vim user here)

macOS aliases vi to vim:

    mymacbook:~ mikestew$ ls -lah /usr/bin/vi

    lrwxr-xr-x  1 root  wheel     3B Jun  7 12:21 /usr/bin/vi -> vim
Seems like Debian, as you describe it, went the reverse route for some odd reason. Is that right, I type in vim on Debian and vi runs?

Great for companies that measures productivity by keystrokes per minute. (sarcasm)

This is absolutely amazing! I encourage everyone to skim over the code! It's surprisingly readable Vimscript.


Does this work with Neovim or vim only?

Works for me; nvim v0.2.0

If it works in vim it should work in neovim?

It was forked before vim 8.0 was released and neovim doesn't try to keep its fork compatible with vim. Consequently it is not.

> neovim doesn't try to keep its fork compatible with vim.

Nvim tracks all Vim patches[1]. _Only_ the job-control API differs. All other Vim patches are merged into Nvim reguarly, including new Vimscript features like partials, lambdas, etc.

Nearly all 7.4.x patches (except for job-control) have been merged:


Hundreds of 8.0.x patches have been merged also, but they won't be in that report until we finish the last couple 7.4.x patches.

[1] https://github.com/neovim/neovim/wiki/Merging-patches-from-u...

It doesn't work in my neovim, sadly.

Lots of errors. Most common seems to be:

E117: Unknown function: funcref

And similar.

funcref() is in Nvim 0.2. Old versions of Vim also don't have funcref() ...

Maybe vim 8.0 only. I did not tested in Neovim.

How about breakout using the Nuke compositor and a python script:


I guess after a long day at work, looking at your project's code, this is a good relaxing "exercise".

Is "Breakout" still a forbidden word due to trademarking?

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact