Forgot password?
 Register account
View 258|Reply 3

随机生成自避行走

[Copy link]

3152

Threads

7905

Posts

610K

Credits

Credits
64068
QQ

Show all posts

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

3152

Threads

7905

Posts

610K

Credits

Credits
64068
QQ

Show all posts

 Author| hbghlyj Posted 2023-5-25 06:19

3152

Threads

7905

Posts

610K

Credits

Credits
64068
QQ

Show all posts

 Author| hbghlyj Posted 2023-5-25 08:08

暴力尝试🥵

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

3152

Threads

7905

Posts

610K

Credits

Credits
64068
QQ

Show all posts

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

Mobile version|Discuz Math Forum

2025-6-4 17:06 GMT+8

Powered by Discuz!

× Quick Reply To Top Edit