Simple time-waster game

Anything QL Software or Programming Related.
User avatar
dilwyn
Mr QL
Posts: 3056
Joined: Wed Dec 01, 2010 10:39 pm

Re: Simple time-waster game

Post by dilwyn »

Nice work, Steve! Just ran it on QPC2 - looks great.


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

Re: Simple time-waster game

Post by pjw »

Yes, nice work! :)


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
stevepoole
Aurora
Posts: 888
Joined: Mon Nov 24, 2014 2:03 pm

Re: Simple time-waster game

Post by stevepoole »

Hi Folks,

Old joke : A car factory exploded, so it started raining Datsun cogs.... Inspiration for a screen-saver !

UNZIP, LRUN or ESCape : Tested ok on QPC , (too slow on QLs). - Yet, 'elliptical' gears, and beware of the strobe effect...

Will try to adapt it for more intricate graphics output, after reorganising and optimising the code. Regards, Steve.
Cogs.zip
(717 Bytes) Downloaded 127 times


User avatar
dilwyn
Mr QL
Posts: 3056
Joined: Wed Dec 01, 2010 10:39 pm

Re: Simple time-waster game

Post by dilwyn »

Nice work Steve. Never thought of drawing cogs like that!
Just where do you get the inspiration for all these little programs?


User avatar
Mark Swift
Bent Pin Expansion Port
Posts: 86
Joined: Fri Jul 18, 2014 9:13 am
Location: Blackpool, Lancs, UK
Contact:

Re: Simple time-waster game

Post by Mark Swift »

Looks really nice...
dilwyn wrote: Thu Jun 27, 2024 11:45 am Just where do you get the inspiration for all these little programs?
I agree, I always look forward to downloading your code snippets Steve.

BTW, I've been playing around in SuperBASIC a little more than usual recently and noticed an anomaly with the RND statement.

Seeding the random number generator gives different results on SMSQ/E than on QDOS.
For example, this code consistently prints 15615 on QDOS, but prints 29498 on SMSQ/E.

RANDOMISE 1011:PRINT RND(0 TO 32767)

I was working on something that relied on getting the same sequence of random numbers from a specific seed value and I found that I was getting different results on the two systems. I don't suppose this is important if you expect RND to be truly random.

...I just wondered if this is documented anywhere, and if anyone knew whether this is by accident or design.


User avatar
NormanDunbar
Forum Moderator
Posts: 2459
Joined: Tue Dec 14, 2010 9:04 am
Location: Buckie, Scotland
Contact:

Re: Simple time-waster game

Post by NormanDunbar »

I think there's a change in the rnd code in SMSQ. When RND is called, the seed value has the high and low words multiplied by different values. To quote myself in Issue 8 of my irregular Assembly Language eMagazines:
...we grab hold of the random seed and start messing about with it to generate a new seed. The high word of the seed, in D0, is multiplied by 49,453 and the low word, in D4, by 28,973 neither of which are prime. Both are divisible by 7 if you don’t fancy working it out!

The resulting long word is D0 is swapped and added to D4 before D4 is incremented. This is our new random seed and is saved accordingly ready for the next call to the rnd routine.
Marcel commented on this and he's not sure why different multipliers are used, although he did wonder if it made things more random.

I suspect this is the reason for your anomalies.


Cheers,
Norm.


Why do they put lightning conductors on churches?
Author of Arduino Software Internals
Author of Arduino Interrupts

No longer on Twitter, find me on https://mastodon.scot/@NormanDunbar.
qbits
Gold Card
Posts: 251
Joined: Sun Dec 11, 2016 3:32 pm

Re: Simple time-waster game

Post by qbits »

Stev
Twinkle now Cogs what next… all very enjoyable.

This philosophical belief of minimalistic and uncluttered designs and using only what's essential to convey simplicity is effective at capturing attention and only focuses on the message - Stev I think you need to get out more… :D

QBITS


stevepoole
Aurora
Posts: 888
Joined: Mon Nov 24, 2014 2:03 pm

Re: Simple time-waster game

Post by stevepoole »

Hi Guys,
I suppose I am just curious about most things: Recently I was reading about the fractional numbers involved in astronomical clock-making.

All pretty complex stuff, so I tried simple designs, using the much decried 'Turtle graphics' to avoid mind-twisting trigonometrics.

This allowed a fairly fast animation on QPC2, just to demonstrate the power of what can be output with our excellent QL basics.

No doubt in engineering they use software to calculate gearing required to allow lathes to cut non-standard threads already....

At my advanced age, I won't be producing any more scientific applications code. But who knows ? Regards, Steve.


stevepoole
Aurora
Posts: 888
Joined: Mon Nov 24, 2014 2:03 pm

Re: Simple time-waster game

Post by stevepoole »

Hi again,
Many, many years ago somebody found and published a cure for the Random number generation problem.

Apparently, the RANDOMISE DATE function did not correctly reseed both words of the code, and a solution was given.

If I can find the remedy, I will report back again.... Steve.

___________________________________________________


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

Re: Simple time-waster game

Post by pjw »

You could probably use something like Cogs to make a nice "mechanical" clock. Time, calendar, moon phases.. ;)


Per
I love long walks, especially when they are taken by people who annoy me.
- Fred Allen
Post Reply