1K hires: calculation game

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: 1K hires: calculation game

Post by dr beep »

I altered my initial idea, also due to a slower ZX81 than the ZX Spectrum.

I had a routine that should end in app. 20 sec, but
1) it didn't
2) it costed too much memory.

Now I made the routine to just bruteforce do all calculations and get interrupted by a timer after 20 sec.
This made the program fit in 1K. Only thing to alter now: the order of operands for better results.
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: 1K hires: calculation game

Post by dr beep »

Lost a few days now I found out that the bruteforcemethod isn't calculating enough combinations for good results.
So I need to find a way to use first method, but in less memory....

This is a tough one to fit 1K with solutiondisplay and proper solutions.
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: 1K hires: calculation game

Post by dr beep »

Pfeeeehhh,


I managed to fit the game in 1K and show a computersolution.
Found a calculationbug, repaired it and added display and then worked my way out of saving bytes to make it fit 1K.
Now I will releasing the lowres game soon.......
dr beep
Posts: 2060
Joined: Thu Jun 16, 2011 8:35 am
Location: Boxmeer

Re: 1K hires: calculation game

Post by dr beep »

Calculus Mazximus, the making of

Intro:
I always wanted to code the numbergame of "cijfers en letters".
With the rolling of FRUITMACHINESIMULATOR I thought it would make
a nice appearance on the ZX81.

The game should have a solvingroutine as well. However....
To calculate all solutions you would need to do
6x6x5x6x4x6x3x6x2x6x1 = 5.598.720 calculations.
Each number can be placed on each position and each operator is possible
between the numbers, where skipping number left or right are also 2 operands.
For a ZX81 this is just too much to do in approximately the 20 seconds available for calculation. Even a routine that would do that in order and be
Interrupted would make too less variations for a good result.
To get reasonable results within time and have a change of beating the computer
I altered the routine in using the first 4 numbers and the last 2 seperately.
This reduced the total calculations to 4x6x3x6x2x6x1x6x2x6x1, 373.248
15 times less than all calculations.
Still a lot of calculations in 20 sec (and too much for a ZX81 with screenupdate too) . On a ZX Spectrum this routines runs in 15 sec, on a ZX81 it needs much more time and I had to make multiply simpler but slower due to space butit will give reasonable solutions, even exact solutions.

Even with this method the game is hard to code in 1K.
The routine does a recursive calculation that creates a 60 bytes stack with a solution.
This solution must be copied too and shown as a result.
Besides this the player must be able to enter a result also.

Now let me tell you a trick.... on the ZX81 you are fooled.
The 5 seconds you get to write down the numbers before a number is drawn.....
The number is already drawn and the ZX81 takes a 5 sec headstart on you.
After showing you have still 20 sec, like the ZX81 but it has some result stored already. The routine is never ready in time, like on the ZX Spectrum so the calculation is cut off after 5+20 sec and then you enter your result.
Can you still beat the computer?

So the game fits 1K and lowres.
The hires version only shows the number in hires.
This effect is too small to also distribute a hires version.
The final version is therefore the 1K lowres game.

Johan "Dr Beep" Koelman
Post Reply