Tetris by yt

with text_io;use text_io;procedure z is
a:array(-39..999)of boolean:=(others=>1=1);c:character;n,m:natural:=1;begin
for i in 1..150 loop get(c);a(i):=c='#';end
a(-39..0))=(0..39=>0=1)loop n:=n+10;end loop;a(n..n+39):=a(n..n+39)or
a(-39..0);while m<142 loop
if a(m..m+9)=(0..9=>1=1)then
a(10..m+9):=a(0..m-1);end if;m:=m+10;end
loop;Set_Line_Length(10);for i in 1..150 loop
c:=' ';if a(i)then c:='#';end if;put(c);end loop;end;

Note that non-ascii characters in the above source code will be escaped (such as \x9f).


return to the top page