Free your creativity - IOMBCC

Página 13/29
6 | 7 | 8 | 9 | 10 | 11 | 12 | | 14 | 15 | 16 | 17 | 18

Por ricbit

Champion (438)

Imagen del ricbit

01-04-2005, 18:28

1 DEFINTA-G:DEFSTRH:DEFSNGI-Z:DIM A[8],AX[8],BX[8],AY[8],BY[8]:COLOR15,0,0:SCREEN7:FORA=1TO15:READB,C,D:COLOR=(A,B,C,D):NEXT:AW=512:AH=212:KX=-1.5:KY=-.8:LX=1.25:LY=.8:FORF2=0TO1STEP0:AX[0]=0:AY[0]=0:BX[0]=AW:BY[0]=AH:F=0:G=0:CLS:GOSUB4:'A
TO1STEP-1:Z=ZX:ZX=Z*Z-ZY*ZY+P:ZY=2*Z*ZY+Q:IF(ZX*ZX+ZY*ZY)<25THENNEXT:RETURNELSERETURN

I *really* didn't know that BASIC arrays could used with [] instead of () !!! Amazing.

Por Vampier

Prophet (2409)

Imagen del Vampier

01-04-2005, 19:29

ricbit you don't even have to give a size to the array as far as I know.

Por Arjan

Paladin (782)

Imagen del Arjan

01-04-2005, 21:37

I just discovered a little bug in my brainfuck interpreter, which caused some programs to be read incorrectly. The first version also entered in an endless loop after executing all source code. I removed those 3 extra pokes from line 1, and added an termination clause to line 2, so when a BF program ends, the interpreter stops as well. Here's the 2nd version:

1 IFGTHENPRINTCHR$(VAND(-255*(C=46)));:RESUMENEXTELSEDEFINTA-Z:ONERRORGOTO1:G=&H
9000:FORD=GTO&H9100:POKED,0:NEXT:INPUT"File:";H$:OPENH$FORINPUTAS1:Q=&HA000:P=Q-
1:FORA=0TO1:POKEQ,ASC(INPUT$(1,1)):Q=Q+1:A=-EOF(1):NEXT:CLOSE:PRINT"Running..."
2 P=P+1:IFP=QTHENENDELSEC=PEEK(P):G=G+(C=60)-(C=62):V=PEEK(G):POKEG,V+(C=45)-(C=
43):POKEG,ASC(INPUT$(-(C=44))):IFC=91ANDV=0ORC=93ANDVTHENL=1:I=92-C:FORA=0TO1:P=
P+I:C=PEEK(P):L=L-(C=91)*I+(C=93)*I:A=-(L=0):NEXT:GOTO2ELSEGOTO2

Here's another sample program (which runs correctly now Tongue):

>++++++++++>>+<+[[+++++[>++++++++<-]>.<++++++[>--------<-]+<<]>.>[->[<++>-]<[>+<
-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>+<-[>[-]>[-]++<<-[>+<-]]]]]]]]]]]+>>]<<]

This program (not made by me) calculates and displays powers of two.

Por Arjan

Paladin (782)

Imagen del Arjan

01-04-2005, 22:20

Thanx Arjan for taking one thing out of my TODO list. It is already big enough Tongue
You're welcome Tongue

btw, could everybody please format their programs nicely (ie, 80 characters per line) so that they won't mess up the forum layout?

Por wolf_

Ambassador_ (10093)

Imagen del wolf_

01-04-2005, 22:50

This forum needs a codebox!

Which is a limited-sized frame with a vertical and horizontal scrollbar with text of any dimensions inside

Por Arjan

Paladin (782)

Imagen del Arjan

02-04-2005, 00:01

hmm, for some reason I just *have* to toy around with these little programs... I keep thinking what I coded is the best that can be done in 2 lines of basic code, but then I find another cool thing that can be implemented without crossing my 2-line limit Tongue

So, another update. This time the program shows the PC and the current instruction. The "Running..." message had to be removed for this, but it's nicer this way since you can see the program is actually running Smile

1 IFGTHENKEY1,HEX$(P)+K$:PRINTCHR$(VAND(-255*(C=46)));:RESUMENEXTELSEDEFINTA-Z:O
NERRORGOTO1:G=&H9000:FORD=GTO&H9100:POKED,0:NEXT:INPUT"File:";H$:OPENH$FORINPUTA
S1:Q=&HA000:P=Q-1:FORA=0TO1:POKEQ,ASC(INPUT$(1,1)):Q=Q+1:A=-EOF(1):NEXT:CLOSE
2 P=P+1:IFP=QTHENENDELSEC=PEEK(P):K$=":"+CHR$(C):G=G+(C=60)-(C=62):V=PEEK(G):POK
EG,V+(C=45)-(C=43):POKEG,ASC(INPUT$(-(C=44))):IFC=91ANDV=0ORC=93ANDVTHENL=1:I=92
-C:FORA=0TO1:P=P+I:C=PEEK(P):L=L-(C=91)*I+(C=93)*I:A=-(L=0):NEXT:GOTO2ELSEGOTO2

Por Arjan

Paladin (782)

Imagen del Arjan

02-04-2005, 01:52

some work-in-progress stuff:

1 'Bomberman Battle IOMBCC
2 'todo: random map
3 '      graphics
4 '      optimize char codes to use to display things
5 '      optimize, optimize, optimize!
10 DEFINTA-Z:ONERRORGOTO80:SCREEN1:WIDTH32:KEYON:LOCATE5,5:PRINT"---------------
---";:C(0)=6408:C(1)=6408+8+64:S$=CHR$(10)+CHR$(13)+SPACE$(5)+"-"+"W"+SPACE$(15)
+"-":S$=S$+S$:PRINTS$;S$;S$;S$:PRINTSPACE$(5);"------------------":P=1
41 GOSUB50:GOSUB50:VPOKEC(0),88:VPOKEC(1),88:GOTO41
50 P=1-P:A=STICK(P):N=C(P)-(A=3)+(A=7)+(A=1)*32-(A=5)*32
60 H=0:M=H:S=M:W=VPEEK(N):IFW=32ORW=42ANDC(P)<>NTHENVPOKEC(P),32:C(P)=N
70 IFSTRIG(P)ANDT(P)=0THENT(P)=50:B(P)=C(P)ELSEIFT(P)>0THENVPOKEB(P),79+32*(T(P)
AND1):T(P)=T(P)-1:E(P)=-15*(T(P)=0)
80 IFHTHENV=B(P)+S:S=S*2:R=VPEEK(V):IFR<>45ANDM=0THENVPOKEV,G:RESUMENEXTELSEM=1:
IFR=87THENVPOKEV,32:RESUMENEXTELSERESUMENEXTELSEW=E(P):IFW>0THENW=W-1:E(P)=W:IFW
=14ORW=0THENG=42+(W=0)*10:H=1:X:S=-1:X:X:M=0:S=1:X:X:M=0:S=-32:X:X:M=0:S=32:X:X
90 IFVPEEK(C(P))=42THENY(1-P)=Y(1-P)+1:KEY2-P,HEX$(Y(1-P)):RETURNELSERETURN

Did we really need 5 years to code Bombaman?!? Tongue

Por Vampier

Prophet (2409)

Imagen del Vampier

02-04-2005, 09:39

Arjan.. if you place a bomb when the explosion occurs you explosion does not dissapear. So just wait until the exploision has cleared. The count in in hexadecimals too

Nice entry Smile

(ps a key off would help too for people who did not do a set screen)

Por Manuel

Ascended (19302)

Imagen del Manuel

02-04-2005, 12:34

AuroraMSX: you're right, I totally overlooked the mini manual... hit me please!

Por AuroraMSX

Paragon (1902)

Imagen del AuroraMSX

04-04-2005, 10:09

/me reaches out from Munich to Nijmegen
Darn. Too far away...

Página 13/29
6 | 7 | 8 | 9 | 10 | 11 | 12 | | 14 | 15 | 16 | 17 | 18