#include<allegro.h>/* 80x25 platform-a-like - My Second entry for #maximilian */
volatile int t;c(){t++;}int main(){int m[40][30],x,y,p=20,P=20,o=0,O=0,f=10,F=10
,e=160,E=120,s=0,B;allegro_init();install_keyboard();install_timer();LOCK_VARIA\
BLE(t);LOCK_FUNCTION(c);set_color_depth(24);set_window_title("80x25 Platformer")
;set_gfx_mode(2,320,240,0,0);B=create_bitmap(320 ,240);srand(time(0));for(y=0;y<
30;y++){for(x=0;x<40;x++){if((y==29))m[y][x]=1;else if(y<5)m[y][x]=0;else{if(x&&
m[y][x-1]){if(rand()%2==0)m[y][x]=1;else m[y][x]=0;}else{if(rand()%12==0)m[y][x]
=1;else m[y][x]=0;}}}}install_int(c,100);while(!key[59]){if(t){t=0;o*=.7;O++;if(
O>7)O=7;P+=O;p+=o;if(e<p)e+=2;if(e>p)e-=2;if(E<P)E+=2;if(E>P)E-=2;if(P<0){P=0;O=
1;}if(p<0){p=0;o=1;}if(p>320){p=320;o=-1;}if(m[P/8][p/8])O=-4;if(key[82])o=-5;if
(key[83])o=5;if(key[84])O=-5;if((p/8==f)&&(P/8==F)){s++;do{f=rand()%40;F=rand()%
30;}while(m[F][f]);}}else{for(y=0;y<30;y++){for(x=0;x<40;x++){if(!m[y][x])rectf\
ill(B,x*8,y*8,(x*8)+7,(y*8)+7,makecol(y*8,x*6,y*8));}}circlefill(B,p,P,4,makecol
(0,P,p/2+95));circlefill(B,e,E,4,makecol(E/2+127,0,0));for(y=0;y<30;y++){for(x=0
;x<40;x++){if(m[y] [x])rectfill(B,x*8,y*8,(x*8)+7,(y*8)+7,makecol(x*6,y*8,0));}}
circlefill(B,(f*8)+4,(F*8)+4,4,makecol(0,200,0));if((p/8==e/8)&&(P/8==E/8)){tex\
tout_centre_ex(screen,font,"GAME OVER - Press SPACE",160,120,0,-1);clear_keybuf(
);do{x=readkey();}while((x&0xff)!=' ');return 0;}textprintf_ex(B,font,8,8,makec\
ol(0,200,200),-1,"Score: %d",s);blit(B,screen,0,0,0,0,320,240);}}return 0;}END_\
OF_MAIN()/*  Arrow keys control the player  -  You may go up through blocks, but
you will bounce if you attempt to go down through them  - Eat the green fruit to
    gain   points,   but   avoid   being   eaten   by   the   red   enemy     */
