#118813 - neilio - Fri Feb 16, 2007 11:56 pm
...or at least, that could be the source of my query
I'm working on a basic Sudoku program and so far I have a 9 x 9 2D array where each entry describes a cell in the Sudoku grid, which is translated to the screen as sprites. A cursor can be moved around the grid and a number entered into the cell location matching the cursor when the A key is released (at the moment, just a 1).
This works for most of the cells, except for some odd behaviour... basically:
(1) The number entered at grid X 0, grid Y 8 appears at X 1, Y 0 instead
(2) A similar thing happens for the other X locations on Y 8, where the number appears in the next column along and the top row instead
(3) Number entered at X 8, Y 8 appears as expected
(4) If a number is entered at X 8, Y 0 (or X 7, Y 8 with the above bug) then the cursor doesn't respond to the key inputs
I tested the program by forcing numbers into the cells at cell initialisation, at which point bugs (1) and (2) still occur but not (4). (4) only occurs when the cursor is moved on X 8, Y 0 (or X 7, Y 8) and the number entered.
I'm using this code to update the number at the cursor location:
...and this is the code that I use to update the cell:
If the problem isn't here, then the rest of the code (and compiled ROM file) can be found here:
Gbasudoku.Zip by Bigupload.Com
Thanks for your help in advance!
_________________
I'd like to think this signature is under development, but it isn't.
I'm working on a basic Sudoku program and so far I have a 9 x 9 2D array where each entry describes a cell in the Sudoku grid, which is translated to the screen as sprites. A cursor can be moved around the grid and a number entered into the cell location matching the cursor when the A key is released (at the moment, just a 1).
This works for most of the cells, except for some odd behaviour... basically:
(1) The number entered at grid X 0, grid Y 8 appears at X 1, Y 0 instead
(2) A similar thing happens for the other X locations on Y 8, where the number appears in the next column along and the top row instead
(3) Number entered at X 8, Y 8 appears as expected
(4) If a number is entered at X 8, Y 0 (or X 7, Y 8 with the above bug) then the cursor doesn't respond to the key inputs
I tested the program by forcing numbers into the cells at cell initialisation, at which point bugs (1) and (2) still occur but not (4). (4) only occurs when the cursor is moved on X 8, Y 0 (or X 7, Y 8) and the number entered.
I'm using this code to update the number at the cursor location:
Code: |
if(key_released(KEY_A)) { sudokuGrid[gridCursor.x][gridCursor.y].cellEntry = 1; UpdateSprite(&sudokuGrid[gridCursor.x][gridCursor.y]); } |
...and this is the code that I use to update the cell:
Code: |
void UpdateSprite(GridEntry* ent) { ent->gfxID = ent->cellEntry * 4; ent->oam->attribute[2] = ent->gfxID; } |
If the problem isn't here, then the rest of the code (and compiled ROM file) can be found here:
Gbasudoku.Zip by Bigupload.Com
Thanks for your help in advance!
_________________
I'd like to think this signature is under development, but it isn't.