Using python to find the best, practical way to shuffle (magic) cards

Every Friday night thousands of fellow nerds spend their evening playing playing Magic the Gathering at their local gameshop. At least they used to before the pandemic hit. I used to be one of them but I was never any good and always blamed it on my inability to shuffle cards the right way. Lately I've been coming back to the game and find myself in the same old predicament and blaming habits. But now I can use computer modeling to once and for all put that excuse to bed and find out the best practical way to shuffle cards!

when is shuffling considered practical?

About a week ago I got quite an enthusiastic message from my mother in law. She found a nice puzzle made up of 1’s and 0’s and thought I could explain it to her. But although the Sudoku-like puzzles are called binary puzzles they don’t have much to do with computer science. And instead of solving the puzzle by hand I would do what any sensible engineer would do: spend a lot more time automatizing it! The puzzles intrigued me and before I knew it I was hooked. …

While experimenting with python in my daily life i’ve found it to be a great tool for automating a lot of tedious tasks. Although i’m an IDE kind of guy i catch myself drifting more and more to the terminal for running my already finished scripts and tools. This is great because i don’t need to fire up the relatively slow-to-start pycharm editor evertytime i want to run a small task. The downside however is that i keep forgetting the full path to my scripts and to run it with the python prefix and the .py file extension. I want…

Python is a great programming language, easy to learn and extremely versatile. In this article i’d like explain how to install python as a foundation for future posts.

First we need to download the python installer from the official website.

Find the download button, any version higher than 3.7 should work for my tutorials

Once you’ve downloaded the installer you need to do some configuration:

Kevin Gleijm

Computer Science student by day and avid programmer by night.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store