示例#1
0
 def cpu4(self,field,puyo):
   kekka=np.zeros((3,22),dtype=np.int)
   aipuyo=AIPuyo()
   for i in range(22):
     aifield=AIField(field)
     aipuyo.syokika(puyo)
     a=self.cpu_idouhantei(aifield,aipuyo,i+1)
     if a==1:
       aipuyo.puyooki(i+1)
       aipuyo.rakka(aifield)
       if aifield.shin_rensashirabe()>=5:
         return i+1
       if aifield.renketusirabe5(aipuyo):
         continue
       b=aifield.renketusirabe4(aipuyo)
       kekka[0][i]=b[0]
       kekka[1][i]=b[1]
       kekka[2][i]=aifield.rensashirabe()
   rensamax=kekka[2].max()
   for i in range(22):
     if kekka[2][i]!=rensamax:
       kekka[0][i]=0
   renketumax=kekka[0].max()
   for i in range(22):
     if kekka[0][i]!=renketumax:
       kekka[1][i]=100000
   return kekka[1].argmin()+1
示例#2
0
 def cpu3(self,field,puyo):
   kekka=np.zeros((2,22),dtype=np.int)
   aipuyo=AIPuyo()
   for i in range(22):
     aifield=AIField(field)
     aipuyo.syokika(puyo)
     a=self.cpu_idouhantei(aifield,aipuyo,i+1)
     if a==1:
       aipuyo.puyooki(i+1)
       aipuyo.rakka(aifield)
       b=aifield.renketusirabe2(i+1,aipuyo)
       kekka[0][i]=b[0]
       kekka[1][i]=b[1]
   renketumax=kekka[0].max()
   for i in range(22):
     if kekka[0][i]!=renketumax:
       kekka[1][i]=100000
   return kekka[1].argmin()+1
示例#3
0
    def run(self):
        sakiyomicpu_c = 0
        kirikae_c = 0
        while True:
            if kirikae_c == 0:
                karifield = AIField(field2.haichi)
                karipuyo = AIPuyo()
                karipuyo.syokika(puyo_2)
                karipuyo.puyooki(cpu2.cpu_c)
                karipuyo.rakka(karifield.haichi)
                karifield.sokurensa()
                imapuyo = AIPuyo()
                imapuyo.puyo1iro = puyo_2.nexnex[0]
                imapuyo.puyo2iro = puyo_2.nexnex[1]
                if puyo_2.hajime_c == 1:
                    imapuyo.puyo1x = 3
                    imapuyo.puyo1y = 13
                    imapuyo.puyo2x = 3
                    imapuyo.puyo2y = 12
                else:
                    imapuyo.puyo1x = puyo_2.puyo1x
                    imapuyo.puyo1y = puyo_2.puyo1y
                    imapuyo.puyo2x = puyo_2.puyo2x
                    imapuyo.puyo2y = puyo_2.puyo2y


#        t1=time.time()
                sakiyomicpu_c = cpu2.ai4(karifield.haichi, imapuyo)
                #        t2=time.time()
                #        print(t2-t1)
                kirikae_c = 1
            else:
                if puyo_2.imapuyo_c == 0:
                    cpu2.cpu_c = sakiyomicpu_c
                    #          print(cpu2.cpu_c)
                    kirikae_c = 0
                    puyo_2.imapuyo_c = 1
                time.sleep(0.001)
示例#4
0
    def run(self):
        sakiyomicpu_c = 0
        kirikae_c = 0
        sousamati_c = 0
        while True:
            if cpu.cpu_sousa_c == 0:
                sousamati_c += 1
            else:
                sousamati_c = 0
            if sousamati_c >= 30:
                karifield = AIField(field2.haichi)
                karifield.zenkeshihyouji = field2.zenkeshihyouji
                imapuyo = AIPuyo()
                imapuyo.syokika(puyo_2)
                imapuyo2 = AIPuyo()
                imapuyo2.puyo1iro = puyo_2.nexnex[0]
                imapuyo2.puyo2iro = puyo_2.nexnex[1]
                imapuyo2.puyo1x = 3
                imapuyo2.puyo1y = 13
                imapuyo2.puyo2x = 3
                imapuyo2.puyo2y = 12
                cpu2.cpu_c = cpu2.ai11(karifield, field1, imapuyo, imapuyo2)
                time.sleep(0.001)
                sousamati_c = 0

            if kirikae_c == 0:
                karifield = AIField(field2.haichi)
                karifield.zenkeshihyouji = field2.zenkeshihyouji
                karipuyo = AIPuyo()
                karipuyo.syokika(puyo_2)
                karipuyo.puyooki(cpu2.cpu_c)
                karipuyo.rakka(karifield.haichi)
                karifield.sokurensa()
                imapuyo = AIPuyo()
                imapuyo2 = AIPuyo()
                imapuyo.puyo1iro = puyo_2.nexnex[0]
                imapuyo.puyo2iro = puyo_2.nexnex[1]
                imapuyo2.puyo1iro = puyo_2.nexnex[2]
                imapuyo2.puyo2iro = puyo_2.nexnex[3]
                imapuyo.puyo1x = 3
                imapuyo.puyo1y = 13
                imapuyo.puyo2x = 3
                imapuyo.puyo2y = 12
                imapuyo2.puyo1x = 3
                imapuyo2.puyo1y = 13
                imapuyo2.puyo2x = 3
                imapuyo2.puyo2y = 12
                t1 = time.time()
                #        pr=Profile()
                #        pr.enable()
                sakiyomicpu_c = cpu2.ai11(karifield, field1, imapuyo, imapuyo2)
                #        pr.disable()
                #        pr.print_stats()
                t2 = time.time()
                print(t2 - t1)
                kirikae_c = 1
                sousamati_c = 0
            else:
                if puyo_2.imapuyo_c == 0:
                    puyo_2.kaiten_c = 0
                    puyo_2.migi_c = 0
                    puyo_2.hidari_c = 0
                    cpu2.cpu_c = sakiyomicpu_c
                    #          print(cpu2.cpu_c)
                    kirikae_c = 0
                    puyo_2.imapuyo_c = 1
                time.sleep(0.001)
示例#5
0
    def run(self):
        sakiyomicpu_c = 0
        kirikae_c = 0
        sousamati_c = 0
        while True:
            if cpu.cpu_sousa_c == 0:
                sousamati_c += 1
            else:
                sousamati_c = 0
            if sousamati_c >= 30:
                karifield = AIField(field1.haichi)
                imapuyo = AIPuyo()
                imapuyo.syokika(puyo_1)
                imapuyo2 = AIPuyo()
                imapuyo2.puyo1iro = puyo_1.nexnex[0]
                imapuyo2.puyo2iro = puyo_1.nexnex[1]
                imapuyo2.puyo1x = 3
                imapuyo2.puyo1y = 13
                imapuyo2.puyo2x = 3
                imapuyo2.puyo2y = 12
                cpu.cpu_c = cpu.ai8(karifield, field2, imapuyo, imapuyo2)
                time.sleep(0.001)
                sousamati_c = 0

            if kirikae_c == 0:
                karifield = AIField(field1.haichi)
                karipuyo = AIPuyo()
                karipuyo.syokika(puyo_1)
                karipuyo.puyooki(cpu.cpu_c)
                karipuyo.rakka(karifield.haichi)
                karifield.sokurensa()
                imapuyo = AIPuyo()
                imapuyo2 = AIPuyo()
                imapuyo.puyo1iro = puyo_1.nexnex[0]
                imapuyo.puyo2iro = puyo_1.nexnex[1]
                imapuyo2.puyo1iro = puyo_1.nexnex[2]
                imapuyo2.puyo2iro = puyo_1.nexnex[3]
                imapuyo.puyo1x = 3
                imapuyo.puyo1y = 13
                imapuyo.puyo2x = 3
                imapuyo.puyo2y = 12
                imapuyo2.puyo1x = 3
                imapuyo2.puyo1y = 13
                imapuyo2.puyo2x = 3
                imapuyo2.puyo2y = 12
                #        t1=time.time()
                #        pr=Profile()
                #        pr.enable()
                sakiyomicpu_c = cpu.ai8(karifield, field2, imapuyo, imapuyo2)
                #        pr.disable()
                #        pr.print_stats()
                #        t2=time.time()
                #        print(t2-t1)
                kirikae_c = 1
                sousamati_c = 0
            else:
                if puyo_1.imapuyo_c == 0:
                    cpu.cpu_c = sakiyomicpu_c
                    print(cpu.cpu_c)
                    kirikae_c = 0
                    puyo_1.imapuyo_c = 1
                time.sleep(0.001)