~mdw
/
sgt
/
puzzles
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Stand-alone command-line interface to the obfuscate_bitmap()
[sgt/puzzles]
/
unequal.c
diff --git
a/unequal.c
b/unequal.c
index
c805975
..
20fc2d2
100644
(file)
--- a/
unequal.c
+++ b/
unequal.c
@@
-408,6
+408,11
@@
static int c2n(int c, int order) {
return -1;
}
return -1;
}
+static int game_can_format_as_text_now(game_params *params)
+{
+ return TRUE;
+}
+
static char *game_text_format(game_state *state)
{
int x, y, len, n;
static char *game_text_format(game_state *state)
{
int x, y, len, n;
@@
-896,7
+901,7
@@
static int gg_best_clue(game_state *state, int *scratch, digit *latin)
best = i; maxposs = nposs; minclues = nclues;
#ifdef STANDALONE_SOLVER
if (solver_show_working)
best = i; maxposs = nposs; minclues = nclues;
#ifdef STANDALONE_SOLVER
if (solver_show_working)
- printf("gg_best_clue: b%d (%d,%d) new best [%d poss, %d clues].",
+ printf("gg_best_clue: b%d (%d,%d) new best [%d poss, %d clues].
\n
",
best, x, y, nposs, nclues);
#endif
}
best, x, y, nposs, nclues);
#endif
}
@@
-996,7
+1001,7
@@
static char *new_game_desc(game_params *params, random_state *rs,
{
digit *sq = NULL;
int i, x, y, retlen, k, nsol;
{
digit *sq = NULL;
int i, x, y, retlen, k, nsol;
- int o2 = params->order * params->order, ntries =
0
;
+ int o2 = params->order * params->order, ntries =
1
;
int *scratch, lscratch = o2*5;
char *ret, buf[80];
game_state *state = blank_game(params->order);
int *scratch, lscratch = o2*5;
char *ret, buf[80];
game_state *state = blank_game(params->order);
@@
-1034,7
+1039,7
@@
generate:
if (nsol > 0) {
#ifdef STANDALONE_SOLVER
if (solver_show_working)
if (nsol > 0) {
#ifdef STANDALONE_SOLVER
if (solver_show_working)
- printf("game_assemble: puzzle as generated is too easy.");
+ printf("game_assemble: puzzle as generated is too easy.
\n
");
#endif
if (ntries < MAXTRIES) {
ntries++;
#endif
if (ntries < MAXTRIES) {
ntries++;
@@
-1042,7
+1047,7
@@
generate:
}
#ifdef STANDALONE_SOLVER
if (solver_show_working)
}
#ifdef STANDALONE_SOLVER
if (solver_show_working)
- printf("Unable to generate %s %dx%d after %d attempts.",
+ printf("Unable to generate %s %dx%d after %d attempts.
\n
",
unequal_diffnames[params->diff],
params->order, params->order, MAXTRIES);
#endif
unequal_diffnames[params->diff],
params->order, params->order, MAXTRIES);
#endif
@@
-1051,7
+1056,7
@@
generate:
}
#ifdef STANDALONE_SOLVER
if (solver_show_working)
}
#ifdef STANDALONE_SOLVER
if (solver_show_working)
- printf("new_game_desc: generated %s puzzle; %d attempts (%d solver).",
+ printf("new_game_desc: generated %s puzzle; %d attempts (%d solver).
\n
",
unequal_diffnames[params->diff], ntries, gg_solved);
#endif
unequal_diffnames[params->diff], ntries, gg_solved);
#endif
@@
-1266,7
+1271,8
@@
static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
button &= ~MOD_MASK;
button &= ~MOD_MASK;
- if (x >= 0 && x < ds->order && y >= 0 && y < ds->order) {
+ if (x >= 0 && x < ds->order && ((ox - COORD(x)) <= TILE_SIZE) &&
+ y >= 0 && y < ds->order && ((oy - COORD(y)) <= TILE_SIZE)) {
if (button == LEFT_BUTTON) {
/* normal highlighting for non-immutable squares */
if (GRID(state, flags, x, y) & F_IMMUTABLE)
if (button == LEFT_BUTTON) {
/* normal highlighting for non-immutable squares */
if (GRID(state, flags, x, y) & F_IMMUTABLE)
@@
-1290,8
+1296,6
@@
static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
return "";
}
}
return "";
}
}
- if (button == 'H' || button == 'h')
- return dupstr("H");
if (ui->hx != -1 && ui->hy != -1) {
debug(("button %d, cbutton %d", button, (int)((char)button)));
if (ui->hx != -1 && ui->hy != -1) {
debug(("button %d, cbutton %d", button, (int)((char)button)));
@@
-1317,6
+1321,10
@@
static char *interpret_move(game_state *state, game_ui *ui, game_drawstate *ds,
return dupstr(buf);
}
return dupstr(buf);
}
+
+ if (button == 'H' || button == 'h')
+ return dupstr("H");
+
return NULL;
}
return NULL;
}
@@
-1735,7
+1743,7
@@
const struct game thegame = {
dup_game,
free_game,
TRUE, solve_game,
dup_game,
free_game,
TRUE, solve_game,
- TRUE, game_text_format,
+ TRUE, game_
can_format_as_text_now, game_
text_format,
new_ui,
free_ui,
encode_ui,
new_ui,
free_ui,
encode_ui,