Super Street Fighter 2 Turbo example

This example applies a logistic handicap to a Super Street Fighter 2 Turbo matchup chart.


In [1]:
import _initpath

import numpy
import dataset.matchup
import dataset.csv
import zerosum.balance
from pandas import DataFrame

# Balances a Super Street Fighter 2 Turbo matchup chart using a logistic handicap.
# Produces a .csv file for the initial game and the resulting game.

init = dataset.matchup.ssf2t.sorted_by_sum()
dataset.csv.write_csv('out/ssf2t_init.csv', init.data, init.row_names, numeric_format = '%0.4f')

balance = zerosum.balance.LogisticSymmetricBalance(init.data)
opt = balance.optimize()
dataset.csv.write_csv('out/ssf2t_opt.csv', opt.F, init.row_names, numeric_format = '%0.4f')

Initial matchup chart


In [2]:
DataFrame(data = init.data, index = init.row_names, columns = init.col_names)


Out[2]:
Dhalsim Boxer Claw Ryu Chun-Li Guile Dee Jay Dictator Sagat E. Honda Fei-Long Ken Zangief Cammy Blanka T. Hawk
Dhalsim 5.0 5.5 3.5 7.0 5.0 8.5 8.0 6.5 9.0 6.5 6.5 7.5 7.5 6.5 8.0 6.5
Boxer 4.5 5.0 5.5 6.0 4.5 6.0 7.0 6.5 8.0 6.5 7.0 6.5 5.5 7.5 7.5 5.5
Claw 6.5 4.5 5.0 6.0 6.0 7.0 6.0 5.0 7.5 6.0 6.5 6.0 6.5 6.0 6.5 7.0
Ryu 3.0 4.0 4.0 5.0 6.0 6.5 7.0 6.5 6.5 8.0 6.5 6.5 4.5 7.5 7.5 6.0
Chun-Li 5.0 5.5 4.0 4.0 5.0 6.0 6.5 7.0 6.5 7.5 4.0 6.5 7.5 6.0 7.0 5.5
Guile 1.5 4.0 3.0 3.5 4.0 5.0 5.5 5.5 6.5 8.0 7.5 6.5 8.0 8.0 6.0 6.5
Dee Jay 2.0 3.0 4.0 3.0 3.5 4.5 5.0 6.5 5.5 8.5 7.5 5.0 4.5 8.0 7.5 7.0
Dictator 3.5 3.5 5.0 3.5 3.0 4.5 3.5 5.0 6.5 3.5 6.5 4.0 4.5 8.0 3.5 7.0
Sagat 1.0 2.0 2.5 3.5 3.5 3.5 4.5 3.5 5.0 6.5 6.5 5.0 6.0 7.0 8.0 6.5
E. Honda 3.5 3.5 4.0 2.0 2.5 2.0 1.5 6.5 3.5 5.0 7.0 3.0 8.5 8.0 7.5 6.5
Fei-Long 3.5 3.0 3.5 3.5 6.0 2.5 2.5 3.5 3.5 3.0 5.0 5.5 7.0 7.0 6.5 7.0
Ken 2.5 3.5 4.0 3.5 3.5 3.5 5.0 6.0 5.0 7.0 4.5 5.0 4.0 5.0 5.0 5.5
Zangief 2.5 4.5 3.5 5.5 2.5 2.0 5.5 5.5 4.0 1.5 3.0 6.0 5.0 3.5 4.0 5.5
Cammy 3.5 2.5 4.0 2.5 4.0 2.0 2.0 2.0 3.0 2.0 3.0 5.0 6.5 5.0 6.0 8.5
Blanka 2.0 2.5 3.5 2.5 3.0 4.0 2.5 6.5 2.0 2.5 3.5 5.0 6.0 4.0 5.0 7.0
T. Hawk 3.5 4.5 3.0 4.0 4.5 3.5 3.0 3.0 3.5 3.5 3.0 4.5 4.5 1.5 3.0 5.0

Matchup chart after balancing with a logistic handicap


In [3]:
DataFrame(data = opt.F, index = init.row_names, columns = init.col_names)


Out[3]:
Dhalsim Boxer Claw Ryu Chun-Li Guile Dee Jay Dictator Sagat E. Honda Fei-Long Ken Zangief Cammy Blanka T. Hawk
Dhalsim 5.000000 4.871798 2.853515 6.202191 4.011808 7.713018 6.825882 4.344657 7.785439 4.270627 4.143285 5.338652 4.723335 3.402885 5.274222 3.238687
Boxer 5.128202 5.000000 5.383256 5.745912 4.135630 5.345706 6.174310 4.970773 6.677960 4.895309 5.334803 4.770307 3.193506 5.173748 5.185115 2.885464
Claw 7.146485 4.616744 5.000000 5.860537 5.754072 6.519004 5.209609 3.580901 6.124491 4.480903 4.882347 4.357451 4.276802 3.597261 4.113406 4.479986
Ryu 3.797809 4.254088 4.139463 5.000000 5.894609 6.122867 6.418758 5.232746 5.089579 6.964034 5.026800 5.032287 2.586030 5.434859 5.446152 3.559919
Chun-Li 5.988192 5.864370 4.245928 4.105391 5.000000 5.712831 5.984436 5.902871 5.198804 6.425100 2.748693 5.141570 5.719395 3.834252 4.928380 3.199787
Guile 2.286982 4.654294 3.480996 3.877133 4.287169 5.000000 5.247280 4.593157 5.493241 7.295487 6.575506 5.436436 6.672620 6.511666 4.128719 4.459312
Dee Jay 3.174118 3.825690 4.790391 3.581242 4.015564 4.752720 5.000000 5.883016 4.703472 8.088135 6.800662 4.152408 3.122847 6.738937 6.089068 5.281732
Dictator 5.655343 5.029227 6.419099 4.767254 4.097129 5.406843 4.116984 5.000000 6.368478 3.431629 6.310196 3.809033 3.711307 7.286807 2.664241 5.926431
Sagat 2.214561 3.322040 3.875509 4.910421 4.801196 4.506759 5.296528 3.631522 5.000000 6.561487 6.442649 4.942702 5.339719 6.239325 7.407408 5.508176
E. Honda 5.729373 5.104691 5.519097 3.035966 3.574900 2.704513 1.911865 6.568371 3.438513 5.000000 6.889133 2.895940 8.081594 7.346084 6.759019 5.440941
Fei-Long 5.856715 4.665197 5.117653 4.973200 7.251307 3.424494 3.199338 3.689804 3.557351 3.110867 5.000000 5.505432 6.463527 6.298070 5.763195 6.123850
Ken 4.661348 5.229693 5.642549 4.967713 4.858430 4.563564 5.847592 6.190967 5.057298 7.104060 4.494568 5.000000 3.425586 4.211378 4.222481 4.522773
Zangief 5.276665 6.806494 5.723198 7.413970 4.280605 3.327380 6.877153 6.288693 4.660281 1.918406 3.536473 6.574414 5.000000 3.338783 3.840083 5.137401
Cammy 6.597115 4.826252 6.402739 4.565141 6.165748 3.488334 3.261063 2.713193 3.760675 2.653916 3.701930 5.788622 6.661217 5.000000 6.010921 8.403133
Blanka 4.725778 4.814885 5.886594 4.553848 5.071620 5.871281 3.910932 7.335759 2.592592 3.240981 4.236805 5.777519 6.159917 3.989079 5.000000 6.832407
T. Hawk 6.761313 7.114536 5.520014 6.440081 6.800213 5.540688 4.718268 4.073569 4.491824 4.559059 3.876150 5.477227 4.862599 1.596867 3.167593 5.000000