我需要制作2个玩家的Ludo游戏,每个玩家有4个数字。木板的长度是12。输出必须处于健谈模式:
Blue, out: 4, home line: . | . | . | . (home starts before 1)
Red , out: 4, home line: . | . | . | . (home starts before 7)
01 02 03 04 05 06 07 08 09 10 11 12
. . . . . . . . . . . .
指示哪个玩家掷骰子,哪个数字出来以及计划中每个人物的移动,例如:
Red throws 6 (cannot move)
Blue, out: 3, home line: . | . | . | . (home starts before 1)
Red , out: 3, home line: . | . | . | . (home starts before 7)
01 02 03 04 05 06 07 08 09 10 11 12
. . B1 . . . R1 . . . . .
Red throws 5
Blue, out: 3, home line: . | . | . | . (home starts before 1)
Red , out: 3, home line: . | . | . | . (home starts before 7)
01 02 03 04 05 06 07 08 09 10 11 12
. . B1 . . . . . . . . R1
我设法得到了健谈的形式,但是我对数字的移动有疑问,确切地说,是将数字放在其起始位置然后再移动:
01 02 03 04 05 06 07 08 09 10 11 12
B1 . . . . . . . . . . .
-----------------------------------
01 02 03 04 05 06 07 08 09 10 11 12
. . B1 . . . R1 . . . . .
-----------------------------------
01 02 03 04 05 06 07 08 09 10 11 12
B2 . . B1 . . . . . . . R1
-----------------------------------
01 02 03 04 05 06 07 08 09 10 11 12
. B3 . . . R2 . . . . . .
etc.
及其放置在房屋中的位置,以房屋线标记,其中点表示自由点,*表示该数字已经存在:
Red throws 3
Blue, out: 2, home line: . | . | . | . (home starts before 1)
Red , out: 3, home line: . | . | . | . (home starts before 7)
01 02 03 04 05 06 07 08 09 10 11 12
B2 . . . . R1 . . B1 . . .
Blue throws 4
Blue, out: 2, home line: * | . | . | . (home starts before 1)
Red , out: 3, home line: . | . | . | . (home starts before 7)
01 02 03 04 05 06 07 08 09 10 11 12
B2 . . . . R1 . . . . . .
并将其与骰子结合起来,我至少要掷3次,直到6个不会出来:
def throw_dice():
r = randint(1,6)
is r == 6 or r == 6 or r == 6:
return randint(1,6)
return r
有人可以帮助我吗?我真的很感激。