Game score

Anything QL Software or Programming Related.
Post Reply
User avatar
pjw
QL Wafer Drive
Posts: 1299
Joined: Fri Jul 11, 2014 8:44 am
Location: Norway
Contact:

Game score

Post by pjw »

I love maths! Sadly, Im terrible at it! Im hoping someone might help:
Im working on a game - I prefer not to give too much away right now,
so lets just say its like a puzzle. My problem is with the scoring.

The game is based on a grid and to solve the puzzle the fewer tries
the better. But the difficulty of solving the puzzle increases with
the size of the grid. The perfect score would be one try for each cell
of the grid (but that would have to be the result of pure luck!) There
is no absolute worst case as if one wilfully tries not to solve it one
could keep trying forever. But to put a figure on it, I suggest the
worst possible score would be the same as the cell count squared.

Ie, with a 5 X 5 grid the perect score is 25, and the worst score 625.

However, Id like to compress scores into an absolute, linear, range of
between 0..100, with 100 being the perfect score and zero being
rubbish. (The Richter Scale is an example of the sort of thing I have
in mind.) This to allow an equal comparison between easy games, ie
smaller grids with success in a few tries, compared to larger grids,
which require many more tries, not only because the grid has more
cells, but because the number of permutations increases.

It doesnt seem to me that the difficulty increases exponentially with
grid size, (at least not within the range of possible grid sizes
relevant here) though, more than merely linearly. And this may be what
confuses me, and which may make the question impossible to answer: I
cant say for sure how grid size affects difficulty. (I could show data
from some real-life results if that might help..)

Does anyone recognise a pattern here? Is there a formula that can
achieve what I want?


Per
dont be happy. worry
- ?
User avatar
Pr0f
QL Wafer Drive
Posts: 1300
Joined: Thu Oct 12, 2017 9:54 am

Re: Game score

Post by Pr0f »

almost like a root mean squared value of tries / grids to give a value of between 0 and 1, where 1 would give 100, and higher values of tries would tend towards 0 so 100 * sqrt ((1/tries) * gridsize^2)

for gridsize of 5, with 25 tries that would give 100

For gridsize of 5 with 50 tries that would give 70.7

for gridsize of 6 with 50 tries that would give 84.8

for gridsize of 5 with 625 trues that would give 20 (probably too much)

So I am guessing you may need a progressive 'fudge' factor with increasing values of tries to take away from the result to give 0-100 range


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

Re: Game score

Post by pjw »

A good, honest attempt there Pr0f. Thank you! I'll have to try it out
for a bit to see if it fits the experience.

Below is some real-life data in Abacus export format using your
formula for the score. It looks plausible..

Yet, Im open for refinements or further ideas.. :)

- Jan 2021 -
============

Code: Select all

"date","cells","tries","score"
19,64,132,55.70
19,90,145,74.74
19,90,245,57.50
20,8,7,30.24
20,8,4,40.00
20,64,157,51.08
20,54,66,66.47
20,90,284,53.41
20,40,69,48.15
20,64,92,66.72
20,80,192,57.74
20,64,156,51.24
20,44,65,54.58
20,44,98,44.45
20,44,71,52.22
20,44,76,50.47
20,44,65,54.58
20,44,97,44.68
20,44,71,52.22
20,64,113,60.21
21,40,111,37.97
21,8,6,32.66
21,8,5,35.78
21,64,146,52.97
21,80,120,73.03
21,80,178,59.96
22,64,153,51.74
22,64,160,50.60
22,54,97,54.83
22,54,80,60.37
23,40,74,46.50
23,40,97,40.61
23,40,79,45.00
23,90,301,51.88
24,64,97,64.98
24,64,206,44.59
24,54,57,71.52
24,54,78,61.14
26,64,161,50.44
26,54,74,62.77
26,80,152,64.89
30,64,147,52.79
30,8,6,32.66


Per
dont be happy. worry
- ?
User avatar
mk79
QL Wafer Drive
Posts: 1349
Joined: Sun Feb 02, 2014 10:54 am
Location: Esslingen/Germany
Contact:

Re: Game score

Post by mk79 »

Sounds to my tired brain like you want some logarithms thrown in there. Try "score = (2 - ln(tries) / ln(cells)) * 100" for example. If < 0 set to 0. The "2" can be changed to calibrate the range, as-is it's calibrated for the square worst case (625 on 5*5 grid) in your example.
20,8,4,40.00
Means you solved 8 cells with 4 tries? I don't understand.


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

Re: Game score

Post by pjw »

mk79 wrote:Sounds to my tired brain like you want some logarithms thrown in there. Try "score = (2 - ln(tries) / ln(cells)) * 100" for example. If < 0 set to 0. The "2" can be changed to calibrate the range, as-is it's calibrated for the square worst case (625 on 5*5 grid) in your example.
Thanks! I'll experiment with that.
mk79 wrote:
20,8,4,40.00
Means you solved 8 cells with 4 tries? I don't understand.
Yes, that IS strange :) All the 8 cell grids were for testing purposes only, to quickly end the game. I may have been fiddling with the code at the time. Sorry about that :oops:


Per
dont be happy. worry
- ?
Post Reply