On learning by tinkering, part 2.

There is always a profound sadness associated with the end of anything, be it a book, a tv show, a year, or an era. Projects are no different. And now that I’m done with my game (I can proudly christen it v1.0) I am incredibly sad. Bordering on depressed, even. I cleaned my room (I keep it dirty just to have things to clean when I’m like this). I rearranged everything. I brushed my teeth. I made an OS X build of my game, and then a Windows one. I don’t have Linux. I got a guy to mop my room down. I paid him with the surprisingly plentiful change hidden in books and crannies in my room. I sat down. I looked at the screen, with Sublime Text (my newfound favourite text editor) staring back at me blankly. I closed the laptop, and asked my mother how to clean a mug. I didn’t have detergent, is liquid hand wash okay? I cleaned my mug. I had five or six mugs of tea yesterday. I spent 14 or 15 hours at the computer yesterday. Coding, looking things up, making mistakes, fixing mistakes. Learning.

Having fun.

I just spent the last fifteen minutes looking at the pictures my code generates. My code. (Knot atlas’s knots, but still!). There’s something mesmerising about losing yourself in your work. Music helps too, and I have Broke for Free playing right now. They’re on Bandcamp. Have I mentioned Bandcamp is awesome? It is.

I am nowhere near done yet. Oh no. This is just v1.0. This shall be a very ongoing project. I have oodles of ideas for game modes. Arpit had a brilliant idea, too, but I need to math it out to see if I can implement it or not.

What now? A log. Of retroactively named versions of my game. Thank you for reading.

Idea is nebulous. Kawauchi shows us his game and I think about it for the next few days. I don’t quite know when exactly I wanted to make it. But I began doodling in class once. I drew the tiles I would go on to use in the actual code. I figured out how to convert arc representations into matrices. I stopped doodling.

I find cocos2d and make the bare bones display window appear. I muck about till I get a hardcoded arc representation to become a diagram.

I’m home now, and I’m back to doodling. This time it’s to toggle the crossings. I spend a full day thinking about it. I code it in one go the next day. Now the hardcoded knot toggles. I have one level of my game. It’s boring.

The episode with Knot Atlas. I yanked 250 representations from their website. I wrote some code to go back and forth between knots. I changed from the “over/under” images for the crossings to “on/off”. And these are assigned randomly, to improve replayability.

Squashed a bug I didn’t realise was there that had to do with duplicate regions being spat out by my code. Now is neat. Also the outside is now a region.

Now I’m in Roorkee. There’s no internet. I can’t update/jailbreak my phone to put my game in it. Impatient. I begin coding it from scratch in Python. Find Tkinter, which I subsequently fall in love with. Rapidly get it up to speed, to v0.4 in one day. Or maybe two.

I learn more Tkinter stuff. I make more windows. And buttons. And victory screens. I send the code to people. They either can’t or don’t want to play it. No matter, I try making it better.

Changed a function that was updating every 0.1 sec into a static thing that checked only when something happened. Huge speed increase. Cool. Put in a help screen. Helpful help screen. Polish code a little bit.

Added a counter that told you how many moves you’ve made so far vs. what the minimum is. Took a while to code. This was what I was doing yesterday. Made the counter slightly fancy with colours and stuff. Gave you the option to retry the same random seed, or to try a different seed.

Got bored and added a Cheat button that shows you exactly which regions you need to tap in order to win. This is for when you’re too frustrated with a level or when you simply don’t believe the minimum number. Also, this is a wonderful gauge of difficulty. A 1, 2, or 3 turn level is incredibly easy and a 7, 8, or 9 turn level is deliciously hard. I love playing them. Can lose myself for hours.

Used py2app to make an OS X app. Used py2exe to make a very messy Windows executable with a bunch of junky windows dlls and what not.

Shall use py2objc to make an iOS app. When I eventually jailbreak my phone I shall get it on there.
Should probably care about Linux. But eh, they can build from source.
Write some code that goes through ALL the combinations for all the knots and sorts them by minimum turn required. Each knot has an average of say 12 crossings, and there are 249 knots, so that’s at least 1,000,000 levels. Yes, a million.

Jesus, a million.

Game modes. Like a time limited one. Or to get to a particular configuration. Or loads more. More info when I get down to coding them.

If you’ve read this far, you’re hopefully interested in the game. So here: https://www.dropbox.com/s/buzllp03yxp6a03/Source.zip

That contains the image tiles used to generate knots, the plist containing the codes I took from Knot Atlas, and the Python script itself. You’ll need Python 2.7 installed on your computer for the script to run. Leave all the various files inside the same folder. And you’re good to go!

Do let me know what you think. If you read the source, don’t hesitate to tell me all the ways I code horribly. Must get better.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: