LH 1 tahun lalu
induk
melakukan
56b621998b
1 mengubah file dengan 13 tambahan dan 17 penghapusan
  1. 13 17
      QuickStuff/src/main/java/GPN/BotGame.java

+ 13 - 17
QuickStuff/src/main/java/GPN/BotGame.java

@@ -1,7 +1,5 @@
 package GPN;
 
-import de.nplusc.izc.tools.baseTools.Detectors;
-import de.nplusc.izc.tools.baseTools.Tools;
 import org.apache.logging.log4j.Level;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -52,7 +50,7 @@ public class BotGame {
         FFQueue.add(new int[]{x,y,g});
         return boardFF(id);
     }
-
+    int heads_touched = 0;
     private int boardFF(int  id)
     {
         int rv_r=0;
@@ -88,6 +86,7 @@ public class BotGame {
             if(headBuffer[y][cwi]||headBuffer[y][cei]||headBuffer[csi][x]||headBuffer[cni][x])
             {
                 rv_r+= g==0?1:0;
+                heads_touched++;
                 continue;
             }
             boardFF[y][x]=id;
@@ -141,13 +140,6 @@ public class BotGame {
     }
 
     public void game(){
-        new Thread(()->{
-            while(true)
-            {
-                Tools.dlg(false,"Toggle","any");
-                switchItharder=!switchItharder;
-            }
-        });//.start();
         returnMsgs.add("join|masterX244|öoewiuvföewugewgw");
         try {
             Socket sck=new Socket("gpn-tron.duckdns.org", 4000);
@@ -276,6 +268,7 @@ public class BotGame {
 
                             }
                             if(ln.contains("tick")&&gaming) {
+                                heads_touched=0;
                                 String boardview = "";
                                 for(int i=0;i<ch;i++)
                                 {
@@ -428,17 +421,25 @@ public class BotGame {
                                             north=0;
                                     }
                                 }
-                                if((highest<((cw*ch)/playercount)||playercount<3))
+                                if((highest<((cw*ch)/(playercount+1))||playercount<3))
                                 {
                                     l.info("Switcheroo zone reached");
 
                                     if(ticksSinceStart %10==0)
                                     {
                                         l.info("chkFlick");
+                                        if(heads_touched<2&&playercount>5&&ticksSinceStart>150)
+                                        {
+                                            l.info("headcount:"+heads_touched);
+                                            switcheroo=!switcheroo;
+                                        }
                                         if((ticksSinceStart /10)%3<2)
                                         {
                                             l.info("flick");
                                             switcheroo=!switcheroo;
+                                        } {
+                                            l.info("flick");
+                                            switcheroo=!switcheroo;
                                         }
                                     }
                                 }
@@ -530,7 +531,7 @@ public class BotGame {
                         }
                         else
                         {
-                            return;
+                           throw new Error();
                         }
 
                     } catch (IOException ex) {
@@ -581,11 +582,6 @@ public class BotGame {
         } catch (InterruptedException e) {
             throw new RuntimeException(e);
         }
-        game();
-        if(Detectors.isJavaw())
-        {
-            JOptionPane.showMessageDialog(null, "Host given to Program is invalid", "ERROR", JOptionPane.ERROR_MESSAGE);
-        }
     }
     }
 }