Page 2 of 6

Re: Simple time-waster game

Posted: Mon Jun 24, 2024 10:26 am
by dilwyn
Nice work, Steve! Just ran it on QPC2 - looks great.

Re: Simple time-waster game

Posted: Mon Jun 24, 2024 2:10 pm
by pjw
Yes, nice work! :)

Re: Simple time-waster game

Posted: Thu Jun 27, 2024 9:19 am
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 133 times

Re: Simple time-waster game

Posted: Thu Jun 27, 2024 11:45 am
by dilwyn
Nice work Steve. Never thought of drawing cogs like that!
Just where do you get the inspiration for all these little programs?

Re: Simple time-waster game

Posted: Thu Jun 27, 2024 9:56 pm
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.

Re: Simple time-waster game

Posted: Fri Jun 28, 2024 5:46 am
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.

Re: Simple time-waster game

Posted: Fri Jun 28, 2024 3:21 pm
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

Re: Simple time-waster game

Posted: Fri Jun 28, 2024 5:41 pm
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.

Re: Simple time-waster game

Posted: Fri Jun 28, 2024 5:48 pm
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.

___________________________________________________

Re: Simple time-waster game

Posted: Fri Jun 28, 2024 5:49 pm
by pjw
You could probably use something like Cogs to make a nice "mechanical" clock. Time, calendar, moon phases.. ;)