Klondike Solitaire Weekend Challenge
Friday was a snowy day in Denver. There was a lot of basketball on TV too. I decided to give myself a challenge…
How hard would it be to write a Klondike Solitaire app for iOS?
The challenge was just to see how far I could get just on weekend evenings (my weekend days are not for coding). I was going to be watching NCAA tournament games so might as well have something to do during downtimes.
I think I got pretty far! Its not complete, but its easily less then a weeks worth of work to complete.
What isn’t there
– dragging between piles
– different game rules (single card from the waste pile is all that’s supported)
Here’s my game on Phone 6S Plus:
Klondike Solitaire has been a staple on both Mac and PC. After working on this I can see why. The logic is pretty easy. The challenge in the UI. Once you have solid game code the only challenge is passing user interactions into the games controller.
I bet that’s why its been a constant in OS versions for decades. The big challenges are always UI based. The code that drives my game is less then 700 lines of code all told. Its a really simple game with simple rules. I spent much more time figuring out how to make it work on multiple devices.
I’m both surprised at what I got done with 16 hours of work over three days as well as being a bit disappointed that I didn’t finish more. I spent much more time in UI driven roles (creating assists, dealing with Storyboard Autolayout) then I would have wanted too. I wonder how much of what I think is left i would had gotten done if I wasn’t fixated on having something in a video.
The total app is less then 1025 lines. I don’t see it getting more then 2000 when all is said and done.
Fun weekend and fun challenge though!