Interesting.
I usually play games that I can win or lose, and depending on how well I did, I'll have to punish myself.
One example, I love playing World Championship Snooker 2009. In snooker the maximum break you can have is 147. I play seasons where I start playing against weaker players until I get to the hard players. The final round in the season is best of 19, so I have to win 10 games to win the final round in that season. Once I complete one round, I can exit the game and resume a next time. So depending on when I do this challenge, I can be facing a somewhat easy opponent or a hard one. A hard opponent usually means, if I miss the shot, they're likely going to finish the game and I lose the round.
In addition to any spanking game, for quite a while now, I've set myself the following challenge. Everytime I lose a round, I'll have to set aside a card from a deck to my "punishment pile" if I loose the game (say the opponent one 10 games out of a19 game round) I'll have to put 5 cards on the punishment pile, but I'm allowed to "cheat" to reset the score to 0 and try again. (so I don't lose any progress which means that the better I become at the game, the more hard players I'll face)
Now the spanking punishment resides to this. I play one round in the game, and I have to count my maximum break. Luckily for me, the game keeps statistics for me, so at the end of the round when I exit the game, it gives me a summary, and tells me what my maximum break was. Say, I did well and had 104, I'll substract 104 from 147 and the outcome is the amount of strokes I have to give myself. To understand how hard this is in snooker, if you miss one ball, and the opponent misses the next (or plays a safety) and you win the game after that, your maximum break was stopped. You're forced to try and clear the table from the first ball you pot which is really hard. I have scored a 147 only once, and usually when I am making a good break, I may end up with 130 or so. But more often (far more often) I screw up somewhere and don't even make 100. More like 67 or so. Meaning I have 147-67=80 strokes. One time was really bad, I had an easy opponent but he played a lot of safeties and made it hard. I scored little points before missing a shot because it was too hard meaning that for many minutes in the game my maximum break was somewhere around 16.
The more I went to the end of the game, the more I was distracted knowing that if I wasn't going to make a good break soon, I would end up with 120+ strokes. Finally made a last break of 28 and got the table cleared, then a painful sore ass. XD
That said, I love the anticipation of not knowing when you'll be summoned to do the punishment. I don't have linux so I can't run your script, but that is not so much of a problem for me. I have plenty of programming environments to create something similar for myself, including windows and for my phone, but also php.
Formally known as Slave_L.
I'm not yet very comfortable expressing my love for kink from my private life. I will therefor hide behind my username KinkInSpace and not allow any connections to who I really am. I'm sure you'll understand.