|
View previous topic :: View next topic |
Author |
Message |
| zhouyundong
| Joined: 22 Nov 2008 | Posts: 43 | : | | Items |
|
Posted: Fri Mar 06, 2009 2:35 pm Post subject: |
|
|
Code: | bool readFile(char* fileName)
{
int i;
FILE *fp;
char str[1000];
if((fp=fopen(fileName, "r")) == NULL) return false;
fgets(str, 1000, fp);
if(!legalCheck(str))
{
return false;
}
for(i=0; i<81>= '0' && str[i] <= '9')
{
leftBoard[i] = str[i] - '0';
}
else
{
leftBoard[i] = 0;
}
}
for(i=81; i<243; i+=2)
{
leftSum[(i-81)/2] = (str[i]-'0')*10+(str[i+1]-'0');
}
for(i=243; i<405; i+=2)
{
leftIdx[(i-243)/2] = (str[i]-'0')*10+(str[i+1]-'0');
}
for(i=405; i<549; i++)
{
leftPare[i-405] = str[i]-'0';
}
for(i=549; i<693; i++)
{
leftKilpare[i-549] = str[i]-'0';
}
for(i=693; i<855; i+=2)
{
leftSaw[(i-693)/2] = (str[i]-'0')*10+(str[i+1]-'0');
}
for(i=855; i<936; i++)
{
leftExtra[i-855] = str[i] - '0';
}
fclose(fp);
return true;
}
void CMainWin::OnMenuSodoku()
{
if(underThinking) return;
initialSodoku();
initialCommon();
InitMyCaret();
InvalidateRect(NULL, TRUE);
}
void CMainWin::OnMenuSosum()
{
if(underThinking) return;
initialSosum();
initialCommon();
InitMyCaret();
InvalidateRect(NULL, TRUE);
}
void CMainWin::OnMenuSopare()
{
if(underThinking) return;
initialSopare();
initialCommon();
InitMyCaret();
InvalidateRect(NULL, TRUE);
}
void CMainWin::OnMenuSomix()
{
if(underThinking) return;
initialSomix();
setInitSaw();
initialCommon();
InitMyCaret();
InvalidateRect(NULL, TRUE);
}
void CMainWin::OnMenuJigsaw()
{
if(underThinking) return;
initialJigsaw();
initialCommon();
InitMyCaret();
InvalidateRect(NULL, TRUE);
}
void CMainWin::OnMenuSoextra()
{
if(underThinking) return;
initialSoextra();
initialCommon();
InitMyCaret();
InvalidateRect(NULL, TRUE);
}
void initialSodoku()
{
moveSum('0', 'l'); // 0 to leftSum
moveIdx('0', 'l'); // 0 to leftIdx
movePare('0', 'l'); // 0 to leftPare
moveKilpare('0', 'l'); // 0 to leftPare
moveHead('0', 'l'); // 0 to leftHead
moveUniq('0', 'l'); // 0 to leftUniq
moveSaw('0', 'l'); // 0 to leftSaw
moveExtra('0', 'l'); // 0 to leftExtra
editKind = 0;
gameKind = 0;
firstIntoSodoku = true;
}
|
|
|
Back to top |
|
|
| serbo
| Joined: 22 Dec 2008 | Posts: 6 | : | | Items |
|
Posted: Thu Jun 25, 2009 4:52 pm Post subject: |
|
|
briturner wrote: |
I have various pieces already working:
- Greater Than / Less Than Solver - Not as fast as I like, but running
- Greater Than / Less Than Generator - Also, not as fast as I like, but working. I can generate some 10k puzzles while I sleep on my laptop if I want. One interesting note on a generator is that even if you fill in every comparison, you are not guaranteed a unique solution.
- Killer Sudoku Solver working - No generator for this, so I only have a small number of test cases to work with
- Jigsaw Generator part 1 working - I can generate XxX grids with X boxes of X cells in each. I was playing around with this and generated up to 250x250 grids. I have not done the second part, which adds the numbers into the grids.
|
I am interested in jigsaw generator. Is it possible to download your implementation? |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
Igloo Theme Version 1.0 :: Created By: Andrew Charron
|