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 1 of 4 | |||||
Author | Message | ||||
Nimue Guru Joined: 06/08/2020 Location: United KingdomPosts: 367 |
Just caught this: https://www.callapple.org/programming/basic10liners-programming-contest-begins/?fbclid=IwAR1ZCyS3K4VCd8RW4-rRoq3JoywnC6tasPNjPGMdsNkqsMwk59XlOLaSwe8 I know the official competition is for 8bit variants -- but propose that we host our own for MMBasic - via the CMM2? Suggest: Category "CMM2-80": Program a game in 10 lines (max 80 characters per logical line, abbreviations are allowed). No INC flies and No CSubs are allowed. Category "CMM2-X": Program a game or application in 10 lines (max 80 characters per logical line, abbreviations are allowed). CScubs are allowed. No INC files are allowed. Not sure about "prizes" other than Kudos. Closing date: 31st March 2021 Voting: Community sourced via the forum. What do we think? Nim Entropy is not what it used to be |
||||
Rado Regular Member Joined: 27/11/2020 Location: CroatiaPosts: 59 |
This should be propagated on social media, too. Not sure if the community is big enough to produce enough contestants? (although, given the recent explosion of popularity, I might be proven wrong) |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 3585 |
Hi Nimue, I think this is very good to issue a challenge, it excites people and produces beautiful results. But honestly... MMBasic is not well suited for CMM2-80. It is designed for structured programming, not for writing compact crytpic one-liners (or ten-liners). If you want to write a complete game in 10 lines, BBC basic may be better suited where you can abbreviate each and every command with it's first letter, end then a period. (i.e. READ = R.). Then you can achieve a lot in 10 lines of 80 characters. And the second challenge CMM2-X is purely based on use of the CSUB. I guess you could write the complete game (i.e. DOOM) as a CSUB, I am sure matherp could, and simply call it in line 1 of the basic program. Maybe adapting the challenge may give more useable results. I will definitely follow this, it will be amusing to see the outcome. In 10 lines of 80 characters you may be able to write a simple "snake" variant. I managed this on a ORIC-1 in 23 lines of 40 characters (including music and a highscore list and 20 levels). The challenge at that time was to write a game where the complete listing could fit on ONE screen (no scrolling allowed). The ORIC-1 was at that time an excellent choice because it had a 24 line screen at 40 characters, and also supported abbreviation of commands. Commodore64 users where at a disadvantage... Regards, Volhout PicomiteVGA PETSCII ROBOTS |
||||
MauroXavier Guru Joined: 06/03/2016 Location: BrazilPosts: 303 |
Challenge accepted ;) |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 3585 |
I didnt see that one coming. The man of the most beautiful games... Ok, I will silence up. Good luck to you all.! PicomiteVGA PETSCII ROBOTS |
||||
Rado Regular Member Joined: 27/11/2020 Location: CroatiaPosts: 59 |
If ten lines are too short for a meaningful game (and, frankly, I've seen some of the entries in the original contest, many of them are nice but not exactly something to write home), maybe a 25x80 or 30x80 contest (one full page on magazine paper) would provide more impressive results. I'd opt in for any externalities such as bitmaps and audio files, too. |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2870 |
Lads, What about limiting the SIZE of the program? Best game in 10k -- or 1k (size to be determined) .. Regards, MICK Edited 2021-02-03 14:09 by bigmik Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
retepsnikrep Senior Member Joined: 31/12/2007 Location: United KingdomPosts: 131 |
1k size opens up possibilities. https://www.bbc.co.uk/news/technology-31028787 Gen1 Honda Insights. |
||||
Nimue Guru Joined: 06/08/2020 Location: United KingdomPosts: 367 |
I like that --> would fit into what I can do in class too. Still think there needs to be two versions: (a) "vanilla" CMM2 (nothing "clever" - read CSUbs) (b) "extreme" CMM2 (any and all clever things - CSUbs etc) (a) will give us mortals a chance!! Nim Entropy is not what it used to be |
||||
MauroXavier Guru Joined: 06/03/2016 Location: BrazilPosts: 303 |
I will give my 2 cents. I think the use of CSUBs would be breaking the rules of the "retro-feeling". The most fun part is to give the best with the least, and a CSUB can create give a great level of compression of the commands when targeting an 80x10 characters MMBasic program, however, a CSUB heavily based program practically would be a C language program "dressed" as an MMBasic program. I vote for a no CSUB contest. |
||||
LeoNicolas Guru Joined: 07/10/2020 Location: CanadaPosts: 449 |
I vote for pure basic, no csubs. |
||||
Volhout Guru Joined: 05/03/2018 Location: NetherlandsPosts: 3585 |
Size on STM32 or size on SD card ? I suggest size on STM32, that would allow you to add comments in the code that is stripped when downloading into the STM32. Edited 2021-02-04 01:08 by Volhout PicomiteVGA PETSCII ROBOTS |
||||
Nimue Guru Joined: 06/08/2020 Location: United KingdomPosts: 367 |
My starter for 10 - Rock, paper, scissors, lizzard, spock... Print "Enter ROCK(r), PAPER(p), SCISSORS(s), Lizzard(l), Spock(k)" Sub winner(card$,in_card$) win = win+1 Print card$,in_card$ Print "You Win" End Sub For x = 1 To 5 card_temp = Int(Rnd*5)+1 Select Case card_temp Case 1 card$="r" Case 2 card$="p" Case 3 card$="s" Case 4 cards$="l" Case Else card$="k" End Select Input "Enter your card";in_card$ deck$=card$+in_card$ Select Case deck$ Case "rr","pp","ss","ll","kk" tie=tie+1 Print card$,in_card$ Print "Draw" Case "rs", "pr","sp", "rl", "lk", "sl", "lp", "pk", "sr","ks" winner(card$,in_card$) Case Else loss=loss+1 Print card$,in_card$ Print "You lose" End Select Next x Print "Ties: ", tie Print "Win: ", win Print "Losses: ", loss Not pretty and no real error checking -- also the computers choice is random -- so no real strategy, but it rocks in a 964bytes. Nim Entropy is not what it used to be |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3027 |
Ok, here's my submission. Vegipete's ChemiChaos with 5 vials, 9 rounds to play, 25 lines, 1,661 bytes. The timing of the original post was just right for me--I was posting my porting of ChemiChaos to the F4, so I was familiar with game play and program structure and function. mode 7,8:r=rgb(white):load bmp "1.bmp":w=26:v=5:b=4:For i=1 To 8: Blit read i,x,y,w,w:y=y+w:Next i:Blit read 9,w,0,46,120: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 Play instructions: 1=Left, 2=Right, spacebar=pick/put, r=reload, x=next Here's the cheat sheet for variable/labels: ' sprite 1-5:balls; 6 up arrow; 7 down arrow; 8 blank ' a$ utility character ' b is number of balls per vial ' c$ utility character ' d$ saved ball layout for round or utility string ' e: reload label ' g: DATA label ' h$ 4-char string representing balls in vial ' i,j,k,l,m,n utility integers (really floats) ' p vial position of cursor ' r rgb(white) ' s$ scratch string ' t is array of balls by vial (vials,balls) ' u is 0 for no ball moving, 1 for moving ' v is number of vials ' w is width and height of ball, arrow, blank--26 pixels ' x is horizontal pixel position ' y is vertical pixel position ' z is color of moving ball, or zero And there's a bmp file for extracting sprites. That might violate the intent of the rules, but not the letter. ChemiChaos5Vials.zip "x" will move you to the next round. The code doesn't detect when you have successfully sorted the balls--you have to use "x". You can also use it to skips rounds which you haven't solved, so you can get the reward at the end (such as it is) unjustifiably. Developing this was . . . interesting. Not so much fun. As compressed, and with no meaningful variable names, it was harder to debug than it otherwise would have been. I could have made it more compact by assigning constants to variables, but that would have made it even more obscured. At one point I had to break lines and structure it before I got it to work. I don't think I'll try this again. ~ Edited 2021-02-06 01:36 by lizby PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3863 |
Neat, looks like MMBasic may one day be almost as good as C for being incomprehensible in ;-) FYI: I think some of your lines may have unnecessary trailing : on them. Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
lizby Guru Joined: 17/05/2016 Location: United StatesPosts: 3027 |
Not quite as obscure, but getting there. I left ":"s everywhere because I didn't know where the lines would eventually break to get as much code as possible in 80 characters. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3863 |
This is an MMBasic port of "TENLINER CAVE ADVENTURE" a ZX81 game by Einar Saukas and as somebody else's work doesn't qualify for entry, but nevertheless I enjoyed working on it and thought I would share. A text adventure in 10 lines each no longer than 100 characters: ' --------- ' 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 Best wishes, Tom Edited 2021-02-06 09:38 by thwill Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2870 |
Lads, Lasses, (Blokes and Sheilas), If this actually gets off the ground I am prepared to offer $50AU (excluding CMM2) worth of PCBs as a `reward' for the best program that meets the criteria. I will pay shipping where ever in the world (Standard non tracking postage). My repository of PCBs etc can be found >>> HERE <<< As you know, or most of you know, I cannot program my way out of a wet paper bag but I am keen to support the efforts of those who can. I will NOT take part in the judging so that will have to be left up to others to be nominated as judge (and executioner). Anyway... Just tossing it up there for consideration. We will need a SOLID set of rules first (Tom are you interested in being nominated to compile the Rules and being a judge?) Kind Regards, Mick Edited 2021-02-06 11:03 by bigmik Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
thwill Guru Joined: 16/09/2019 Location: United KingdomPosts: 3863 |
Hey Mick, That's a grand offer of a prize but unless some of the lurkers want to throw their hats into the ring this competition unfortunately looks like a slow burn . Maybe if 10 people actively express an interest in this thread then it's worth the effort (and in your case expense) of properly organising ? I'm flattered to be nominated and will happily serve if seconded (serve me right for having decided I wasn't going to participate properly so I could get some "work" done ). However wasn't this Nimue's idea, surely she should form part of any judging panel ? Best wishes, Tom Game*Mite, CMM2 Welcome Tape, Creaky old text adventures |
||||
Nimue Guru Joined: 06/08/2020 Location: United KingdomPosts: 367 |
Interested to see how this thread has developed. Upfront, my motivation was to set the bar low enough that my students might be motivated to enter (in some way) -- or at least to try. Hence the yes/no to CSUBs. I like the iteration to 1k as opposed to 10 lines as it is far more realistic. I'm not precious about ideas, but it would be fun to cast an "educational" eye over the entries - looking for "novel coding" techniques that could be used to explain XYZ to students. Recursion anyone? (for example). But as has been said, we need a critical mass of people interested for this to be more that a "nice" idea. If interest exists, I'll have a go at drafting some "rules" and post them here. N Entropy is not what it used to be |
||||
Page 1 of 4 |
Print this page |