Friday, August 25, 2017

TI-84 Plus CE and HP Prime: Wilson Score (Video Games)

TI-84 Plus CE and HP Prime:  Wilson Score

Introduction

There are various ways to rank games: by the popularity of players or by the custom levels the players (like Little Big Planet and Super Mario Maker). A method to rank is to use the number of likes (or hearts) a player or level receives.   Another method is to use the percentage of likes to the number of plays (trials).    

Another way to rank is to use the Wilson score interval (Edwin Wilson).  The general Wilson interval formula is:

I = ( p0 + z^2/(2*n) ± z * √((p0 * (1 – p0)/n) + (z^2/(4*n^2)) )/( 1 + z^2/n )

Where:

n = number of trials or players
p0 = percentage of likes (successes) = likes/trials
z = z-score of the confidence interval (center of the normal curve)

Some values of z:

99% confidence:  2.575829303
97% confidence:  2.170090375
95% confidence:  1.959963986
90% confidence:  1.644853626

Matthew Lane, author of Power Up: Unlocking the Hidden Mathematics in Video Games, modifies the Wilson interval to calculate the score with 95% confidence, using the approximation of z ≈ 1.96, as

s = ( p0 + 1.96^2/(2*n) - 1.96 * √((p0 * (1 – p0)/n) + (1.96^2/(4*n^2)) )/( 1 + 1.96^2/n )

The score takes the number of likes and plays into account.  The program WILSON calculates the above score.

TI-84 Plus CE Program WILSON

Input "LIKES: ",L
Input "TRIALS: ",T
L/T→P
P+1.96^2/(2*T)→S
S-1.96√((P(1-P)/T)+1.96^2/(4*T^2))→S
S/(1+1.96^2/T)→S
Disp "SCORE: ",S

HP Prime Program WILSON

EXPORT WILSON(L,T)
BEGIN
// 2017-08-24 EWS
// L: likes,T: trials
// Percentage of likes
LOCAL P0:=L/T;
// Calculation (in parts)
LOCAL S:=P0+1.96^2/(2*T);
S:=S-1.96*√((P0*(1-P0)/T)
+1.96^2/(4*T^2));
S:=S/(1+1.96^2/T);
RETURN S;
END;

Example

Here is a comparison of ranking methods for five levels for a given custom level of the making game Super Mario Maker (https://supermariomakerbookmark.nintendo.net/?difficulty=normal
Retrieved August 25, 2017)

Level
Likes
Plays
% of Likes
Wilson Score
Castle Of Bomb Spin Jump Arts
1024
6169
0.1659912466
0.1569147894
Smb3 the mini game Cave 5
3468
20423
0.1698085492
0.1647212552
Stepping Stones 101
31
176
0.1761363636
0.1269508811
Squid Sisters & The Flooded Cave
90
518
0.1737451737
0.1435495995
Tower of challenges 2
244
1394
0.175035868
0.1559880745

Source: 
Lane, Matthew.  Power-Up:  Unlocking the Hidden Mathematics in Video Games Princeton University Press:  Princeton.  2017  ISBN 9780691161518

Eddie


This blog is property of Edward Shore, 2017.