赞
踩
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)
'---------------
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。