Doku: my new project.

Well, I’m waiting on some more spending money to come in before I can start working on any more interesting electronics projects; so I’ve decided to shift my focus temporarily and concentrate on learning the ins and outs of the ncurses library so that I can make some more robust and fun console based applications. To be honest with you, I HATE working with graphical user interfaces. almost all of my programming thus far has used either a line based user interface, or run in the background without need of a user interface. I think that most graphical user interfaces increase code complexity exponentially to the point where only part of the running code involves the programs functionality and the bulk of it is just there to make things pretty and “user friendly.” This is why my main choice for creating a user interface is ncurses. I use several ncurses based programs on a daily basis and I am very happy with their appearance, ease of use, and general all around simplicity, and now I’d like to learn how to implement some of these features in my own programming projects. The idea to learn ncurses has been a while in the making. With many of my projects (like learning Python and Perl) I start out with the desire to learn the skill, but no TASK to perform with the skill, usually causing me to lose interest in a project rather quickly. Occasionally, however, I derive a task that I want to accomplish, and manage to tie in the opportunity to teach myself a new skill along the way. This is how I came up with the idea for Doku, my new C/ncurses sudoku program. I came up with the idea this morning while doing the puzzles in the daily paper. I was thinking, “man, I love these puzzles, I should install a sudoku program. Hell, I’m a programmer, I bet I could MAKE a sudoku program!” So I went to my PC and started hunting around in the repositories for a nice simple sudoku program I could play around with to get me started. After taking a look at all of the options I settled on nsudoku from the aur. I figured this would be a great starting point because it is simple (written in C in less that 200 lines of code) and it already implements a basic ncurses interface.

So I downloaded the source this morning and immediately started hacking away. I have quite a few ideas for what features I would like to implement and change. here are the ideas I’ve had so far:

  • create a better grid around the puzzle
  • implement VIM key bindings for movement
  • implement a better system for selecting puzzle difficulty
  • implement timing on games, and best times for each difficulty level
  • extend the colors, and provide the option of changing colors
  • I’m also going to be dividing the code up into more manageable chunks to better facilitate code reuse.  Essentially, the original author wrote some great code for generating/solving puzzles, I’m just going to be hacking in a bunch of simple features,  making things a little more elegant, and making an awesome sudoku program that everybody is going to want to play!

    I’m also thinking that when I make some good progress on this project I’m going to be throwing the source on github, cooking up a PKGBUILD, and putting it in the AUR so that everyone else can have a chance to play with it and hack it up a little bit.  but all of that will be a few days/weeks down the road I think.  If anything it will keep me busy in my freetime for a while :)

    Leave a Reply