Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 09:26 29 Mar 2024 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 : BASIC10Liners - challenge for CMM2

     Page 2 of 4    
Author Message
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1081
Posted: 06:44pm 07 Feb 2021
Copy link to clipboard 
Print this post

I'm putting together something in 10 (or fewer) lines ... in Base 48.

Why that size?

The built-in CMM2 editor with all defaults is 48 lines of 100 characters. So the ENTIRE program is visible at once as a single page. No scrolling up/down/left/right.
Visit Vegipete's *Mite Library for cool programs.
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 705
Posted: 07:47pm 07 Feb 2021
Copy link to clipboard 
Print this post

> So the ENTIRE program is visible at once as a single page.

I always try to attain that ...
Count me in .... Preparing a work ( play ) space .
my site
 
bigmik

Guru

Joined: 20/06/2011
Location: Australia
Posts: 2861
Posted: 04:58am 08 Feb 2021
Copy link to clipboard 
Print this post

Hi All,

@Tom,

I nominated you as you seemed to have a desire to "cross the t's and dot the i's" with your Welcome tape rules.. I figured you might enjoy creating the rules for a competition..

I don't think programs should be submitted BEFORE the rules are set in concrete..

I am amiable to any rule constraints proving the consensus agrees that they are FAIR and reasonable..

I would personally prefer to not see C-Subs etc as many cant speak in C (such as myself) and I would prefer as level a playing field as possible.. However it depends on the groups opinions...

As to generous offer... I am flattered but it is not entirely so.
I have heaps of PCBs that I have designed over the years for various flavours of mites and honestly, the market has dropped away dramatically in recent times.
So they can sit here on my desk or be put to some use.. I prefer that someone can use them.

On that subject I am always willing to offer freebies to those in need or students if they only ask (just pay postage)

I am happy to even offer a 2nd and 3rd prize if we can attract enough entries.. or increase the value of the offering(s).

Regards,

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

Joined: 27/11/2020
Location: Croatia
Posts: 59
Posted: 09:48am 08 Feb 2021
Copy link to clipboard 
Print this post

48x100 would capture the spirit of such competitions. and I guess no CSUBs should be allowed because they provide unfair advantage to more advanced coders.
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3807
Posted: 01:27pm 08 Feb 2021
Copy link to clipboard 
Print this post

Re rules:

   - I would say that no CSUBs should be a given.
   - 48x100 sounds like the maximum we should be considering, I'd be inclined smaller
personally, but see next comment
   - We should probably consider not allowing any asset files (sorry @lizby)
       - it's presumably a programming competition not a graphics/sound competition
       - I'm pretty confident 4.8K is more than enough to write a simple runtime in, then you just load a practically unlimited size actual (non BASIC) program from an asset file. (You might use a simple "RISC" runtime to bootstrap a larger runtime to run the actual program, it would be slow, but you could bootstrap some impressive text games that way.)

Best wishes,

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3422
Posted: 01:34pm 08 Feb 2021
Copy link to clipboard 
Print this post

When the dust settles on the rules, I think I will join the challenge. I will however use a CMM1 (don't have a CMM2 yet). By putting the rules to editor size (48x100 characters) the CMM1 can also compete (well 48 x 80 I guess..).

There is one disadvantage using 48x100 max: this will lead to unreadable code.
If you decide for 2k or 5k size on the STM32 people can still write readable code in the editor, since the code will be stripped of it when downloaded. And a "memory" will reveal the size in the STM.

Volhout
PicomiteVGA PETSCII ROBOTS
 
hitsware2

Guru

Joined: 03/08/2019
Location: United States
Posts: 705
Posted: 02:31pm 08 Feb 2021
Copy link to clipboard 
Print this post

I'm missing something  
What happened to 10 lines ? as :


10 statements
20 statements
30 statements
40 statements
50 statements
60 statements
70 statements
80 statements
90 statements
100 statements

Plenty readable .....
Edited 2021-02-09 00:33 by hitsware2
my site
 
Volhout
Guru

Joined: 05/03/2018
Location: Netherlands
Posts: 3422
Posted: 02:45pm 08 Feb 2021
Copy link to clipboard 
Print this post

@hitsware

10 lines in the editor means the whole program will be just the 10 lowest lines in this. No one will have a clue what is going on.


  thwill said  

' ---------
' BACKSTORY
' ---------
'
' As a young warrior apprentice, you have been chosen by the village elders to
' seek out the evil menace that lurks in some nearby caves. Once found, use any
' means at your disposal to defeat it... Good luck on your quest!
'
' --------
' COMMANDS
' --------
'
' This adventure recognizes the following commands:
'
'     NORTH
'     SOUTH
'     EAST
'     WEST
'     INVENTORY
'     LOOK
'     LOOK <object>
'     GET <object>
'     OPEN <object>
'     KILL <object>

x$="100Cannot doYou walk Opened   Closed   A Sword  A Key    Nothing  A Chest  A Dragon A Corpse "
Cls : Do : Print "You are in a " Mid$("CavePit HallLake",xi(1)*4-3,4) : Input u$ : u$=LCase$(u$)
m=2*(u$="north")*(xi(1)<3)-2*(u$="south")*(xi(1)>2)+(xs$(1)+u$="2west")-(xs$(1)+u$="3east")
a=(3+xi(2)+2*(xi(3)=2))*(xs$(1)+u$="2look chest")+(11+(xi(3)=2))*(xs$(1)+u$="3kill dragon")+(m<>0)
a=a+(5+xi(1))*(u$="look")+(6-xi(3))*(u$="inventory")+(6-(xi(3)=0))*(xs$(1)+u$="4look corpse")
b$=Left$(x$,3) : a=a+10*(b$+u$="400get key")+2*(b$+u$="201open chest")+10*(b$+u$="211get sword")
pk(1,xi(1)+m) : pk(2,xi(2)+(a=2)) : pk(3,xi(3)+(a=10))
Print Mid$(x$+"Taken    You Died You Won. ",4+a*9,9) : Loop While a<11
Function xi(i) : xi=Val(xs$(i)) : End Function : Function xs$(i) : xs$=Mid$(x$,i,1) : End Function
Sub pk(i,a) : Poke Var x$,i,Asc("0")+a : End Sub


Edited 2021-02-09 00:46 by Volhout
PicomiteVGA PETSCII ROBOTS
 
MauroXavier
Guru

Joined: 06/03/2016
Location: Brazil
Posts: 303
Posted: 05:12pm 08 Feb 2021
Copy link to clipboard 
Print this post

I suggest create two categories, both with no CSUB and no external assets:

- 100 characters x 10 lines
- 5K full size

Sincerely, I prefer only a 10x100 contest. I love the idea of "make the most with the least".
Edited 2021-02-09 03:13 by MauroXavier
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 2989
Posted: 05:25pm 08 Feb 2021
Copy link to clipboard 
Print this post

  thwill said  We should probably consider not allowing any asset files (sorry @lizby)


Fair enough. This 8 lines longer, but with no .bmp file.

mode 7,8:w=rgb(white):bk=rgb(1,1,1):dim cr(5):cr(0)=rgb(green):
cr(1)=rgb(red):cr(2)=rgb(cyan):cr(3)=rgb(yellow):cr(4)=rgb(blue)
cls w:x=13:y=13:for i=0 to 4:circle x,y,12,,,cr(i),cr(i):y=y+26:next i
line 13,134,13,154,2,bk:line 13,134,4,143,,bk:line 14,134,22,142,,bk
line 13,160,13,180,2,bk:line 13,180,4,171,,bk:line 14,180,22,170,,bk
line 30,2,72,2,2,bk:line 34,4,34,112,2,bk:line 67,4,67,112,2,bk:
circle 51,112,17,,,bk:circle 51,112,16,,,bk:box 36,90,31,22,,w,w
for i=1 to 9: on error skip: blit close i: next i
r=w:x=0:y=0:w=26:For i=1 To 8:Blit read i,x,y,w,w:y=y+w:Next i
Blit read 9,w,0,46,120:
x=37:y=16:for i=1 to 4:blit write i,x,y,w,w:y=y+w:next i:v=5:b=4:CLS r:
d$="ChemiChaos/5 Vials vegipete/lizby":text 160,0,d$,c,1,,rgb(red),r:
d$="1=L,2=R;' '=pick/put,r=reload,x=next":text 160,10,d$,c,1,,rgb(red),r:
For j=0 To 4:Blit write 9,j*50,100:next j:dim t(5,4):restore g:
Do:d$="":For i=0 To 3:read l:h$=Str$(l):d$=d$+h$:if l=0 then:cls r:font 5:
s$="S A F E !":text 60,100,s$,,,,rgb(green),r:do:loop:endif:next i:
e: k=1:x=10:For i=0 To 3:h$=mid$(d$,i*4+1,4):for j=1 to b:
c$=mid$(h$,j,1):l=val(c$):t(k,j)=l:t(5,j)=0:blit write l,i*50+10,82+j*w
next j:k=k+1:Next i:blit write 6,9,70:p=1:u=0:do:do:c$=inkey$:
loop until c$<>"":if c$="1" then:if x>50 then: blit x,44,x-50,44,26,52:
box x,44,26,52,0,r,r:x=x-50:p=p-1:endif:elseif c$="2" then:
if x<200 then: blit x,44,x+50,44,26,52:box x,44,26,52,0,r,r:x=x+50:p=p+1:endif
elseif c$="r" then:box 0,44,320,52,,r,r:box 210,108,w,w*4,0,r,r:goto e:
elseif c$="x" then:box 0,44,320,w*2,0,r,r:box 210,108,w,w*4,0,r,r: exit :
elseif c$=" " then:if u then:for i=1 to b:n=t(p,i):if n>0 then:exit for:endif:
next i:if n=z or i=5 then:i=i-1: if i>0 then:t(p,i)=z:blit write z,x,82+i*w
blit write 8,x,44: blit write 6,x,70:u=0:endif:endif:else:for i=1 to b:
z=t(p,i):if z<>0 then:t(p,i)=0:x=(p-1)*50+10:blit write z,x,44:
blit write 7,x,70:blit write 8,x,82+i*w:u=1:exit for:endif:next i:endif:
endif:loop:loop:
g: Data 2321,1412,4412,4333,4232,5235,2443,3554,3124,2121,2444,3331,1224,4232
Data 4311,4133,2141,4333,3242,4121,1314,3424,3231,2142,3233,4141,1241,2243
Data 3324,4421,1123,2431,4552,2444,3255,3332,2422,1434,3313,1241,0

Unfortunately, I haven't been able to test it (new drawn sprites tested on F4)--my CMM2 is in the barn, and we had 10+ inches of snow last night--not navigable for me.

(I'm ignoring what you said about "not a graphics/sound competition".)

(And I hope I haven't stepped on vegipete's toes by bastardizing his fine game.)
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1081
Posted: 07:04pm 08 Feb 2021
Copy link to clipboard 
Print this post

  lizby said  (And I hope I haven't stepped on vegipete's toes by bastardizing his fine game.)

Are you kidding? I think it's awesome!
Your latest version doesn't quite work:
line 11: BLIT WRITE doesn't want width and height parameters
(Actually, I'm not sure why line 11 is there at all, only last 2 statements seem to matter?)

line 10: BLIT READ region is slightly off: "Blit read 9,w+3,0,45,130"

Any reference to BLIT WRITE 6,7 and 9 needs an extra parameter ",0"

I never get the "S A F E !" message. Is that expected?

I suppose your version needs a name. "MiniChaos" seems inappropriate, as the program itself is complete chaos!  

Fixes:
mode 7,8:w=rgb(white):bk=rgb(1,1,1):dim cr(5):cr(0)=rgb(green):
cr(1)=rgb(red):cr(2)=rgb(cyan):cr(3)=rgb(yellow):cr(4)=rgb(blue)
cls w:x=13:y=13:for i=0 to 4:circle x,y,12,,,cr(i),cr(i):y=y+26:next i
line 13,134,13,154,2,bk:line 13,134,4,143,,bk:line 14,134,22,142,,bk
line 13,160,13,180,2,bk:line 13,180,4,171,,bk:line 14,180,22,170,,bk
line 30,2,72,2,2,bk:line 34,4,34,112,2,bk:line 67,4,67,112,2,bk:
circle 51,112,17,,,bk:circle 51,112,16,,,bk:box 36,90,31,22,,w,w
for i=1 to 9: on error skip: blit close i: next i
r=w:x=0:y=0:w=26:For i=1 To 8:Blit read i,x,y,w,w:y=y+w:Next i
Blit read 9,w+3,0,45,130:
x=37:y=16:for i=1 to 4:blit write i,x,y:y=y+w:next i:v=5:b=4:CLS r:
d$="ChemiChaos/5 Vials vegipete/lizby":text 160,0,d$,c,1,,rgb(red),r:
d$="1=L,2=R;' '=pick/put,r=reload,x=next":text 160,10,d$,c,1,,rgb(red),r:
For j=0 To 4:Blit write 9,j*50,100,0:next j:dim t(5,4):restore g:
Do:d$="":For i=0 To 3:read l:h$=Str$(l):d$=d$+h$:if l=0 then:cls r:font 5:
s$="S A F E !":text 60,100,s$,,,,rgb(green),r:do:loop:endif:next i:
e: k=1:x=10:For i=0 To 3:h$=mid$(d$,i*4+1,4):for j=1 to b:
c$=mid$(h$,j,1):l=val(c$):t(k,j)=l:t(5,j)=0:blit write l,i*50+10,82+j*w
next j:k=k+1:Next i:blit write 6,9,70:p=1:u=0:do:do:c$=inkey$:
loop until c$<>"":if c$="1" then:if x>50 then: blit x,44,x-50,44,26,52:
box x,44,26,52,0,r,r:x=x-50:p=p-1:endif:elseif c$="2" then:
if x<200 then: blit x,44,x+50,44,26,52:box x,44,26,52,0,r,r:x=x+50:p=p+1:endif
elseif c$="r" then:box 0,44,320,52,,r,r:box 210,108,w,w*4,0,r,r:goto e:
elseif c$="x" then:box 0,44,320,w*2,0,r,r:box 210,108,w,w*4,0,r,r: exit :
elseif c$=" " then:if u then:for i=1 to b:n=t(p,i):if n>0 then:exit for:endif:
next i:if n=z or i=5 then:i=i-1: if i>0 then:t(p,i)=z:blit write z,x,82+i*w
blit write 8,x,44: blit write 6,x,70:u=0:endif:endif:else:for i=1 to b:
z=t(p,i):if z<>0 then:t(p,i)=0:x=(p-1)*50+10:blit write z,x,44:
blit write 7,x,70:blit write 8,x,82+i*w:u=1:exit for:endif:next i:endif:
endif:loop:loop:
g: Data 2321,1412,4412,4333,4232,5235,2443,3554,3124,2121,2444,3331,1224,4232
Data 4311,4133,2141,4333,3242,4121,1314,3424,3231,2142,3233,4141,1241,2243
Data 3324,4421,1123,2431,4552,2444,3255,3332,2422,1434,3313,1241,0

Visit Vegipete's *Mite Library for cool programs.
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 2989
Posted: 07:28pm 08 Feb 2021
Copy link to clipboard 
Print this post

Thank you, vegipete. I forgot that while BLIT WRITE on the F4 (and Plus and eXtreme and H7) requires the width and height, on the CMM2 it has remembered how they were READ, and so doesn't require those.

I would expect the "S A F E !" message to appear (e.g., if you keep pressing "x"), but maybe I missed something, working blind without my CMM2.

You're right about line 11--that was left over from my testing on the F4.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3807
Posted: 07:28pm 08 Feb 2021
Copy link to clipboard 
Print this post

If comments are not to be counted against any limits then extracting and executing code written inside comments ist verboten .

Tom
Edited 2021-02-09 05:29 by thwill
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
elk1984

Senior Member

Joined: 11/07/2020
Location: United Kingdom
Posts: 227
Posted: 07:32pm 08 Feb 2021
Copy link to clipboard 
Print this post

  retepsnikrep said  1k size opens up possibilities.

https://www.bbc.co.uk/news/technology-31028787


Reminds me of this
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 5867
Posted: 08:15pm 08 Feb 2021
Copy link to clipboard 
Print this post

@lizby
In "next i" the "i" is usually not required.
That's 2 bytes per loop saved.

It's also something I would normally never suggest doing.

Jim
VK7JH
MMedit   MMBasic Help
 
Paul_L
Guru

Joined: 03/03/2016
Location: United States
Posts: 769
Posted: 06:39am 09 Feb 2021
Copy link to clipboard 
Print this post

Next WHAT!

for i-1 to 10:for j=1 to 100:'do something:next j:next i 'controls step variable
for i-1 to 10:for j=1 to 100:'do something:next j, i 'also controls step variable
for i-1 to 10:for j=1 to 100:'do something:next:next 'doesn't controls step variable

for i-1 to 10:for j=1 to 100:'do something:next 'j:next 'i 'what the heck is that!

A limitation of the basic REM or "'" is that it causes the interpreter to stop reading the line and ignore everything after. But when the line concatenation character ":" is inserted the "'" doesn't respect it.

If the inline "'" caused later characters to be ignored until the [(end of line) OR (a line concatenation character ":")] it would be more flexible. You could save the extra bytes in code and speed it up at the same time.

It's sort of like Wayne Ratliff's idea to allow delimiting pairs to be (), {}, [], or even <> interchangeably. You can visually identify the pairs more reliably, and an interpreter, pre-processor or full compiler can identify the pairs more reliably, but it would not necessarily add to the size of any compiled or assembled code.

Paul in NY
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 3807
Posted: 09:43am 09 Feb 2021
Copy link to clipboard 
Print this post

@Nimue, in an effort to move things forward and actually move this competition forward I've sent you a PM, you may not have noticed that TBS has that facility ;-)

Tom
Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 367
Posted: 10:02am 09 Feb 2021
Copy link to clipboard 
Print this post

  thwill said  @Nimue, in an effort to move things forward and actually move this competition forward I've sent you a PM, you may not have noticed that TBS has that facility ;-)

Tom


Missed that -- got it now.

You have a DM!!

N
Entropy is not what it used to be
 
Nimue

Guru

Joined: 06/08/2020
Location: United Kingdom
Posts: 367
Posted: 11:32am 09 Feb 2021
Copy link to clipboard 
Print this post

@thwill  >> sent link to GoogleDoc with starter rules for 10....

N
Entropy is not what it used to be
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3641
Posted: 11:36am 09 Feb 2021
Copy link to clipboard 
Print this post

  Paul_L said  It's sort of like Wayne Ratliff's idea to allow delimiting pairs to be (), {}, [], or even <> interchangeably. You can visually identify the pairs more reliably, and an interpreter, pre-processor or full compiler can identify the pairs more reliably, but it would not necessarily add to the size of any compiled or assembled code.

Paul in NY

Or the bracketed pairs in Algol68 LOL

John
 
     Page 2 of 4    
Print this page
© JAQ Software 2024