Code Monkey home page Code Monkey logo

vmtetris's Introduction

vmTetris

Tetris in a small virtual machine. Use the cursor keys. Press esc to quit.

m[444],c,x;main(o,a){for(system("stty cbreak -echo min 0"),srand(a);o=f();o<42?a
=(x=o/2%7)<3?x:x<4?f():x<5?m[f()<23?x:m[x-23]]:x<6?read(0,m,1):rand()%f(),m[x=o%
2?f():m[6]++]*=o<28,a=m[x]+=o>13?a:-a:o<45?putchar(o%3?o%2*75+f():a):o<63?f(),c=
!a^o/54?x+o%9*75:c:usleep(20000));system("stty sane");}f(){return x=c++["NCRM7@\
BD;527e4R37Q<Q9M27e@Q:OQ9MQ9Q;MQ9OMQ;Q9B7MQEQ:Q:OM27e^MQEMQ:OQ8KMQEOQ8OMQDMKQ:O\
MMQDQ:OQ:P7KMQ;OQ:Q927fDP7MMQ8MQ;Q:27fSRE5RE<Q6D952<ffR;<Q62<fr[JZ?[a[y`KT=>T?@\
LD2C^_L/V<gE6J/c@6U/g[68?^[D;?2/ggD:=NDTBC2/gm@=2/gs2=P8RE5RF<R;;TL747h?47K25T=\
9D;9859_iTA:F?:T=9R26FQ9859_iF59@:26hV`<B7`8RI98=9c@>D`0N8T@?T>=guS825=2;h3252<\
h028k7RI=X66DM6R:9T6AF6A29iZX2?T?9F9?F9?RE5RE<TL7=27c@2<isR[5RD<=R9;R97N98L9jJ2\
7=2;jA>7k3T5;N558aX25C9T;5>0ji2BT5;T576:7SN456F7jlT;52<j:[JZ?[j[wR[5RD<R;;[JZ?[\
cTL7D_7YZQ[O[O=2;kH25[92<kE[JZ?ZQR45TL9l025kq=TL9D_9Y25l0[9n^7/"]-47;}/********/

image

Snake in the same virtual machine.

m[444],c,x;main(o,a){for(system("stty cbreak -echo min 0"),srand(a);o=f();o<42?a
=(x=o/2%7)<3?x:x<4?f():x<5?m[f()<23?x:m[x-23]]:x<6?read(0,m,1):rand()%f(),m[x=o%
2?f():m[6]++]*=o<28,a=m[x]+=o>13?a:-a:o<45?putchar(o%3?o%2*75+f():a):o<63?f(),c=
!a^o/54?x+o%9*75:c:usleep(20000));system("stty sane");}f(){return x=c++["RC5RQ6\
326e5R@6T5>3DP5>7eP26e=@7e2RP6D9;26eSR3=N<[JZ?[a[yfcL/V:ek6J/a56U/f3L<6Q<2/f:RQ\
<2/f@N<2/fHL<2<F<;TR5^?D35j5@==58]X25C9T95RW5Jy5Jy5Jy5Jy5Jy5Jy5Jy5Jy5TL6fc63:S:\
N9T;5S=>9^M251grRC5TL6^fTL7B7^fB7^f46^f@6S68>5^rF>5gP[JZ?[j[wRC5RA:RQ9TL6DQ58L6\
_O26_OB6_OZChQ[O6Q5T57TL6=8L6_l26_lB6_lZ`iCP8TL6DQ58L6`A26`AB6`A6R528hnZC`C[OT7\
5=29h8[92:h5Z7ZGZSZVZI[i[OR35TL7il25ib=TL7D_7Y25il[9nnnnn\\i/"]-47;}/**********/

image

vmtetris's People

Contributors

2bt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

hermetique

vmtetris's Issues

NOP missing

every machine should have a nop instruction

getchar does not read input

I've not been able to fix it but your tetris is unplaybable because there is no way to interact with the program. The problem is caused by the extern call stty cbreak -echo min 0 which causes getchar to never read anything. I've tried to change it to stty cbreak -echo min 1 time 0 but it causes the program to hang. I've also tried to hardcode a stream of input values ([27, 91, 65] (โ†‘), etc.) but the only value which does not cause the program to hang is -1 (ie, no input).

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.