Help! My QL has entered the Matrix !!!

A place to discuss general QL issues.
User avatar
QLvsJAGUAR
Gold Card
Posts: 455
Joined: Tue Feb 15, 2011 8:42 am
Location: Lucerne, Switzerland
Contact:

Re: Help! My QL has entered the Matrix !!!

Post by QLvsJAGUAR »

Good to see that I'm not alone!

I for myself, crashed The Real Matrix this morning while hacking it!
Attachments
I for myself, crashed The Real Matrix this morning while hacking it!
I for myself, crashed The Real Matrix this morning while hacking it!


QL forever!
https://www.sinclairql.net/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Help! My QL has entered the Matrix !!!

Post by pjw »

qbits wrote:Never one for over sophistication this was my quicky Matrix Screen saver back in the day.<>
Sophistication is as sophistication does.. A little sophistication doesnt hurt, I find.

Code: Select all

100 randomise: REMark Matrix Screen Saver (TK2!)
102 ch=fopen("con_"):wsx%=scr_xlim(#ch):wsy%=scr_ylim(#ch)
104 cs=fopen("con_"):window#ch; wsx%, wsy%,0,0:cls#ch
106 gx%=int(wsx%/20)-1
108 REPeat lp
110  window#cs;10,wsy%,rnd(0 to gx%)*20, 0:if rnd(0 to 3): bput#cs; rnd(48 to 126): else: bput#cs; 32
112  SCROLL#cs;10:if inkey$(#ch;0)=chr$(27):exit lp
114 endrep lp


Per
dont be happy. worry
- ?
User avatar
QLvsJAGUAR
Gold Card
Posts: 455
Joined: Tue Feb 15, 2011 8:42 am
Location: Lucerne, Switzerland
Contact:

Re: Help! My QL has entered the Matrix !!!

Post by QLvsJAGUAR »

Gave it another go in my lunch break:

https://youtube.com/shorts/c_NU0dHt5ls?feature=share


Gesendet von iPhone mit Tapatalk


QL forever!
https://www.sinclairql.net/ - Go and get THE DISTRIBUTION & QL/E!
https://www.youtube.com/QLvsJAGUAR/community - Blog
https://www.youtube.com/QLvsJAGUAR - Dedicated QL videos
Sinclair, QL, ATARI, JAGUAR, NUON, APPLE, NeXT, MiST & much more...
Videos, pictures & information
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Help! My QL has entered the Matrix !!!

Post by pjw »

We had some good fun with FIZZBUZZ back in the day! ;) Howzabout an Xmas matrix challenge? Heres mine, for starters:
QL 512x256 version (193b)

Code: Select all

1 randomise:x=512:y=256:window#0;x,y,0,0:cls#0:paper 0:ink 4:rep lp:window 10,y,rnd(0,25)*20,0:if rnd(0,1):bput#1;rnd(48,126):else:bput#1;32:endif:scroll 10:if inkey$(0)=chr$(27):exit lp:endif
And the any-screen-size SMSQ/E version (203b) EX the bas!

Code: Select all

1 randomise:x=scr_xlim:y=scr_ylim:window x,y,0,0:cls:g=int(x/20)-1:open#1;scr:rep:window 10,y,rnd(0,g)*20,0:if rnd(0,1):bput#1;rnd(48,126):else:bput#1;32:endif:scroll 10:if inkey$(0)=chr$(27):exit:endif
Of course, the result should look "right" too, not only be short and fancy.


Per
dont be happy. worry
- ?
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Help! My QL has entered the Matrix !!!

Post by pjw »

No one playing? Well, its a free country and Im playing.

The rules I propose should be like a Miss World contest: The code,
like the bikini, should cover the basics, but be small enough to
maintain interest. The whole package should present a pleasing result,
but demonstrate that there is more there than just a pretty face.
We're looking for the winning code, not the coder, ie we want the
girl, not the parents!

I thought the original offering by thornsinclair was quite pretty. However, the
implementation doesnt scale well, so I re-jigged it a bit, and submit
this as my second offering:

Code: Select all

1 randomise:x=scr_xlim:y=scr_ylim:window x,y,0,0:cls:open#1;scr
2 g=int(x/20)-1:dim A(g):R:rep
3 t=0:k=rnd(g):sel on A(k):=0:c=7:=7:p=rnd(-7,-1):=remainder:p=rnd(7):c=4
4 window 20,y,k*20,0:INK c:AT RND(g),1:bput#1;rnd(60,110):scroll p
5 if rnd(30000)=0:t=25:R:endif:if inkey$(#cw;t)=chr$(27):exit:endif:endrep
6 def proc R:for i=0to g:A(i)=rnd(11)
This basically does the same job for SMSQ/E as the original does for
the QL, except in full screen.

The original "buchstabenausgabe" proc has become line 4, and there is
a new proc, R, to ReJig the program now and again so it doesnt become
stale (too quickly). I have also splashed out on RANDOMISE, which the
other "contenders" have deigned to dispense with, and an ESC clause
also, but have yet again omitted a QUIT since I usually run these
things from QD rather than using EX as one is supposed to.

Going by the FIZZBUZZ experience, I have no expectation of producing
the "winning" entry of my self-declared challenge - unless no one else
plays along.. As it looks to me now, I reckon my offerings are in the
top 90%! Beat that!


Per
dont be happy. worry
- ?
Tinyfpga
Gold Card
Posts: 252
Joined: Thu Sep 27, 2018 1:59 am

Re: Help! My QL has entered the Matrix !!!

Post by Tinyfpga »

pjw asks if if anyone is "playing", so I have played around with the code samples provided. I even tried and failed to write my own Matrix.
If I LRUN pjw's code it just mashes up the screen. It took me a while to get the code samples to work on my SMSQE setup:- see JPGs below.
The original code sample can just be seen running as a square of blue characters at the top.
matrix2.jpg
Matrix1.jpg
I had no idea that SBASIC could be used in such a terse way. So terse in fact, that neither I or my parser could understand the program.

Why might my SMS2 parser fail to parse SEL ON A(k):=0 and why does Matrix not run in the background?

The program runs so fast on my machine that I had to slow it down. I also adjusted the scroll rate. It looks good now.

The effect of pjw's code is impressive and I am determined to understand how it works. To this end I am going to convert it to a verbose form.


User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Help! My QL has entered the Matrix !!!

Post by pjw »

Tinyfpga wrote:pjw asks if if anyone is "playing", so I have played around
with the code samples provided.
Well, I thought there might be
a few sad old geezers out there, isolated from their families due to
Covid, who might be in need of a little cheering up this Yuletide..
Aparently there's only you and me ;)

Without knowing exactly which code you refer to its hard to say what
the problem might be. Perhaps we could number them in order of
appearance: 1 to 6.

Only 1, 2, and 4 are supposed to be RUN. 3 could be RUN, although it
doesnt tidy up after itself at the end.

3, 5, and 6 are all SBASIC programs and supposed to be EXecuted from
QD, but they can also be EXecuted from SBASIC. The problem with the
latter is that I removed the terminating QUIT instruction in 5 and 6
(hence the dangling, and unnecessary, terminating END IF (in 4 and 5),
which I left as bait for some sharp-eyed critic!))
Why might my SMS2 parser fail to parse SEL ON A(k):=0
I dont know. Does it? It may be that the SMSQ/E SBASIC parser has been
upgraded. Qlib wont have it either, nor SuperBASIC, but SBASIC thinks
its ok, which is very nice of it! Minerva? Dont know.
and why does Matrix not run in the background?
How do you mean? Which Matrix?

SMS2 may be rather different from SMSQ/E. I think Marcel did the
background updating, so that may not have found its way into SMS2.
Since 3-6 are designed to cover the whole screen, that means they
would stop if so much as a button popped up on top of it. In SMSQ/E
that doesnt happen.

To use as a screen saver you could use one of the full screen versions
with Cuedark. Then it would only present when the machine was idle,
and vanish the moment you wriggled your mouse or touched a key.
The effect of pjw's code is impressive and I am determined to
understand how it works. To this end I am going to convert it to a
verbose form.

The verbose from of 4 and 5 is 3! And 1 is the verbose form of 6.

There are basically only two Matrix paradigms here, presented with
four algorithms, in six programs!


Per
dont be happy. worry
- ?
User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Help! My QL has entered the Matrix !!!

Post by pjw »

My dyslexia got the better of me: I mixed up programs 3 and 4! 3 is the SuperBASIC one and 4 is the SBASIC version.
At least, I believe, Ive been consistent.


Per
dont be happy. worry
- ?
Tinyfpga
Gold Card
Posts: 252
Joined: Thu Sep 27, 2018 1:59 am

Re: Help! My QL has entered the Matrix !!!

Post by Tinyfpga »

Luckily I am not too sad, for I am currently in the small Swiss village of Lauenen, surrounded by the snowy mountains of the Bernese Oberland.
Tinkering with the various Matrix!!! programs, have revealed various characteristics of my SMS BASIC programming set up that need explaining.
I am going to list them in relation to the six programs and my feeble Matrix program at some later date. My struggle with programming might prove useful to other
recreational programmers who need cheering up.


User avatar
pjw
QL Wafer Drive
Posts: 1286
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Re: Help! My QL has entered the Matrix !!!

Post by pjw »

I guess I could do with some cheering up having just watched the fourth instalment of the Matrix trilogy :?
Ok, it wasnt that bad, but nothing like the first lot. Perhaps a second viewing will do it better justice.

One thing became obvious: None of my programs look as good as the real thing! But then again, if it had been important I might have tried harder. For this exercise, a cursory nod in that direction will have to suffice. And for my amusement, doing it in as few instructions as possible seemed like a nice challenge. So heres the latest, 142 bytes:

Code: Select all

x=scr_xlim:y=scr_ylim:window x,y,0,0:cls:g%=x/12-1:open#1;scr:rep:window 10,y,rnd(g%)*12,0:scroll s:if rnd(1):bput#1;rnd(31,99):s=5:else:s=15
No refinements or sophistication. EX to start, CTRL 5 to pause, <BREAK> followed by QUIT to quit. SBASIC only.


Per
dont be happy. worry
- ?
Post Reply