Jump to content
  • entries
    6
  • comments
    18
  • views
    993

Sudoku possible?


Jacob Rose

425 views

Someone asked if Sudoku was available for the 2600.

 

is there a sudoku game for the atari 2600.

 

I hadn't heard of one, so, wondering if it's feasible at all...

 

Memory: Sudoku only uses digits 1-9, plus the blank. Unfortunately, that's two too many to make the memory required really small - if it were 1-7 plus blank it would only require 4 bits to store, so you could represent the digits as nybbles and maybe even load the graphics based on the unique pair of digits. Sadly, representing 10 digits requires 5 bits, so it's probably not worthwhile to use anything less than a byte to represent each. 81/128 bytes of RAM down the drain, but that's not the end of the world unless we have to do it twice...

 

Graphics: Sudoku is a 9x9 grid of digits. Each digit can be drawn in as few as three pixels across by five down. With a one-pixel gap between digits (i.e. four pixels for 8 of the 9 digits, and 3 for the last one), that's a total of 35 pixels, 12 fewer than the largest graphic possible, so you should be able to add six more and display the lines between the 3x3 regions of the larger grid, with space on both sides (total of 41 pixels). Vertically, if you have one pixel's space between rows and draw lines between 3x3 regions, that's 8 * 6 + 5 + 6 = 59 scanlines. So, it should be possible to write a kernel that displays such a graphic.

 

The display kernel has to pull in the numbers from memory at the same time they're being displayed, which would be the real trick. We'd need to interlace the display to do that, if we could prepare an entire row in one scanline's worth of processing. 9! is 362880, so there is probably no way to leverage the fact that no number can be repeated in any given row in Sudoku...if we only had a 1MB ROM! :)

 

Maybe we could divide the symbols into an upper and lower set, and store the "case" in one nybble, and the subset in the other, so that we could pick from 2^9 (81) kernels, each of which was specific for a given set of "up" and "down" digit subsets (i.e., blank-7 and 8-9 plus any extra characters we'd like to have, like a cursor for instance), to allow us to load pairs of digits simultaneously (and only requiring 82 bytes instead of 81 if we only used nybbles instead of using just one bit). Then picking the right kernel becomes a task to do when we're not drawing anything (which would be a lot of the time). We'd have no problem buffering each row's kernel offset for just 9 rows, but after jumping to it, would we be able to buffer the 41-bit map for the next line's VDEL sprite image?

10 Comments


Recommended Comments

I think Supercat's demo would be quite suitable for the display part, among other things. I've considered using it for entering Atarivox codes, which would be quite easy to hack in - I just haven't got around to it.

Link to comment

My suggestion would be to store each row as 4.5 bytes for the digits, plus another 9 bits to indicate which ones were locked (so 6 bytes total per row, or 54 in all).

Link to comment

Heh. Interesting timing. I just finished my week-long bout of being obsessed with Sudoku (the algorithm/programming nature of it; solving them still sucks). I made a little page about it. It's nothing new, but you can check it out if you want:

 

http://www.wou.edu/~tmontg1/java/SudokuSolver/sudoku.html

 

My brother mentioned that he was contemplating how to set this up for the 2600, as well.

Link to comment
I think Supercat's demo would be quite suitable for the display part, among other things. I've considered using it for entering Atarivox codes, which would be quite easy to hack in - I just haven't got around to it.

 

Wow! Yeah, um, never mind my thoughts on the subject. That looks great! Clever way to do it, too.

Link to comment
My suggestion would be to store each row as 4.5 bytes for the digits, plus another 9 bits to indicate which ones were locked (so 6 bytes total per row, or 54 in all).

 

Um, oh yeah. Oops. 4^2 = 16. :) And I've been coding *how long*? Yipe. I guess I was up past my bedtime again.

Link to comment
In addition to supercat's excellent kernel, Robert M. has also made a 13 character display which would be good for Sudoku.

Speaking of Robert M's 13-char display, has anyone looked at that and figured out how to make it useful? I looked at it a little, and I think it looks really cool but, man, it looks hard as hell to use in any real application. He's using the PF, to begin with, so you need both a normal and a reversed copy of your font (or reverse on the fly) plus some of the characters cross playfield register boundaries, which would be time-consuming to deal with - it seems to me that his technique is best-suited for static, hard-coded displays.

 

Anyone else look at the code and figured out ways to work with it?

 

EDIT: And didn't you write a Sudoku-specific kernel at some point, Zach?

Link to comment
Speaking of Robert M's 13-char display, has anyone looked at that and figured out how to make it useful? ... It seems to me that his technique is best-suited for static, hard-coded displays.

 

One of my major design goals with my 16-digit kernel was making it practical. In my demo, I allow the user to use a joystick to edit all the digits.

 

For applications not needing more than 12 characters, though, I think a kernel based on either Venetian-blinds or David Crane's flicker-blinds (seen in Basic Programming and Stellar Track) would be better.

Link to comment
Guest
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...