Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 19:07 12 Jul 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Colour Maximite 1 & 2 BASIC Programming Challenge 2021

     Page 5 of 8    
Author Message
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 05:38am 04 Apr 2021
Copy link to clipboard 
Print this post

Hi All,

I would like to take this opportunity to thank all of the participants to the challenge. I would also like to thank Tom and Nimue for their offer to be judges (along with myself).

I have had a quick play of all entries, by no means a thorough examination of them.

Observations I made in this `play' .

NOTE these are not JUDGEMENTS or Criticisms but simple quick observations of the quality of the entries received.

1. It was so much fun and brought me back to the old TRS-80 and Excalibur 64 Z80 based days.

2. I am amazed at what can be achieved in so little code space.

3. If I thought I could understand BASIC I was deluding myself, almost all entries were so tightly packed to be unintelligible to me (We all know I am not a great programmer so that doesn't really say a a lot). In fact i would have thought I was looking at an ascii dump of a machine language program.

4. Vegipete, after getting square eyes running around in circles I found the destruct switch but I couldn't trigger it. Am I missing something? I kept shooting the laser at it and I couldn't find a button that pressed the trigger (space shot the Phaser). I really enjoyed a flash back to the old 8bit maze based games..

5. Jrsoft, I spent so much time playing this I nearly had no time to browse the others, another flashback to TRS80. (I did have to turn the sound off after a while)

6. Lizby, another enjoyable game, in fact one that is very similar to one I often play on my iPad, however I felt that it needed a SUCCESS screen when the balls were correctly in each tube.

7. Mauro, Your game brought me back to a similar TRS80 game that was a submarine and thoughts of a movie from the 1970's (fantastic world??? or similar name).

8. Mixtel, yours hit one of my heart strings as I really like utilities that can help someone to do something constructive, in your case identify resistors.

9. Realbobele, I also enjoyed your game and played it longer than I meant to spend.. I do think a sprite with a small boat would have been better than the A character but once again very well done and very playable (and not easy)

10. Timd, another game I felt was MORE than a game, you had to try to estimate the effect of the other planets gravity on the ship, I got some VERY interesting flights out of some levels.

11. Volhult, I wasnt able to play the game in its submitted form as I no longer have a working CMM1 but I will try some of the suggestions above when I really get down to analysing as best I can each entry.

Thank you for your efforts and will reply in more details after I consult with the other judges.

I wish I had more things to offer than mere PCBs as I realise some people may not be into building hardware but then you could always frame them and hang then on the toilet wall..  

Kind Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1129
Posted: 08:14am 04 Apr 2021
Copy link to clipboard 
Print this post

  bigmik said  4. Vegipete, after getting square eyes running around in circles I found the destruct switch but I couldn't trigger it. Am I missing something? I kept shooting the laser at it and I couldn't find a button that pressed the trigger (space shot the Phaser). I really enjoyed a flash back to the old 8bit maze based games..

When you walk right up to the pedestal, the switch changes from red to green, and a message appears briefly. No special action required.
Visit Vegipete's *Mite Library for cool programs.
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 08:45am 04 Apr 2021
Copy link to clipboard 
Print this post

Hi Vegipete,

  vegipete said  
When you walk right up to the pedestal, the switch changes from red to green, and a message appears briefly. No special action required.


Ahh ok, I missed the flash on the screen then, the button was green all of the time I was trying to press it.. great, thank you for clarifying it

Regards,

MICK
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 10:45am 04 Apr 2021
Copy link to clipboard 
Print this post

  Quote  5. Jrsoft, I spent so much time playing this I nearly had no time to browse the others, another flashback to TRS80. (I did have to turn the sound off after a while)

Thanks Mick. And this was exact the reason I built key M in  
But I remember many games from ancient time, where the music was after while not so enjoyable, so at least something to bring you back in time...
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 01:00pm 04 Apr 2021
Copy link to clipboard 
Print this post

Hi,
here is expanded and commented version of Tower of Hanoi, maybe could be for somebody interesting
'Tower of Hanoi, expanded (readable) version
'Made by JirSoft for Colour Maximite 1 & 2 BASIC Programming Challenge 2021
'
'This expanded version is exact the same as compact one, just better formated and some parts
'are moved to (logically) proper place (when they were outside of context because of space).
'Whole game was made for fixed MODE1 (800x600x8bpp), on the begin started as resolution
'independent, but later because of space constraints some display constants were wired-in.
'
'Music was added simply because I had few lines for it, my friend made simple asian score (so it's
'original!) and I have converted it to special format. I have found then, that I can use 2 voices
'(and I had space for it), but it was too late. So it's playing basic melody to left channel and
'1/3 of it's frequency to right channel. Anyway, it can be switched ON/OFF with M-key...

OPTION DEFAULT INTEGER
X1=135:X2=395:X3=655 'x positions of pillar 1, 2 and 3
cr=&hFFF0000:cy=&hFFFFF00:cw=&hFFFFFFF  'color constants for RED, YELLOW and WHITE
cb=RGB(NOTBLACK):cc=&hF0000FF           '(actually it's somewhere longer then RGB version)

tp=-1 ' previous second counter, used for time displa
frq=196 'lowest frequency for music routine

'music in game, du$ is duration (1 is basic timing, 2 is twice so long, any number 1-9 can be used)
'mu$ is melody, a=G3, b=A3 etc., hz$ are frequencies of the notess
du$="112211112211112211221122111122111122112211221111112112211111121122111111211221111112"
mu$="ihfhiklkhifhefdbedabihfhiklkhifhefdbedabklmimlkiopmklmkpomlkhiklmimlkiopmklmkpomlkhi"
hz$="196,220,247,262,294,330,349,392,440,494,523,587,659,698,784,880,988"
j=1 'pointer to current note
f1=1:f2=3 'frequency divider for left and right channel
p5=500 'length of note with duration 1 (=500ms), added delay to autoplay with LCTRL
rr=250:SETTICK rr,z,1 'start of playing interrupt routine, with rr=0 is music switched off

xc=400:yc=300 'coordinates of screen center
y=480 'position of base for pillars
y4=210:y1=271 'some pos constant reused more times
y2=599  'MM.VRES
y3=799  'MM.HRES (why y3 when is X-position?)
n=13 'game starts with autoplay of level 13 (highest)

'text scroller. Because later I have added black box before it, it doesn't need to be the same
'length, but I forget to save this space
pt=0 'relative Y position of current text
ps=0 'pointer to current string (0-6)
DIM jt$(6)=(" Made by JirSoft for  ","CMM PRG Challenge 2021","Max. 48x100 characters","","","","")
jt$(3)="Very simple game, but ":jt$(4)=" I learned new things ":jt$(5)="  and it was FUN...   "
jt$(6)="Music by JBmusics.com "

DIM d$(2) 'used as STACK for discs on pillars, first char ist the highest one (LEFT1 and MID2 is faster)
v=-1 'if v<0, no disc is prepared to be put somewhere (all are on pillars), otherwise disc # for play next
w=100 'autoplay wait-time (100ms)
'set MODE and prepare outline text for main banner
MODE 1:TEXT 400,2,"TOWER of HANOI","CT",5,2,cy:BLIT 2,2,2,0,796,64,,4
BLIT 2,2,2,4,798,64,,4:BLIT 2,2,0,2,798,64,,4:BLIT 2,2,4,2,798,64,,4:PAGE WRITE 1
CLS
TEXT 400,2,"TOWER of HANOI","CT",5,2,cr:PAGE WRITE 0:BLIT 0,0,0,0,800,600,1,4

c$="0000" 'start counter
tn=0 'when tn=0, time is not running
SETTICK 100,tm,2 'start of time interrupt routine

'draw help texts
COLOUR RGB(CYAN):?@(4,y+34)"You have to move ALL discs from pillar 1 to pillar 3 with help of ";
?"pillar 2. There is just one rule:":COLOUR cr:?@(228)"You CAN'T put BIGGER disc onto SMALLER one."
COLOUR cw:?@(0,540)"KEYS: 123 ... get/put disc from/to pillar";:?@(360)"Q ... QUIT game":?@(48);
?"B   ... BEST solution (LCTRL=slow)";:BOX 0,y,800,30,1,cw,cc:?@(360)"N ... NEW game"
?@(48)"+-  ... change number of discs";:?@(360)"M ... music ON/OFF";

u 'new game
x 'start autoplay
n=1:u 'after key restart game with level 1

'for this part I'm most proud of...
'it's main program routine, which checks keyboard and do proper call
ke$="123qnb+-m" 'all possible keys
f$="emmmquxhlr" 'routines for keys, e=EMPTY routine (when nothing was pressed)

DO
 fk=INSTR(ke$,LCASE$(INKEY$)) 'get lower case key position, when no key, fk=0
                              'fk is also reused for pillar number in move routine
 fn$=MID$(f$,fk+1,1) 'get routine name, +1 makes 'e' routine for nothing pressed
 CALL fn$ 'routine call
 'actually CALL MID$(f$,fk+1,1) will be shorter, but it doesn't work (why ???)
LOOP

SUB wk 'waiting for any key
 DO WHILE INKEY$=""
 LOOP
END SUB

SUB h 'increase level up to 13
 INC n,n<13 'smart way without IF...
 u 'new game
END SUB

SUB l 'decrease level up to 1
 INC n,-(n>1) 'smart way without IF...
 u 'new game
END SUB

SUB tm 'time interrupt routine (100ms)
 jd 'call scroller
 j1=(frq-196)/31 'height of audio display
 INC ti,tn 'increase tick (just when tn<>0)
 t2=(ti\10) MOD 60 'seconds of time
 BLIT 98,y+2,100,y+2,200,27 'move audio display
 rn=rn AND (KEYDOWN(0)=0 OR ti<10) 'if key is pressed and autoplay running (rn=1), stop it
 LINE 100,y+27-j1,100,y+27,1,cw 'audio level of current note
 PIXEL 100,y+27,cc 'remove this lower pixel (mainly needed when audio muted)
 t1=ti\600 'minutes of time
 BLIT 0,0,y3,0,1,66 'move main banner
 BLIT 1,0,0,0,y3,66 '

 'when seconds were changed, display time
 IF tp<>t2 THEN TEXT 791,y+4,STR$(t1,2,0,"0")+":"+STR$(t2,2,0,"0"),"RT",1,2,cy,cc:tp=t2
END SUB

SUB q 'quit
 qq 'show effect
 BOX 218,265,364,70,0,cc,cc:tx " Have a nice life ","  with your CMM2  "
 wk 'wait for key
 END
END SUB

SUB r 'music ON/OFF
 rr=250-rr
 frq=196 'for audio display (no level)
 SETTICK rr,z,1
END SUB

SUB rt 'remove 'PRESS KEY TO START'
 BOX 0,80,800,50,0,cb,cb
END SUB

SUB m 'make move, also very interesting
 'pg$='g' (GET) on begin, in succesfull GET is changed to 'p'
 'when nothing to get, change to EMPTY 'e' routine (reused)
 pg$=CHR$(ASC(pg$)-2*(pg$="g" AND d$(fk-1)=""))
 tn=1 'start running time
 CALL pg$,fk-1 'call 'g' (GET from pillar), 'p' (PUT to pillar) or 'e' (EMPTY)
 t 'test for finish
END SUB

SUB ds(px,py,ww,cc) 'draw disc on position px,py, wide ww
 IF cc THEN BOX px,py,ww,20,1,cb,cb:EXIT SUB 'when cc=1 then erase it
 BOX px,py,ww,20,1,cr,cy 'draw yellow disc
 'make some random red points for better effect
 FOR ix=2 TO ww-3
   FOR iy=2 TO 17 STEP 3
     IF RND>.9 THEN PIXEL px+ix,py+iy,cr
   NEXT
 NEXT
END SUB

SUB x 'autoplay
 u 'new game
 tn=1 'start time run
 TEXT 400,80," PRESS KEY TO START ","CT",4,2,cb,cy
 rn=1 'autplay is running
 a n,0,2,1 'call autoplay routine

 IF rn=0 THEN 'if autoplay was stopped (in tm routine)
   rt  'remove text
   u   'start new game
   EXIT SUB
 ENDIF 'this is added because of multiline expansion

 tn=0 'autplay was completed
 wk 'wait for key
 h ' mistake ?
 u ' new game
END SUB

SUB a(nn,s,dd,hh) 'recursive Hanoi solver,
                 'move nn discs from 's' to 'dd' over 'hh'

 IF rn*nn=1 THEN   'if running and nn=1, make last move and finish
   g(s)  'get disc from source pillar
   pp    'delay
   p(dd) 'put disc to destination piller
   pp    'delay
   EXIT SUB
 ENDIF 'this is added because of multiline expansion

 IF rn THEN   'if still not stopped, make recursion
   a nn-1,s,hh,dd 'recursion
   g(s)  'get disc from source pillar
   pp    'delay
   p(dd) 'put disc to destination piller
   pp    'delay
   a nn-1,hh,dd,s 'recursion
 ENDIF 'this is added because of multiline expansion
END SUB

SUB g(i)  'get disc from pillar i  (0-2 for pillar 1-3)
 v=ASC(LEFT$(d$(i),1))-48 'what disc is on this pillar?
 o=LEN(d$(i)) 'how many disc on this pillar?
 xx=140-v*10 'x position of the disc
 yy=y-o*20   'y position of the disc
 xs=135+i*260  'pillar position

 ds xx+260,130,v*20 'draw disc to temporary place
 ds xx+i*260,yy,v*20,1 'erase disc from pillar
 BOX xs,yy,10,20,1,cw,cc 'draw the pillar border (all 4)
 BOX xs+1,yy,8,20,1,cc,cc 'and remove top and bottom one

 d$(i)=MID$(d$(i),2) 'remove disc from stack
 pg$="p" 'now can be used PUT
END SUB

SUB t 'test for finishing of the level
 IF LEN(d$(2))<n THEN EXIT SUB 'not enough discs on pillar 3
 ts=1 'finish
 FOR i=1 TO n
   ts=ts AND ((ASC(MID$(d$(2),i,1))-48)=i) 'if not order, not finished yet
 NEXT i
 IF ts THEN wi 'if finish, call WIN
END SUB

SUB p(i) 'put disc to pillar i (0-2 for pillar 1-3)
 o=LEN(d$(i))+1 'how many discs WILL be on this pillar?
 IF o>1 THEN 'some disc(s) already on piller, check for size
   IF (ASC(LEFT$(d$(i),1))-48)<v THEN 'bigger on smaller not allowed
     EXIT SUB
   ENDIF 'this is added because of multiline expansion
 ENDIF 'this is added because of multiline expansion

 d$(i)=CHR$(v+48)+d$(i) 'add disc to stack
 ds 400-v*10,130,v*20,1 'erase temporary disc
 ds 140-v*10+i*260,y-o*20,v*20 'draw new one on pillar
 v=0 'nothing to GET
 pg$="g" 'so GET will be next

 INC mo 'increase move counter
 TEXT 10,y+4,STR$(mo,4,0,"0"),"LT",1,2,cy,cc 'show new move counter
END SUB

SUB u 'NEW game
 ti=0 'set time to 00:00
 tn=0 'time is not running
 tp=-1 'previous seconds

 BOX 0,y4,800,y-y4,0,cb,cb 'clear part of the screen

 ERASE d$ 'clear stack, shorter than d$(0)="":d$(1)="":d$(2)=""
 DIM d$(2)

 FOR i=1 TO n 'and fill pillar 1
   v=n-i+1 'fool PUT routine
   p(0) 'PUT disc
 NEXT

 rt  'remove text
 BOX x1,y4,10,y1-n*20,1,cw,cc
 BOX x2,y4,10,y1,1,cw,cc
 BOX x3,y4,10,y1,1,cw,cc

 mo=0 'move counter to 0000
 TEXT 9,y+4,c$,"LT",1,2,cy,cc 'and redraw it

 TEXT x1+5,180,"1","CT",3,,cw,cb 'pillar numbers
 TEXT x2+5,180,"2","CT",3,,cw,cb
 TEXT x3+5,180,"3","CT",3,,cw,cb

 TEXT 400,y+4," LEVEL "+STR$(n)+" ","CT",1,2,cy,cc 'level=n
END SUB

SUB z 'MUSIC play routine, called in interrupt
 dur=p5*VAL(MID$(du$,j,1)) 'calculate duration
 frq=VAL(FIELD$(hz$,ASC(MID$(mu$,j,1))-96,",")) 'and frquency of current note
 SETTICK dur,z,1 'prepare for next note
 PLAY TONE frq/f1,frq/f2,dur 'play note, both channels are different

 INC j 'next note
 INC j,-LEN(mu$)*(j>LEN(mu$))) 'repeat from j=1
 'I had some reason not to use MOD function here, but I don't know it anymore...
END SUB

SUB pp 'PAUSE
 wp=w+p5*(KEYDOWN(7)AND 2) '100ms + 500ms when LCTRL is pressed

 w1=TIMER 'wait in loop
 DO WHILE TIMER-w1<wp
 LOOP
 'I started with PAUSE wp, but this interrupted music play also
END SUB

SUB wi 'WIN (level finished)
 t9$="" 'prepare first row
 IF mo<2^n THEN 'finished in least number of moves
   t9$="  OPTIMALLY  " 'show it
   BOX 268,300,264,34,0,cr,cr 'and make border
 ENDIF 'this is added because of multiline expansion

 BOX 268,265,264,37,0,cr,cr:tx " You did it! ",t9$ 'show text
 tn=0 'stop time
 wk 'wait for key
 rt 'remove wait text
 h 'increase level
END SUB

SUB qq 'effect for QUIT
 FOR i=0 TO y3 STEP 5
   i1=65+i*.7
   LINE i,65,y3-i,y2,1,cy
   LINE 0,i1,y3,i1,1,cy
 NEXT
END SUB

SUB tx(t8$,t9$) 'text in 2 lines
 TEXT xc,yc,t8$,"CB",4,2,cb,cy
 TEXT xc,yc,t9$,"CT",4,2,cb,cy
END SUB

SUB jd 'SCROLL text
 BOX 547,y2-pt,252,25,0,cb,cb 'clear rest (without it, text will draw path of last line)
 TEXT y3,y2-pt,jt$(ps),"RT",2,,cy 'draw current string

 INC pt,(pt<50) 'increase position from 0 (bottom) to 50 (final pos)
 INC ps,(pt=50)*(ps<7) 'if final position, take next string
 INC pt,-50*(pt=50) 'if final position make position=0
 INC ps,-(ps>6)*7 'if string=7 then should be 0
END SUB

SUB e(i) 'EMPTY routine for no key pressed and also GET with no disc to GET
 pg$=CHR$(103+9*(v>0)) 'change from 'g' to 'p' when used in main loop
END SUB

Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 5058
Posted: 07:05pm 04 Apr 2021
Copy link to clipboard 
Print this post

In following the good example of jirsoft, here is the CMM2 version of the TLS game, as adapted by Vegipete, including comments.

' TLSS = Ten Line Sokoban with Sprites

' control by cursor keys-128 (128,129,130,131 => 0,1,2,3 => ^ V < >)
' playfield values 0=empty, 1=target, 2=block, 3=wall
' press "r" to redo the level, "n" to skip to the next level

'z   = size block
'x,y = position human
'e,g = new position human
'o,p = position onscreen
'n   = ascii value key
'b,c = direction human
'd   = done
'a$  = key pressed
'l,m = vars for decoding rooms
'i,j = counters
'k   = value field f(i,j)
'f() = playing field
't() = target locations for the boxes
's   = size playfield (sxs)
'q   = boolean (human on target)
'w   = level (0....nn)
'v$()= array to create sprites
'r$  = sprite color

' for CMM2 players this is needed
option legacy on

' defines of the playfield and block size
s=11 'a playfield is 11x11 in size, larger is possible but supplied levels must be tuned
z=15 'block size is 15x15 pixels. This allows a 11x11 playfield to be displayed in mode4


'-----------------------------------------GAME ENGINE-------------------------------------

Dim f(s,s),t(s,s),v$(16) 'define the arrays matching the playfield and sprite size

GoSub 1:Sprite Load "x.s" ' subroutine "1" creates the file "x.s" from data statements
' the the sprites are loaded into CMM memory
' there are 8 sprites: empty square, target, block, wall and
' 4 orientations of the Mario guy

'this is the init loop, you NEVER leave this loop, exit statements bring you back here, and a level is started
Do
Mode 4
Read x,y ' read (X,Y) location of Mario
For i=1 To s
Read a$ ' read the 11 columns that define a field as hexadecimal numbers
l=Val("&h"+a$)
For j=1 To s ' in each column read 11 values from the large hexadecimal number
f(i,j)=3 And l ' by masking bits, put this info in the playfield f(i,j)
t(i,j)=(f(i,j)=1) ' if the playfield value is 1 (target) the copy that value in t(i,j)
l=l\4 ' and shifting by logical divide (not numerical divide)
Next j,i

' array f(i,j) gets update at each move, and has no "memory". The only thing worth remmebering
' is the location of the targets. These are stored in the t(i,j) array, so when Mario walks over
' a target, the target location is restored from t(i,j)

' Now we draw the playfield. For code compactness all is redrawn, not only the changed tiles
Cls
Print w,,"TLS" ' the header, and level (w) are printed on top of the screen
f(x,y)=4 ' locate mario at (x,y)

'this is the main game loop, als long as you play this level, you neve leave this loop
Do
d=0 ' d is used to check if the level is complete (done).

'draw the playfield by copying the filed info f(i,j) to the screen using sprites
For i=1 To s
For j=1 To s
k=f(i,j) ' k is only used to compact the code
o=120+z*(i-6) ' o = X screen coordinate
p=99+z*(j-6) ' p = Y screen coordinate
Sprite write Int(k+1+((k=4)*n)),o,p ' put sprite
d=d+(k=1) ' increment d only if you draw a target
Next j,i
If d+q=0 Then ' if there is no target shown
w=w+1 ' go to the next level
Exit ' and exit this do-loop
EndIf

Do ' check if player presses a key
a$=Inkey$
Loop While a$=""

n=3 And Asc(a$) ' this section decodes arrow keys (128/129/130/131)
c=(n<2)*(n*2-1) ' to b(delta X, value -1/0/1) and c (delta Y, value -1/0/1)
b=(n>1)*(n*2-5)
e=x+b ' and addst these to (x,y), the location of Mario
g=y+c ' the new location of Mario will be (e,g) if the move is allowed

If f(e,g)=3 Then ' if the next location for Mario is "3" (a Wall) the don't move.
b=0:c=0
ElseIf f(e,g)=2 Then ' if the next location for Mario is a box, the check if the box can move
If f(e+b,g+c)<2 Then ' check if the new location of the box is < 2 (either mepty of a target)
f(e,g)=t(e,g) ' restore the target
f(e+b,g+c)=2 ' and put the box at it's new postion
Else
b=0:c=0 ' if the box can't move, then als stop the move on Mario
EndIf
EndIf

f(x,y)=t(x,y) ' restore Mario's old position to it's former state (target or floor)
x=x+b:y=y+c ' move Mario to it's new position (if b=0,c=0 the new position is the old position)
f(x,y)=4 ' put Mario's position in the array

q=t(x,y) ' q is used to prevent the game to stop if Mario is standing on a target

' user manual control actions
If a$="r" Then ' if "r" is pressed the same level is restarted
Exit ' the exit leaves the game loop and enters the init loop
EndIf
If a$="n" Then ' if "m" is pressed the next level is started
w=w+1 ' w = next level
if w>19 then w=19 ' make sure you cannot get past level 19
Exit ' the exit leaves the game loop and enters the init loop
EndIf
Loop
Restore ' this always restures to the first data statement of the program
For i=1To(s+2)*w ' and then dummy reads w levels (x,y and 11 field values) to arrive at the
Read a$ ' right data for the level you want to play next
Next i
Loop: ' this is the outer init loop


' these are the data statements of the 20 embedded levels. The first 2 values each line are (x,y) of Mario
' then there are 11 hex numbers. In these are build up from 2 bit values per cell
' &b00 = empty floor, &b01 = target, &b10 = box, &b11 = wall. Mario is not part of the map, but is drawn later.

' example FFC -> &hFFC = 11 11 11 11 11 00 = wall,wall,wall,wall,wall,empty
' the lsb is the vertically highest tile on the screen (empty in this example).

Data 9,2,FFC,3003,3003,30C3,FC0,,FFC,3217,3203,3003,FFC
Data 5,2,,,,FFFF,D5F3,CBC3,C023,C3CF,EC0C,C0FC,FFC0
Data 8,5,,,,FC0,DC0,CFF,FE87,D83F,FFB0,370,3F0
Data 6,3,,,3FF,3FF03,30FA3,30083,303FF,3F300,C3F0,C570,FFF0
Data 5,4,,,,FF0,C30,E3F,3DA3,3163,3163,3F03,3FF
Data 7,7,,,,FF00,C3F0,C03F,CE07,C897,C87F,C3F0,FF00
Data 6,6,,,3FF,3F03,3023,30E3,3163,317F,32F0,30C0,3FC0
Data 9,7,,,,,FFFF,C017,C897,FABB,C897,C017,FFFF
Data 7,6,,,FFFF,D503,D1B3,CB03,C23F,F30C,328C,3F0C,3FC
Data 7,6,,,,3FF0,303F,3053,3373,32B3,3C23,C0F,FFC
Data 8,2,,,,FF0,C3F,FC03,C273,CE23,C44F,FF0C,3FC
Data 6,2,,,,,FFFF,C303,C0B3,DA13,CDEF,C10C,FFFC
Data 2,3,FFC,3FC0C,30C8C,300BF,37F23,37203,37003,3723F,37F30,30030,3FFF0
Data 6,3,,,,3FFFC,321DC,32FCF,31323,36683,32043,31FFF,3FC00
Data 10,7,,FF,3FFCC3,300FE3,339003,331FEF,339C0C,3C1CEC,3F100C,30FFC,3FC00
Data 5,10,,,3FFFC0,3005C0,33F5FF,303003,32B0C3,3E3FCF,32000C,303F0C,3FF3FC
Data 5,3,3FC0,30FF,F023,C2C3,CC8F,C0BC,FF0C,F0C,D0C,D5C,FFC
Data 3,8,FFFFC,C3C0C,C008C,C0F0F,FC8C3,C803,FC3F,3570,3030,30F0,3FC0
Data 9,7,,,,3FFF,3003,3333,3003,FF3F,C2A3,C153,FFFF
'the last level cannot be finished per design, and therefore the game stops here.
Data 10,10,3FF003,3333FF,303003,0,3FF3FF,8030,3FF3FF,0,3FF3FF,307333,FC303


' This is a separate section of the program that "creates" the file "x.s" that is the sprite file
' for the floor, target,box and wall, and 4 instances of Mario (8 spritest total)
' this section uses a line number since that is the most compact form of a label.

1 Open"x.s" For output As #1 ' open the file
Print #1,"16,8" ' write the size and number of sprites

Do ' read the data statements in a loop until you hit the "s"
Read a$ ' the "s" signifies the start of the sprite data.
Loop Until a$="s"

' start of reading the actua sprite data. The data is RLE (run length encoded.
' example: a sprite line that has (16) value 11111333333333 it is encoded as 5193 (5 x "1" and 9 x "3")
' the v() array is used to store the decoded values, and is used specificly for repeating data.
For i=1 To 8 ' for all 8 sprites
For j=1 To 14 ' read the 14 values (the 16x16 spritest only use 14x14 data)
Read a$
b=Len(a$) ' the length is ised to distinguish between repeats and new data
v$(j)=""
If b=1Then ' a string length pf 1 (single digit) signifies a pointer to a previous
v$(j)=v$(Val(a$)) ' value, and that copy is made
Else
For k=1 To b Step 2 ' read RLE pairs from the string
n=Val("&h"+Mid$(a$,k,1)) ' n= the number (in hex value so a single digit stores a value 0..15
r$=Mid$(a$,k+1,1) ' r$ is the pixel color (0...7 for 8 color CMM1)
For l=1 To n ' add n instances of r$
v$(j)=v$(j)+r$
Next l,k
EndIf
Print#1,v$(j)+"  " ' add 2 spaces (transparent pixels) to the line
Next j
Print#1,Space$(16) ' at the end of 14 lines of sprite data add 2 lines of spaces
Print#1,Space$(16) ' transparent lines to fill the 16x16 field
Next i ' next sprite

Close#1 ' close the file, so it can be re-opened by Sprite Load
Restore ' put the data pointer to the first data statement, so the game can read
Return ' the playfield. Then return to the game


'this is the data for the 8 sprites
Data s ' indicates start of sprite data

Data E0,1,1,1,1,1,1,1,1,1,1,1,1 '14 x "0" = black, then 13 repeats of this same line
Data 1,E0,1,1,3016601630,4016401640,5016201650,602660,7,6,5,4,1,1,1,2210821022
Data 1,E0,1,1,1,1,1,1,1,1,3,1,1,4410441044,1,E0,14104410441024,4,3,1,1,3,4,4,3
Data 1,1,2730443027,2720642027,2710841027,27102445241027,271014154415141027
Data 27111564151127,2711841127,7,7,10171184111710,1031643110,2031443120,308130
Data 406140,406140,308130,2031443120,1031643110,10171184111710,2711841127,6,6
Data 27111564151127,271014154415141027,27102445241027,2710841027,2720642027
Data 2730443027,9750,A71130,507120,203415443110,1034156431,34158421,6,6,6,5,4,3
Data 2,1,5097,3011A7,207150,103144153420,3164153410,21841534,6,6,6,5,4,3,2,1

PicomiteVGA PETSCII ROBOTS
 
MauroXavier
Guru

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 11:27pm 04 Apr 2021
Copy link to clipboard 
Print this post

  bigmik said  7. Mauro, Your game brought me back to a similar TRS80 game that was a submarine and thoughts of a movie from the 1970's (fantastic world??? or similar name).

Hope Robot is directly inspired by the games Laser Gates and Fantastic Voyage from the Atari 2600. I loved these games in my childhood.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4302
Posted: 01:37pm 05 Apr 2021
Copy link to clipboard 
Print this post

Hi folks,

In the interests of accessibility for a wider audience I've made some updates to the repository: https://github.com/thwill1000/cmm2-basic-challenge

- added CMM2 version of "Ten Line Sokoban (with Sprites)"
- added uncrunched and commented versions of entries where they have been provided
- added basic READMEs for all entries reusing text provided by the authors where possible
- added a couple of CLS statements to the start of some of the entries that were running in Mode 1
- added a single-line (c) with attribution to the author at the start of each file for compatibility with the MIT License that the repository is under
    - the challenge rules allow the judges to "publish" the entries as we wish and using the MIT license means that your (c) and authorship are preserved without adding further limitations on use. MIT is prefered over a Public Domain "license" because PD license are apparently not acceptable in all juristictions.

If any of the authors have objections to the changes that I have made then please feel free to raise them with me.

If anyone has further suggestions as to changes I should make to the READMEs then let me know.

Jiri, I assume that you will ultimately provide links from https://www.cmm2.fun/ ? You probably want to wait until I've generated some screen-shots.

Best wishes,

Tom
Edited 2021-04-05 23:47 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 04:01pm 05 Apr 2021
Copy link to clipboard 
Print this post

Hi Tom,
maybe I will add separate category Challenges and put all into this (plus other relevant category as game etc.), so everybody can find it faster. And I will try to help with screenshots, but optimal will be screenshot from author - he/she can choose the best one.
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4302
Posted: 04:07pm 05 Apr 2021
Copy link to clipboard 
Print this post

  jirsoft said  And I will try to help with screenshots, but optimal will be screenshot from author - he/she can choose the best one.


Thanks Jiri, I wasn't going to go to any great effort for the screenshots, just grab stills from the YouTube video I am trying to record.

Tom
Edited 2021-04-06 02:17 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6269
Posted: 10:27pm 05 Apr 2021
Copy link to clipboard 
Print this post

Thanks all for the interesting code.
Thanks also for the work of collating the entries. It will make a useful resource.
@Volhout,
your code doesn't need OPTION LEGACY ON any longer. It was only needed when you had LINE and CIRCLE etc.

Jim
VK7JH
MMedit
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 10:47pm 05 Apr 2021
Copy link to clipboard 
Print this post

Tom,
for me the easiest way to make screenshot is to add on begin
ON KEY 157, screenshot
SUB screenshot
      SAVE IMAGE "SS"+LEFT$(TIME$,2)+MID$(TIME$,4,2)+RIGHT$(TIME$,2)
END SUB

and then press PrintScreen in the right moment...
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2949
Posted: 05:03am 06 Apr 2021
Copy link to clipboard 
Print this post

Hi All,

The prize of $50AU of PCBs for first was all that was on offer for under 10 entries, but I have decided to add a $15 second and $5 third place as well.
All prizes will be posted by standard mail shipping (in an envelope) worldwide.

My PCB repertoire may be found >>> HERE <<<.

I also hope that I/we do not offend anyone by comments or omissions that I/we may make in the judging process.

Honestly, I do not know how I am going to separate each of the entries as they are all fantastic in their own way.

I just want everyone to treat it all in the spirit that it was offered and all have fun.

Thank you all for participating now to have some fun evaluating.

Kind Regards,

Mick
Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<<
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1129
Posted: 05:23am 06 Apr 2021
Copy link to clipboard 
Print this post

  thwill said  You probably want to wait until I've generated some screen-shots.

Screenshot ability is built into Escape to the Green Hills already - press 's'. However, there is a typo. On line 15, the text "M4,M4" (about 2/3 across) needs to change to "M8,M6" to do a full screen shot, not just a 400 pixel square from the upper left corner.

The only extra trouble is that the BMP file saved does not accurately show the colours actually visible on screen - perhaps because the palette has been modified? Maybe a firmware limitation?
Visit Vegipete's *Mite Library for cool programs.
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 07:36am 06 Apr 2021
Copy link to clipboard 
Print this post

  Quote  The only extra trouble is that the BMP file saved does not accurately show the colours actually visible on screen - perhaps because the palette has been modified? Maybe a firmware limitation?

Is it 16bpp mode? When not, are the colors inaccurate by design...
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
Turbo46

Guru

Joined: 24/12/2017
Location: Australia
Posts: 1639
Posted: 07:42am 06 Apr 2021
Copy link to clipboard 
Print this post

@Jiri,
ON KEY 157, screenshot
SUB screenshot
     SAVE IMAGE "SS"+LEFT$(TIME$,2)+MID$(TIME$,4,2)+RIGHT$(TIME$,2)
END SUB

Thanks for that. It's exactly how I would have liked in done in the firmware (well almost)

Bill
Keep safe. Live long and prosper.
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 08:03am 06 Apr 2021
Copy link to clipboard 
Print this post

By the way, if you include GRF.INC and modify it a little:
#INCLUDE "GRF.INC"
ON KEY 157, screenshot
SUB screenshot
    GRF.saveBMP("SS"+LEFT$(TIME$,2)+MID$(TIME$,4,2)+RIGHT$(TIME$,2))
END SUB

you will get proper BMP with 8bpp or 16bpp (so much smaller)...
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4302
Posted: 02:48pm 06 Apr 2021
Copy link to clipboard 
Print this post

Hi folks,

So before "going all in" on producing a YouTube showcase for the Challenge (which I wouldn't publish until after the judging) I thought I had better do a test run and here it is:

   https://youtu.be/7Kgdy9SdORs

The final version may have marginally better editing, but I won't be any less wooden or any prettier and the recording quality is limited by my equipment (laptop webcamera and internal mic).

So my question to you all is whether this is a worthwhile thing for me to do for the CMM community or not ? - I've got plenty of other things I could be doing instead and have zero interest in being even a Z-list YouTuber.

Best wishes,

Tom
Edited 2021-04-07 00:58 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 7867
Posted: 04:39pm 06 Apr 2021
Copy link to clipboard 
Print this post

Pretty good, Tom. I liked the clever use of makeup to cover the blue skin too. :)
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 06:40pm 06 Apr 2021
Copy link to clipboard 
Print this post

Hi Tom,
it looks good. But it depends on amount of criticism my program will get  

Btw, can you add in your repo/extra TowerOfHanoi.zip (unpacked)? It's MIDI and MP3 source for "music", especially for Mick...  
Jiri
Napoleon Commander and SimplEd for CMM2 (GitHub),  CMM2.fun
 
     Page 5 of 8    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025