• 个人简介

    import random
    a=[[1,1,1,1,1,0,0,0,0,0,0,0,-1,-1,-1,-1],
       [1,1,1,1,0,0,0,0,-1,-1,-1,-3,-3,-3,-3,-3],
       [1,1,1,1,1,0,0,0,10,10,10,10,-1,-1,-1,-1],
       [1,1,0,10,10,10,10,10,-1,-3,-3,-3,-3,-3,-3,-3]]
    b=[[1,1,1,1,1,1,1,1,0,0,0,-1,-1,-1,-1,-1],
       [1,0,-1,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3,-3],
       [1,1,1,1,1,0,0,0,10,-1,-1,-1,-1,-1,-1,-1],
       [1,1,0,10,10,-1,-1,-3,-3,-3,-3,-3,-3,-3,-3,-3]]
    c=[[1,1,1,1,1,0,0,0,0,0,0,0,-1,-1,-1,-1],
       [1,1,0,0,0,0,0,-1,-1,-3,-3,-3,-3,-3,-3,-3],
       [1,1,1,1,1,1,1,0,0,0,10,10,10,10,-1,-1],
       [1,0,0,0,10,10,10,10,10,-1,-3,-3,-3,-3,-3,-3]]
    memory2=[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]#-1,0,1,-3,10
    memory=[[0,0,0],[0,0,0],[0,0,0]]#-1,0,1
    remedy=[0,1,-1]#-1,0,1的反制
    remedy2=[0,1,-1]
    characterseed=random.randint(0,4)
    characterseed=4
    hero=['无','开局一发','巴斯特','汉密尔顿','沮授']
    comhero=playhero=0
    if characterseed==0 or characterseed==2:
        character=a
    elif characterseed==1 or characterseed==3:
        character=b
    elif characterseed==4:
        character=c
    cntcomwin=cntplaywin=0
    maxp=0
    preplayin=precomin=-166
    playin=comin=-50
    
    flagjushouplay=flagjushoucom=flagjushouplayuse=flagjushoucomuse=jsroundcom=jsroundplay=0
    
    def gameinitialize():
        global playin,comin,preplayin,precomin,cntround,comflag10,playflag10,cntp,cntc,playhero,comhero,flagjushouplay,flagjushoucom,flagjushouplayuse
        cntround=0
        comflag10=playflag10=True
        cntp=cntc=0
        playin=comin=-100
        flagjushouplay=flagjushoucom=flagjushouplayuse=0
        if playhero=='开局一发':
            cntp=1
        if comhero=='开局一发':
            cntc=1
    def heroinitial():
        global hero,comhero,playhero
        print('Choose your hero from :')
        print(hero)
        herochoose=int(input('input xiabaio :'))
        playhero=hero[herochoose]
        print('your hero is :',playhero)
        comhero=hero[random.randint(1,len(hero)-1)]
        #comhero=hero[4]############你可以在这里调电脑英雄
        print('computer hero is :',comhero)
    def decisionmake():
        global character,comin,characterseed,cntround,playin,remedy,memory,cntc,cntp
        if cntc<3 and cntp<3:
            strategy=character[0]
        elif cntc>=3 and cntp<3:
            strategy=character[1]
        elif cntc<3 and cntp>=3:
            strategy=character[2]
        else:
            strategy=character[3]
        comin=strategy[random.randint(0,15)]
        if random.randint(0,15)>=10 and characterseed==2 and cntround>=2:
            comin=playin
        if random.randint(0,15)>=10 and characterseed==3 and cntround>=2:
            comin=(playin+3)%3-1
        if random.randint(0,15)>=3 and characterseed==4 and cntround>=2 and playin!=-3 and playin!=10:
            maxx=-1
            maxp=0
            mplayin=playin+1
            if mplayin!=-2 and mplayin!=11:
                for i in range(3):
                    if memory[mplayin][i]>maxx:
                        maxx=memory[mplayin][i]
                        maxp=i
                if memory[mplayin][0]==memory[mplayin][1]==memory[mplayin][2]:
                    comin=strategy[random.randint(0,15)]
                else:
                    comin=remedy[maxp]#
                    if cntp>=3 and random.randint(0,15)>=10 and comflag10==True:
                        comin=10
        
        if cntc>=3 and cntp<3 and playflag10==False:
            comin=-3
        if cntc<=0 and cntp<=0:#必装
            comin=1
        elif cntc<=0 and cntp>=1 and comin==-1:#不小枪
            while comin==-1:
                comin=strategy[random.randint(0,15)]
        elif cntc>=1 and cntp<=0:#不小防
            while comin==0:
                comin=strategy[random.randint(0,15)]
        if comin==10 and comflag10==False:
            comin=1
            
    def playinligalitycheck():
        global playin,cntround
        if playin!='0' and playin!='10' and playin!='-1' and playin!='-3' and playin!='1':
            print("  Regulate Your Input ! Put It In Again !")
            return 0
        playin=int(playin)
        if playin==10 and playflag10==False or playin!=10 and cntp+playin<0:
            print("  Don't Cheat ! Put It In Again !")
            return 0
        return 1
    def printwin():
        global cntplaywin
        cntplaywin+=1
        print('         WIN')
        print('cntcomwin:',cntcomwin,'cntplaywin:',cntplaywin)
        return
    def printlose():
        global cntcomwin
        cntcomwin+=1
        print('         LOST')
        print('cntcomwin:',cntcomwin,'cntplaywin:',cntplaywin)
        return
    def checkwin():
        global comin,playin,comhero,playhero,flagjushouplayuse,flagjushoucomuse
        if comin==1 and playin==-1 or playin==-3 and (comin!=10 and comin!=-3):
            checkres='plawin'  
        elif comin==-1 and playin==1 or (playin!=10 and playin!=-3) and comin==-3:
            checkres='comwin'
        else:
            checkres='tie'
        if playhero=='汉密尔顿':
            if playin==-1 and comin==-1:
                checkres='comwin'
        if comhero=='汉密尔顿':
            if comin==-1 and playin==-1:
                checkres='plawin'
        if playhero=='汉密尔顿' and comhero=='汉密尔顿':
            if playin==-1 and comin==-1:
                checkres='tie'
                
        if playhero=='沮授' and comhero=='沮授' and flagjushoucomuse==1 and flagjushouplayuse==1 and comin==-1 and playin==-1:
            checkres='tie'
            flagjushouplayuse=0
            flagjushoucomuse=0
        if playhero=='沮授' and flagjushouplayuse==1:
            if playin==-1 and comin==-1:
                flagjushouplayuse=0
                checkres='playwin'
        if comhero=='沮授' and flagjushoucomuse==1:
            if comin==-1 and playin==-1:
                flagjushoucomuse=0
                checkres='comwin'
    
        return checkres
    def roundwinvisualize(checkres):
        if checkres=='plawin':
            printwin()
        elif checkres=='comwin':
            printlose()
    def powdercalc():
        global comin,playin,cntc,cntp,playhero,comhero,flagjushouplayuse,flagjushoucomuse
        a=comin
        b=playin
        if comin==10:
            a=0
        if playin==10:
            b=0
        cntc+=a
        cntp+=b
        if playhero=='巴斯特':
            if comin==-1 and (playin==0 or playin==10):
                cntp+=1
            if comin==-3 and playin==10:
                cntp+=3
        if comhero=='巴斯特':
            if playin==-1 and (comin==0 or comin==10):
                cntc+=1
            if playin==-3 and comin==10:
                cntc+=3
                
        if playhero=='汉密尔顿':
            if playin==1:
                cntp+=1
        if comhero=='汉密尔顿':
            if comin==1:
                cntc+=1
        if playhero=='沮授' and flagjushouplayuse==1:
            if  playin==1:
                flagjushouplayuse=0
                cntp+=1
            elif playin==0 or playin==10:
                flagjushouplayuse=0
                if comin==-1 and (playin==0 or playin==10):
                    cntp+=1
                if comin==-3 and playin==10:
                    cntp+=3
        if comhero=='沮授' and flagjushoucomuse==1:
            if  comin==1:
                flagjushoucomuse=0
                cntc+=1
            elif comin==0 or comin==10:
                flagjushoucomuse=0
                if playin==-1 and (comin==0 or comin==10):
                    cntc+=1
                if playin==-3 and comin==10:
                    cntc+=3
    def flagcalc():
        global comflag10,playflag10,flagjushouplay,flagjushoucom,preplayin,precomin,playhero,comhero,flagjushouplayuse,flagjushoucomuse,jsroundplay,jsroundcom
        if playin==10:
            playflag10=False
        if comin==10:
            comflag10=False
        if comhero=='沮授':
            if flagjushoucom==1 and ((comin==1 and playin!=-1 and playin!=-3) or (comin==0 and playin==-1) or (comin==10 and (playin==-1 or playin==-3)) or comin==-1 and playin==-1):
                flagjushoucomuse=1
                print('电脑使用加成!')
                flagjushoucom=0
                jsroundcom=-1
            if jsroundcom<2:
                jsroundcom+=1
            if jsroundcom>=2 and flagjushoucom==0 and checkwin()=='tie' and (precomin==comin or precomin==10 and comin==0 or precomin==0 and comin==10 or precomin==-1 and comin==-3 or precomin==-3 and comin==-1):
                flagjushoucom=1
                print('computer 加成!')#有问题#######################
                
        if playhero=='沮授':
            if flagjushouplay==1 and ((playin==1 and comin!=-1 and comin!=-3) or (playin==0 and comin==-1) or (playin==10 and (comin==-1 or comin==-3)) or playin==-1 and comin==-1):
                flagjushouplayuse=int(input('(0,1回答)是否使用加成:'))
                if flagjushouplayuse==1:
                    print('你使用加成!')
                    flagjushouplay=0
                    jsroundplay=-1
            if jsroundplay<2:
                jsroundplay+=1
            
            if jsroundplay>=2 and flagjushouplay==0 and checkwin()=='tie' and (preplayin==playin or preplayin==10 and playin==0 or preplayin==0 and playin==10 or preplayin==-1 and playin==-3 or preplayin==-3 and playin==-1):
                flagjushouplay=1
                print('player 加成!')
            if jsroundplay<=2:
                jsroundplay+=1
    print('这个游戏由我设计并开发,在2023届一班孵化,设计了很多角色和玩法。于是我试着把游戏留下来')
    print('操作0为防御,操作1为装弹,操作-1为打枪,操作-3为大招。数字代表了其操作对你弹药的改变值')
    print('两人对战,初始弹药数为0和0。当你打枪时对面装弹,则你获胜。此外,每个人都有仅一次出大防10的机会,这是唯一能防住大招的方式。大防不改变弹药数')
    print('巴斯特防住后增加弹药;汉密尔顿一次装两发弹药但是对枪死;开局一发就是开局一发;沮授在连续两次相同类型操作后获得一次加成,可对所有操作进行强化………')
    print('很多角色没时间一一呈现了。我们一共设计了十几个角色,开发了单挑,斗地主,大逃杀,2v2玩法。其中博弈性,配合性最好的当属2v2。')
    print('设计聪明的人机是最难的一环了')
    print('其实立瓶三国杀我们也开发了许多哈哈哈。祝你们有一个快乐的高中时代!')
    print('')
    heroinitial()
    while 1:
        
        gameinitialize()
    
        while cntcomwin<4 and cntplaywin<4:
            cntround+=1
            print('      round:',cntround)
            print('cntcom:',cntc,'cntpla:',cntp)
                        
            preplayin=playin
            playin=input('your decision is:')
            
            
            while not playinligalitycheck():#
                playin=input('your decision is:')
            
            precomin=comin
            decisionmake()
    
            if cntround>=2 and (playin==0 or playin==1 or playin==-1) and (preplayin==0 or preplayin==1 or preplayin==-1):
                memory[preplayin+1][playin+1]+=1
            
            print('comin:',comin,'playin:',playin)
            
            flagcalc()#
    
            powdercalc()#
            
            checkres=checkwin()#
            
            roundwinvisualize(checkres)#
            
            if checkres!='tie':
                break
    
    
            print(' ')
        print(' ')
        
        if cntcomwin>=4:
            print('final winner is COMPUTER')
            break
        if cntplaywin>=4:
            print('final winner is PLAYER')        
            break
    
  • 最近活动

    This person is lazy and didn't join any contests or homework.