本文整理汇总了Python中Board.printD方法的典型用法代码示例。如果您正苦于以下问题:Python Board.printD方法的具体用法?Python Board.printD怎么用?Python Board.printD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Board
的用法示例。
在下文中一共展示了Board.printD方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: import Board [as 别名]
# 或者: from Board import printD [as 别名]
def main():
life=3
move=0
side=0
level=1
while(1):
screen=Board()
p1=Player(24,2)
screen.printP(24,2,'P')
d1=Donkey(4,5)
screen.printD(4,5,'D')
os.system("clear") #clears the terminal screen!
screen.coingen()
screen.screenout()
while(1):
print "Let's Save The Queen!!"
print "Enter your move :"
PX=p1.getX()
PY=p1.getY()
ch=getchar()
if(ch=='q'):
break
if(ch=='a' or ch=='A'):
side=1
if(screen.checkCHAR(PX,PY-1,'Q')):
screen.saved('1')
level+=1
break
elif(ch=='D' or ch=='d'):
side=0
prevPX=p1.getX()
prevPY=p1.getY()
prevDX=d1.getX()
prevDY=d1.getY()
d1.move(screen,d1)
DX=d1.getX()
DY=d1.getY()
p1.move(ch,screen,side)
PX=p1.getX()
PY=p1.getY()
if(((((ch=='a' or ch=='A') or(ch=='d' or ch=='D') )and ((prevDX==PX and prevDY==PY) and (prevPX==DX and prevPY==DY))) or (DX==PX and DY==PY) )and (life>0)):
life-=1
break
print ""
os.system("clear")
screen.screenout()
print "Level :",
print level
print "Score :",
print screen.getscore()
print "Life :",
print life
if(DX==PX and DY==PY):
screen.printD(PX,PY,'D')
if(life>0):
continue
else:
break
if(ch=='q'):
break
if(life==0):
print "Sorry U can't make it!!"
break
elif(life>0):
continue
elif(screen.checkSAVED()==1):
print "Queen Saved!!",
continue
elif(screen.checkSAVED()==0):
print "Let's Try Again!!",
print ""
print "Final Score :",
print screen.getscore()
print "Life :",
print life
print "Level Reached :",
print level