avva: (Default)
[personal profile] avva
Забавная головоломка: Signpost

(нужна джава в браузере, или можно скачать отдельную версию)

Нужно соединять (drag and drop) клетки по направлению стрелок - но необязательно соседние - так что в итоге будет полный обход всей доски. В меню можно выбрать варианты посложнее - тот, который 7x7 действительно заставляет задуматься и напрячь мозги. Тем, как надо думать, напоминает судоку, но значительно интереснее, по-моему.

(вообще хорошая коллекция простых игрушек на подумать на несколько минут. Автор, Саймон Тейтем, знаменит в определенных кругах как автор программы Putty).

Date: 2012-04-13 07:11 pm (UTC)
From: [identity profile] denspb.livejournal.com
Довольно незатейливо (http://svn.tartarus.org/sgt/puzzles/signpost.c?revision=9384&view=markup</a>):

/* Better generator: with the 'generate, sprinkle numbers, solve,
* repeat' algorithm we're _never_ generating anything greater than
* 6x6, and spending all of our time in new_game_fill (and very little
* in solve_state).
*
* So, new generator steps:
* generate the grid, at random (same as now). Numbers 1 and N get
immutable flag immediately.
* squirrel that away for the solved state.
*
* (solve:) Try and solve it.
* If we solved it, we're done:
* generate the description from current immutable numbers,
* free stuff that needs freeing,
* return description + solved state.
* If we didn't solve it:
* count #tiles in state we've made deductions about.
* while (1):
* randomise a scratch array.
* for each index in scratch (in turn):
* if the cell isn't empty, continue (through scratch array)
* set number + immutable in state.
* try and solve state.
* if we've solved it, we're done.
* otherwise, count #tiles. If it's more than we had before:
* good, break from this loop and re-randomise.
* otherwise (number didn't help):
* remove number and try next in scratch array.
* if we've got to the end of the scratch array, no luck:
free everything we need to, and go back to regenerate the grid.
*/

December 2025

S M T W T F S
  123 4 56
78 9 10 11 1213
1415 1617181920
21 22 23 24 2526 27
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Dec. 28th, 2025 01:03 pm
Powered by Dreamwidth Studios