The problem is that when I try to print the matrix that contains the data of the sudoku, it prints correcty only the half of the matrix.
I would appreciate any help. Thank you.
Code: Select all
#include <genesis.h>
typedef struct
{
short *board;
} sudoku;
void PaintMatrix(sudoku mySudoku)
{
short i;
short j;
short *p;
p=mySudoku.board;
for(i=0;i<9;i++)
{
for(j=0;j<9;j++)
{
char a = *p+'0';
VDP_drawText(&a, j*2+2, i*2+2);
p++;
}
}
}
sudoku LoadSudoku()
{
sudoku mySudoku;
short board1[9][9]= {
{1, 2, 3, 4, 5, 6, 7, 8, 9} ,
{2, 2, 3, 4, 5, 6, 7, 8, 8} ,
{3, 2, 3, 4, 5, 6, 7, 8, 7} ,
{4, 2, 3, 4, 5, 6, 7, 8, 6} ,
{5, 2, 3, 4, 5, 6, 7, 8, 5} ,
{6, 2, 3, 4, 5, 6, 7, 8, 4} ,
{7, 2, 3, 4, 5, 6, 7, 8, 3} ,
{8, 2, 3, 4, 5, 6, 7, 8, 2} ,
{9, 2, 3, 4, 5, 6, 7, 8, 1}
};
mySudoku.board = &board1[0][0];
return mySudoku;
}
int main()
{
sudoku mySudoku = LoadSudoku();
PaintMatrix(mySudoku);
while(1)
{
//wait for screen refresh
VDP_waitVSync();
}
return (0);
}