Using a GA (and NHL 20) to Draft the Seattle Kraken

So, with all the hype around the Seattle Kraken I decided to create the Seattle Kraken in NHL 20 and use a genetic algorithm to determine the best team (according to NHL 20).

Requirements

  1. Players only >= 80 overall
  2. Team must be salary cap compliant, that is, both below the cap and above the floor
  3. Line chemistry is ignored
  4. Player age is weighted so that younger players receive bonuses for every year they are under 35. If they are 35 or over they receive no bonuses.
    1. weight = (35 – age) / 500
    2. Player value = Overall * (1 + weight)
    3. 80 overall player at 20 years old gets the value of 82.4
  5. Fitness is based on how close to the cap without being over we can go with the highest overall rating
  6. Only 100 generations

So the list of available players for the GA are as listed below:

TeamPlayerPositionRatingAgeSalaryAdj. Rating
ANAA.HenriqueC84295.82585.008
ANAO.KaseRW82232.683.968
ANAD.ShoreC80242.381.76
ANAR.MillerG81381.12581
ARIA.GoligoskiD82335.47582.328
ARIJ.DemersD82313.9482.656
ARID.KuemperG83291.8583.996
ARIC.SoderbergC81334.7581.324
ARIM.GrabnerLW81313.3581.648
ARIV.HinostrozaRW80251.581.6
BOSJ.HalakG83342.7583.166
BOST.KrugD86285.2587.204
BOSC.CoyleC83273.284.328
BOSJ.MooreD80282.7581.12
BOSK.MillerD80312.580.64
BUFK.OkposoRW8131681.648
BUFJ.McCabeD81252.8582.62
BUFC.ShearyLW8127382.296
BUFZ.BogosianD80285.14581.12
BUFM.ScandellaD8029480.96
BUFJ.VeseyLW80262.27581.44
BUFC.HuttonG81332.7581.324
CGYC.TalbotG81312.7581.648
CGYM.GiordanoD89356.7589
CGYM.BacklundC84305.3584.84
CGYT.BrodieD84294.6585.008
CGYT.HamonicD83283.8684.162
CGYM.FrolikRW82314.382.656
CARJ.FaulkD84274.83585.344
CARJ.WilliamsRW82374.582
CARE.HaulaC82282.7583.148
CART.VanRiemsdykD80272.381.28
CARB.PesceD80244.02581.76
CHIE.GustafssonD84271.285.344
CHIA.ShawRW81273.982.296
CHIC.deHaanD81284.5582.134
CHIZ.SmithC80313.2580.64
CHIC.MurphyD80263.8581.44
COLJ.DonskoiLW81273.982.296
COLI.ColeD81304.2581.81
COLC.WilsonLW80292.680.96
COLM.CalvertRW80292.8580.96
COLS.GirardD8021582.24
CBJN.FolignoRW82315.582.656
CBJD.SavardD82284.2583.148
CBJM.NutivaaraD81252.782.62
CBJB.JennerLW80263.7581.44
CBJO.BjorkstrandRW80245.8581.76
DALA.SekeraD82331.582.328
DALR.FaksaC81252.282.62
DALJ.OleksiakD80262.1481.44
DALM.JanmarkLW80262.381.44
DETM.GreenD83335.37583.332
DETF.NielsenC80355.2580
DETV.FilppulaC8035380
DETP.NemethD80273.8581.28
EDMA.LarssonD83264.16584.494
EDMM.BenningD80251.981.6
FLAM.HoffmanLW85295.186.02
FLAA.StralmanD83325.4183.498
FLAB.ConnolyRW80273.41581.28
LAKT.ToffoliRW82274.683.312
LAKD.BrownRW81345.87581.162
LAKD.ForbortD80272.52581.28
MINE.StaalC85343.2585.17
MINJ.SpurgeonD84295.1985.008
MTLP.ByronLW80303.480.8
NSHM.GranlundC86275.7587.376
NSHC.SmithRW82294.2582.984
NJDS.VatanenD83284.87584.162
NJDW.SimmondsRW8230582.82
NJDT.ZajacC80345.7580.16
NYIT.HickeyD82302.582.82
NYIB.NelsonRW8227683.312
NYIJ.BoychukD8135681
NYIA.LaddLW80335.580.32
NYIL.KomarovC8032380.48
NYIC.CizikasC80283.3581.12
NYRC.KreiderLW83284.62584.162
NYRR.StromeC80253.181.6
NYRJ.FastRW80271.8581.28
NYRV.NamestnikovLW8026481.44
NYRT.DeAngeloD80230.86581.92
OTTM.BoedkerRW8129481.972
OTTA.DuclairRW80231.6581.92
PHIM.NiskanenD83325.7583.498
PHIJ.BraunD80323.880.48
PITP.HornqvistRW83325.383.498
PITJ.SchultzD83285.584.162
PITB.RustC80273.581.28
SJSB.DillonD82283.2783.148
STLA.PietrangeloD89296.590.068
STLB.SchennC86275.12587.376
STLD.PerronLW8431484.672
STLT.BozakC8233582.328
STLV.DunnD82220.72584.132
STLJ.BouwmeesterD81353.2581
STLA.SteenLW81355.7581
TBLR.McDonaghD87306.7587.87
TBLB.CoburnD81341.781.162
TBLC.CirelliC80210.7382.24
TORT.BarrieD86272.7587.376
TORJ.MuzzinD8530485.85
TORK.KapanenRW82223.284.132
TORZ.HymanRW81272.2582.296
TORJ.SpezzaC80360.780
TORA.JohnssonLW80243.481.76
VANC.TanevD83294.4583.996
VANT.PearsonLW80263.7581.44
WSHR.PanikRW81282.7582.134
WSHN.JensenD80282.581.12
WPGM.PerreaultLW80314.12580.64
CARJ.ReimerG81313.4381.648
CHIR.LehnerG8627587.376
DALA.KhudobinG83332.583.332
DETJ.HowardG8435484
DETJ.BernierG8130381.81
EDMM.SmithG8237282
LAKJ.CambellG80270.781.28
MINA.StalockG80310.78580.64
MTLK.KinkaidG82291.7582.984
NSHJ.SarosG81241.582.782
NJDC.SchneiderG8233682.328
NYIT.GreissG83333.33583.332
NYRA.GeorgievG81230.79582.944
OTTC.AndersonG83384.7583
PITC.DeSmithG81271.2582.296
SJSA.DellG81301.981.81
STLJ.AllenG81284.3582.134
TBLM.CondonG80292.480.96
TORM.NeuvirthG80310.780.64
TORM.HutchinsonG80290.780.96
VANJ.MarkstromG85293.36586.02
WPGL.BrossoitG81261.22582.458
WPGE.ComrieG80230.781.92
Available Players

Mutation

I attempted several different mutations using the top two rated individuals in each generation. Swapping players from the same team in the DNA string, swapping multiple players from the same team in the DNA string and finally choosing a new random player for one specific team and multiple teams.

One Player Swap Mutation

TeamPositionPlayerRatingAgeSalaryAdj. Rating
ANACD.Shore80242.381.76
ARILWM.Grabner81313.3581.648
BOSCC.Coyle83273.284.328
BUFGC.Hutton81332.7581.324
CARDT.VanRiemsdyk80272.381.28
CBJLWB.Jenner80263.7581.44
CGYDT.Hamonic83283.8684.162
CHIDE.Gustafsson84271.285.344
COLDS.Girard80210.782.24
DALLWM.Janmark80262.381.44
DETGJ.Bernier8130381.81
EDMGM.Smith8237282
FLALWM.Hoffman85295.186.02
LAKGJ.Cambell80270.781.28
MINGA.Stalock80310.78580.64
MTLGK.Kinkaid82291.7582.984
NJDDS.Vatanen83284.87584.162
NSHRWC.Smith82294.2582.984
NYIDT.Hickey82302.582.82
NYRDT.DeAngelo80230.86581.92
OTTRWA.Duclair80231.6581.92
PHIDM.Niskanen83325.7583.498
PITGC.DeSmith81271.2582.296
SJSDB.Dillon82283.2783.148
STLLWD.Perron8431484.672
TBLCC.Cirelli80210.7382.24
TORGM.Hutchinson80290.780.96
VANLWT.Pearson80263.7581.44
WPGLWM.Perreault80314.12580.64
WSHRWR.Panik81282.7582.134
Salary79.51
Overall82.484

Two Player Swap Mutation

TeamPositionPlayerRatingAgeSalaryAdj. Rating
ANARWO.Kase82232.683.968
ARILWM.Grabner81313.3581.648
BOSDJ.Moore80282.7581.12
BUFDZ.Bogosian80285.14581.12
CARCE.Haula82282.7583.148
CBJDD.Savard82284.2583.148
CGYRWM.Frolik82314.382.656
CHIDE.Gustafsson84271.285.344
COLDS.Girard80210.782.24
DALDA.Sekera82331.582.328
DETCV.Filppula8035380
EDMDM.Benning80251.981.6
FLARWB.Connoly80273.41581.28
LAKDD.Forbort80272.52581.28
MINCE.Staal85343.2585.17
MTLGK.Kinkaid82291.7582.984
NJDRWW.Simmonds8230582.82
NSHGJ.Saros81241.582.782
NYIGT.Greiss83333.33583.332
NYRDT.DeAngelo80230.86581.92
OTTRWA.Duclair80231.6581.92
PHIDJ.Braun80323.880.48
PITGC.DeSmith81271.2582.296
SJSDB.Dillon82283.2783.148
STLGJ.Allen81284.3582.134
TBLCC.Cirelli80210.7382.24
TORCJ.Spezza80360.780
VANGJ.Markstrom85293.36586.02
WPGLWM.Perreault80314.12580.64
WSHDN.Jensen80282.581.12
Salary80.825
Overall82.33

Random Player Mutation (from same team)

TeamPositionPlayerRatingAgeSalaryAdj. Rating
ANARWO.Kase82232.683.968
ARIGD.Kuemper83291.8583.996
BOSCC.Coyle83273.284.328
BUFDJ.McCabe81252.8582.62
CARCE.Haula82282.7583.148
CBJDD.Savard82284.2583.148
CGYCM.Backlund84305.3584.84
CHIRWA.Shaw81273.982.296
COLLWJ.Donskoi81273.982.296
DALCR.Faksa81252.282.62
DETDP.Nemeth80273.8581.28
EDMDM.Benning80251.981.6
FLALWM.Hoffman85295.186.02
LAKGJ.Cambell80270.781.28
MINGA.Stalock80310.78580.64
MTLLWP.Byron80303.480.8
NJDRWW.Simmonds8230582.82
NSHGJ.Saros81241.582.782
NYIDT.Hickey82302.582.82
NYRDT.DeAngelo80230.86581.92
OTTRWA.Duclair80231.6581.92
PHIDJ.Braun80323.880.48
PITGC.DeSmith81271.2582.296
SJSDB.Dillon82283.2783.148
STLDV.Dunn82220.72584.132
TBLCC.Cirelli80210.7382.24
TORDT.Barrie86272.7587.376
VANDC.Tanev83294.4583.996
WPGGL.Brossoit81261.22582.458
WSHRWR.Panik81282.7582.134
Salary81.05
Overall82.847

Two Player Random Swap

TeamPositionPlayerRatingAgeSalaryAdj. Rating
ANARWO.Kase82232.683.968
ARIRWV.Hinostroza80251.581.6
BOSCC.Coyle83273.284.328
BUFLWC.Sheary8127382.296
CARCE.Haula82282.7583.148
CBJLWB.Jenner80263.7581.44
CGYDT.Brodie84294.6585.008
CHIDE.Gustafsson84271.285.344
COLDS.Girard80210.782.24
DALLWM.Janmark80262.381.44
DETGJ.Howard8435484
EDMDM.Benning80251.981.6
FLALWM.Hoffman85295.186.02
LAKGJ.Cambell80270.781.28
MINCE.Staal85343.2585.17
MTLGK.Kinkaid82291.7582.984
NJDDS.Vatanen83284.87584.162
NSHRWC.Smith82294.2582.984
NYIDT.Hickey82302.582.82
NYRGA.Georgiev81230.79582.944
OTTRWA.Duclair80231.6581.92
PHIDJ.Braun80323.880.48
PITCB.Rust80273.581.28
SJSDB.Dillon82283.2783.148
STLLWD.Perron8431484.672
TBLCC.Cirelli80210.7382.24
TORDT.Barrie86272.7587.376
VANGJ.Markstrom85293.36586.02
WPGGE.Comrie80230.781.92
WSHRWR.Panik81282.7582.134
Salary81.285
Overall83.199

Results

Using the two player random swap generated the best lineup with a salary cap of $81.285M and an overall team rating of 83.199.

Note that if you use any of these rosters the salary might be slightly off due to expiring contracts.

Create Heatmaps in PHP (and other languages)

I’ve added new heatmaps to player and goalie pages. I am using the same information as the zone charts and just displaying it in a different way.

There are three steps to creating heatmaps.

  1. Create a gradient
  2. Create an alpha image of the heatmap (I’ll explain what that is later)
  3. Using the alpha image, colour points on the heatmap using the gradient

I did this in PHP, but can easily be adapted to other languages.

Read More

Streamable’s “Hidden” API Options (set the title of a Streamable video)

You might have, in the past, tried to upload videos to Streamable. You may even have looked at the Streamable API

You’ll notice there’s no documented way to set the title of your videos.

Thankfully, this is really easy to do.

Simply add the title get parameter to your request!

GET https://api.streamable.com/import{?url}&title={?title}

Your imported videos will now have a title!

League Support

I’ve added a new feature to IcyData that I am calling ‘League Support’ — it will allow you to switch between leagues.

I’ve made this change in preparation of adding some other leagues to IcyData. Namely the AHL, CWHL and if possible the NWHL.

Currently available are the NHL and the World Cup of Hockey.

Enjoy!