New Skills

Over the past few months I’ve been sharpening my skills in data analytics. Google’s data analytics courses have been a great start learning SQL and diving deeper into the ways numbers tell their stories. My goal is to step into the world of data analytics as a full-time data analyst, building on both my analytical background and my love of problem-solving. I hope to someday call myself a Datasmith, it would be my honor to work with the blessed data, hammering raw numbers into insights that actually matter. Think of this post and the Python project that follows as the first sparks of that new journey.

This is my first small but practical application of Python. My friends and I are competing in a Warhammer 40k crusade. List building can often be time consuming and optimizing can be a chore. Understanding all my options can sometimes be the difference between victory and defeat. So I wrote this simple program to help generate options.

Its quite simple, the first thing we need is the combinations function from Python’s “itertools”. That’s the first line!


from itertools import combinations

TARGET is a variable to designate the number of points I can take for a game. As the crusade goes on it will change to 1500 and then 2000. For now it’s 1000.

Units are also given tags. For example, all of my lists need to include my Warlord, Brutus Grond, as well as his squad the Noble Lance. In this version I’ve also marked a few other options that will be a good matchup for my next game.

I’ve included a few other tags to future proof the program. I think I’ll need to include an exemption section in the future to prevent bad matchups. For example any vehicle will have a bad time against the mechanicum. So I’ll want to leave out the Venomcrawler from those games. So there it is!

When run like this, I have 2 options.

— Army List 1 —
Brutus Grond (Warlord) (100 pts)
Hermannus Malchior (Master of Executions) (80 pts)
Corpse Cart (Rhino) (75 pts)
Noble Lance (Chosen) (250 pts)
Drengr Lance (nemesis claw) (110 pts)
Volks Hagen (venomcrawler) (120 pts)
Cult of Horus (Cultists) (50 pts)
Scorpion Lance (Havocs) (125 pts)
Gallant Lance (legionaries) (90 pts)
TOTAL = 1000 pts

— Army List 2 —
Brutus Grond (Warlord) (100 pts)
Hermannus Malchior (Master of Executions) (80 pts)
Corpse Cart (Rhino) (75 pts)
Noble Lance (Chosen) (250 pts)
Drengr Lance (nemesis claw) (110 pts)
Volks Hagen (venomcrawler) (120 pts)
Cult of Horus (Cultists) (50 pts)
Scorpion Lance (Havocs) (125 pts)
Templar Lance (legionaries) (90 pts)
TOTAL = 1000 pts

— Army List 3 —
Brutus Grond (Warlord) (100 pts)
Hermannus Malchior (Master of Executions) (80 pts)
Corpse Cart (Rhino) (75 pts)
Noble Lance (Chosen) (250 pts)
Drengr Lance (nemesis claw) (110 pts)
Volks Hagen (venomcrawler) (120 pts)
Cult of Horus (Cultists) (50 pts)
Scorpion Lance (Havocs) (125 pts)
Hammer Hand Lance (Raptors) (90 pts)
TOTAL = 1000 pts

— Army List 4 —
Brutus Grond (Warlord) (100 pts)
Hermannus Malchior (Master of Executions) (80 pts)
Corpse Cart (Rhino) (75 pts)
Noble Lance (Chosen) (250 pts)
Drengr Lance (nemesis claw) (110 pts)
Volks Hagen (venomcrawler) (120 pts)
Thrall Mob (Cultists) (50 pts)
Scorpion Lance (Havocs) (125 pts)
Gallant Lance (legionaries) (90 pts)
TOTAL = 1000 pts

— Army List 5 —
Brutus Grond (Warlord) (100 pts)
Hermannus Malchior (Master of Executions) (80 pts)
Corpse Cart (Rhino) (75 pts)
Noble Lance (Chosen) (250 pts)
Drengr Lance (nemesis claw) (110 pts)
Volks Hagen (venomcrawler) (120 pts)
Thrall Mob (Cultists) (50 pts)
Scorpion Lance (Havocs) (125 pts)
Templar Lance (legionaries) (90 pts)
TOTAL = 1000 pts

— Army List 6 —
Brutus Grond (Warlord) (100 pts)
Hermannus Malchior (Master of Executions) (80 pts)
Corpse Cart (Rhino) (75 pts)
Noble Lance (Chosen) (250 pts)
Drengr Lance (nemesis claw) (110 pts)
Volks Hagen (venomcrawler) (120 pts)
Thrall Mob (Cultists) (50 pts)
Scorpion Lance (Havocs) (125 pts)
Hammer Hand Lance (Raptors) (90 pts)
TOTAL = 1000 pts

** Process exited – Return Code: 0 **

These options all look good! But also exposes a way to improve the program. There are really only 2 options here. The same list with legionaries or raptors. Since we have 2 different cultist mobs and 2 different squads of legionaries, it will generate 4 lists that are the same with different names. Same with the last two lists, a raptor squad that costs the same as legionaries, with you choice of 2 cultist squads. So we’ll need to create a case that consolidate options that are essentially the same. So with these units being mandatory, it would generate 2 options.

Leave a comment