当前位置:   article > 正文

python完整游戏代码_PYTHON小游戏代码

python代码小游戏

from

random

import

choice

cava_numbers

=

range(0,20)

cavas

=

[]

for

i

in

cava_numbers:

cavas.append([])

unvisited_cavas

=

range(0,20)

visited_cavas

=

[0]

unvisited_cavas.remove(0)

while

unvisited_cavas

!=

[]:

i

=

choice(visited_cavas)

if

len(cavas[i])>=3:

continue

next_cava

=

choice(unvisited_cavas)

cavas[i].append(next_cava)

cavas[next_cava].append(i)

visited_cavas.append(next_cava)

unvisited_cavas.remove(next_cava)

for

i

in

cava_numbers:

while

len(cavas[i])<3:

passage_to

=

choice(cava_numbers)

cavas[i].append(passage_to)

print

'---------------

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Li_阴宅/article/detail/769035
推荐阅读
相关标签
  

闽ICP备14008679号