Forgot password
 Register account
View 253|Reply 3

随机生成自避行走

[Copy link]

3203

Threads

7842

Posts

48

Reputation

Show all posts

hbghlyj posted 2023-5-25 06:05 |Read mode
在$n\times n$网格如何随机生成自避行走
下面是基于对称的,不是随机生成的.

3203

Threads

7842

Posts

48

Reputation

Show all posts

original poster hbghlyj posted 2023-5-25 06:19

3203

Threads

7842

Posts

48

Reputation

Show all posts

original poster hbghlyj posted 2023-5-25 08:08

暴力尝试🥵

$type rand.asy (1.03 KB, Downloads: 73)
取$n=8$,随机种子s从s=1开始尝试,大多数都(走到死胡同了)不能产生哈密顿路.一直到s=26098才成功.

3203

Threads

7842

Posts

48

Reputation

Show all posts

original poster hbghlyj posted 2023-5-25 08:47
find改写(需要find四次,可能还不如4#的一遍循环快):
$type rand.asy (1.07 KB, Downloads: 81)

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-3 11:45 GMT+8

Powered by Discuz!

Processed in 0.019235 seconds, 25 queries