diff options
| author | Simon Tatham <anakin@pobox.com> | 2004-05-01 08:58:48 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2004-05-01 08:58:48 +0000 |
| commit | b1bfb378f4132d77994bf351c63e37b76907021b (patch) | |
| tree | 87df5a7b7c40783afc7bfdd6082b5fa567905223 | |
| parent | 4e5a0a3d67e95f515f8bef7cb9bbd103cab89aa7 (diff) | |
| download | puzzles-b1bfb378f4132d77994bf351c63e37b76907021b.zip puzzles-b1bfb378f4132d77994bf351c63e37b76907021b.tar.gz puzzles-b1bfb378f4132d77994bf351c63e37b76907021b.tar.bz2 puzzles-b1bfb378f4132d77994bf351c63e37b76907021b.tar.xz | |
Remove arbitrary restriction on Net minimum game size. (Awww, cute
2x2! Cuter 2x1!)
[originally from svn r4181]
| -rw-r--r-- | net.c | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -215,8 +215,8 @@ game_state *new_game(game_params *params, char *seed) tree234 *possibilities, *barriers; int w, h, x, y, nbarriers; - assert(params->width > 2); - assert(params->height > 2); + assert(params->width > 0 && params->height > 0); + assert(params->width > 1 || params->height > 1); /* * Create a blank game state. @@ -296,11 +296,15 @@ game_state *new_game(game_params *params, char *seed) * closed loops. [] */ possibilities = newtree234(xyd_cmp); - - add234(possibilities, new_xyd(state->cx, state->cy, R)); - add234(possibilities, new_xyd(state->cx, state->cy, U)); - add234(possibilities, new_xyd(state->cx, state->cy, L)); - add234(possibilities, new_xyd(state->cx, state->cy, D)); + + if (state->cx+1 < state->width) + add234(possibilities, new_xyd(state->cx, state->cy, R)); + if (state->cy-1 >= 0) + add234(possibilities, new_xyd(state->cx, state->cy, U)); + if (state->cx-1 >= 0) + add234(possibilities, new_xyd(state->cx, state->cy, L)); + if (state->cy+1 < state->height) + add234(possibilities, new_xyd(state->cx, state->cy, D)); while (count234(possibilities) > 0) { int i; |