Hi, I went into kind of a deep dive into tiny coding recently and am loving it. It started with an odd compulsion to make the smallest action game I possibly could in C++. I wrote a nice blog post...
Hi, I went into kind of a deep dive into tiny coding recently and am loving it. It started with an odd compulsion to make the smallest action game I possibly could in C++. I wrote a nice blog post about it too with video!
I already posted to ~games, but I think that was maybe the wrong place. And here's the code for it...
#include<windows.h>// -+TINY SKI+-
#include<iostream>// By Frank Force
#include<ctime> // ski.3d2k.com
#define S SetConsoleCursorPosition
#define K GetStdHandle(-11)// O....
#define I U.dwCursorPosition// O...
#define GO S(K,I)//..O O..
#define D E(K,&U);//..O \^\ O.
#define A std::cout<<//O O
#define N(o)!(rand()%(o))// O.
#define G(o)(1&GetKeyState(o)>>16)
#define E GetConsoleScreenBufferInfo
#define R COORD i={o-1,I.Y-11};S(K,i
void O(int _){while(_--)A(N(9)?'*':
'.');}int main(){_:short s=72,k=1,i=
70,w=11,h=0,o=36,a[11][2],*g=*a,m,e=
-1;while(w--)A'\n';srand(int(time(0)
));while(++w<12||1[g]>=o&&*g<o){O(k)
;A'O';for(m=i;m--;)A(w%100?' ':'-');
CONSOLE_SCREEN_BUFFER_INFO U;A'O';O(
s-k-i);if(w%10==0)A' '<<w/10;D{R);}A
". .";GO;A'\n';o+=m=G(39)-G(37);D{R)
;}A(m?m<0?"/^/":"\\^\\":"|^|");*g++=
k;*g=i+k;GO;h=k<1?1:s<=k+i?-1:N(50)?
N(2)*2-1:h;k+=N(2)*h;Sleep(w<99?50-w
/3:16);N(5)?e=i<-25*e*N(i-15)||25<i*
e&&N(35-i)?-e:e,k-=e*(N(2)*k||s<k+i+
e),i+=e:1;g=a[w%11];}A"\n"<<w*.1-1.1
<<" meters!";while(!G(13));goto _;}
Out of curiosity, here it is with C++ syntax highlighting: #include<windows.h>// -+TINY SKI+- #include<iostream>// By Frank Force #include<ctime> // ski.3d2k.com #define S SetConsoleCursorPosition...
#include<windows.h>// -+TINY SKI+- #include<iostream>// By Frank Force #include<ctime> // ski.3d2k.com #define S SetConsoleCursorPosition #define K GetStdHandle(-11)// O....#define I U.dwCursorPosition// O...#define GO S(K,I)//..O O..#define D E(K,&U);//..O \^\ O.#define A std::cout<<//O O#define N(o)!(rand()%(o))// O.#define G(o)(1&GetKeyState(o)>>16) #define E GetConsoleScreenBufferInfo#define R COORD i={o-1,I.Y-11};S(K,ivoidO(int_){while(_--)A(N(9)?'*':'.');}intmain(){_:shorts=72,k=1,i=70,w=11,h=0,o=36,a[11][2],*g=*a,m,e=-1;while(w--)A'\n';srand(int(time(0)));while(++w<12||1[g]>=o&&*g<o){O(k);A'O';for(m=i;m--;)A(w%100?' ':'-');CONSOLE_SCREEN_BUFFER_INFOU;A'O';O(s-k-i);if(w%10==0)A' '<<w/10;D{R);}A". .";GO;A'\n';o+=m=G(39)-G(37);D{R);}A(m?m<0?"/^/":"\\^\\":"|^|");*g++=k;*g=i+k;GO;h=k<1?1:s<=k+i?-1:N(50)?N(2)*2-1:h;k+=N(2)*h;Sleep(w<99?50-w/3:16);N(5)?e=i<-25*e*N(i-15)||25<i*e&&N(35-i)?-e:e,k-=e*(N(2)*k||s<k+i+e),i+=e:1;g=a[w%11];}A"\n"<<w*.1-1.1<<" meters!";while(!G(13));goto_;}
edit: Honestly, I don't know what I expected given how condensed the code is... but I guess it kinda helps a bit. :P
Wow that's so cool! I've been wanting to get deep into coding for a while and this style of coding seems to synchronise perfectly with my compulsive need to reductio ad absurdum. How much...
Wow that's so cool! I've been wanting to get deep into coding for a while and this style of coding seems to synchronise perfectly with my compulsive need to reductio ad absurdum. How much experience with programming do you have and would you say that a lot of experience is needed in order to achieve this sort of stuff?
You should definitely give it a shot. I have a ton of experience programming in C++, but I wouldn't say it's necessary. Most of the skills I used for this wouldn't transfer to normal programming...
You should definitely give it a shot. I have a ton of experience programming in C++, but I wouldn't say it's necessary. Most of the skills I used for this wouldn't transfer to normal programming and vice versa. Just start with a simple idea and try to keep it simple while iterating to make it better.
Hi, I went into kind of a deep dive into tiny coding recently and am loving it. It started with an odd compulsion to make the smallest action game I possibly could in C++. I wrote a nice blog post about it too with video!
I already posted to ~games, but I think that was maybe the wrong place. And here's the code for it...
Out of curiosity, here it is with C++ syntax highlighting:
edit: Honestly, I don't know what I expected given how condensed the code is... but I guess it kinda helps a bit. :P
Oh cool, I didn't know we could do that!
Such a fun little game! Incredible job! 😄
Thanks, it was a lot of fun to make too!
Wow that's so cool! I've been wanting to get deep into coding for a while and this style of coding seems to synchronise perfectly with my compulsive need to reductio ad absurdum. How much experience with programming do you have and would you say that a lot of experience is needed in order to achieve this sort of stuff?
You should definitely give it a shot. I have a ton of experience programming in C++, but I wouldn't say it's necessary. Most of the skills I used for this wouldn't transfer to normal programming and vice versa. Just start with a simple idea and try to keep it simple while iterating to make it better.