Advertisement
Guest User

Untitled

a guest
Nov 5th, 2018
515
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 44.67 KB | None | 0 0
  1. package courage;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Graphics;
  5. import java.awt.Graphics2D;
  6. import java.awt.event.KeyEvent;
  7. import java.awt.event.KeyListener;
  8. import java.util.ArrayList;
  9. import java.util.Arrays;
  10.  
  11. import javax.swing.JFrame;
  12. import javax.swing.JPanel;
  13.  
  14. public class Courage {
  15.  
  16.     static double s = 0;
  17.     static double s1, s2, s3, s4;
  18.     static final double n = 9;
  19.     static final double b = 0.085;
  20.     static final double w = 65537;
  21.     static final double p = 75;
  22.     static double olda = 0;
  23.     static double a = 31;
  24.    
  25.     static final double f = 200;
  26.     static Complex t = new Complex(0, 0);
  27.     static double k = 0;
  28.     static Complex z = new Complex(0, 0);
  29.     static double v = 0;
  30.     static double d = 2;
  31.    
  32.     static Window window;
  33.    
  34.     static boolean m = true;
  35.    
  36.     static Complex[] list4 = new Complex[10];
  37.     static Complex[] list4old = new Complex[10];
  38.    
  39.     //7166: {0.140625, 0.0078125, 0.0078125, -0.0078125, -0.0078125, 0.015625, 0.0390625, 0.0390625, 0.015625, 0.2265625, 0.203125, 0.1640625, -0.0859375, -0.03125, -0.015625, -0.015625, -0.015625, -0.015625, -0.015625, -0.015625, -0.015625, -0.0078125, 0.0078125, 0.0078125, 0.0390625, -0.0390625, 0.03125, -0.0625, -0.0234375, -0.015625, -0.015625, -0.0078125, 0.0, 0.0, 0.0, -0.0234375, -0.0703125, -0.0546875, 0.0078125, -0.078125, 0.0546875, 0.0234375, 0.3671875}
  40.     //7820: {0.140625, 0.0078125, 0.0078125, -0.0078125, -0.0078125, 0.015625, 0.0390625, 0.0390625, 0.015625, 0.2265625, 0.203125, 0.1640625, -0.0859375, -0.03125, -0.015625, -0.015625, -0.015625, -0.015625, -0.015625, -0.015625, -0.015625, -0.0078125, 0.0078125, 0.0078125, 0.0390625, -0.0390625, 0.03125, -0.0625, -0.0234375, -0.015625, -0.015625, -0.0078125, 0.0, 0.0, 0.0, -0.0234375, -0.0703125, -0.0546875, 0.0078125, -0.078125, 0.0546875, 0.0234375, 0.3671875, -0.046875, -0.046875, -0.0078125, -0.0078125, -0.0078125, -0.0078125, -0.0078125, -0.0078125, -0.0078125, -0.0390625, 0.0078125, 0.0078125, 0.0078125, 0.0078125, 0.0078125, 0.0078125, 0.015625, 0.015625, 0.0234375, 0.0234375, 0.0234375, 0.0234375, 0.0234375, 0.0234375, 0.0234375, 0.03125, 0.03125, 0.03125, 0.265625}
  41.     //8800: {0.140625, -0.01953125, -0.03515625, -0.033203125, -0.009765625, -0.009765625, 0.001953125, 0.001953125, 0.001953125, 0.001953125, 0.005859375, 0.044921875, 0.23046875, 0.18359375, 0.041015625, 0.19921875, -0.064453125, -0.01171875, -0.076171875, -0.041015625, -0.048828125, -0.017578125, -0.017578125, -0.013671875, -0.001953125, 0.001953125, 0.001953125, 0.015625, 0.017578125, 0.017578125, 0.0625, 0.09375, 0.08203125, 0.0546875, 0.044921875, 0.1796875, 0.146484375, -0.0703125, -0.048828125, -0.01171875, -0.05078125, -0.033203125, -0.021484375, -0.0234375, -0.0234375, -0.00390625, -0.0078125, -0.0078125, -0.001953125, -0.001953125, 0.0, 0.0, -0.0078125, -0.0078125, -0.001953125, 0.021484375, 0.017578125, 0.013671875, 0.021484375, 0.005859375, 0.013671875, 0.0234375, 0.0234375, 0.0234375, 0.021484375, 0.021484375, 0.017578125, 0.017578125, 0.025390625, 0.0234375, 0.0234375, 0.03125, 0.0234375, 0.0625, -0.0625, -0.0625, -0.0625, -0.0625, -0.064453125, -0.064453125, -0.06640625, -0.033203125, -0.07421875, -0.064453125, -0.015625, -0.015625, -0.01953125, -0.021484375, -0.02734375, -0.01171875, -0.0078125, -0.0078125, -0.013671875}
  42.     //9110: {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.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.125, 0.0234375, 0.97265625, -0.091796875, -0.052734375, -0.03125, -0.013671875, -0.0546875, -0.052734375, -0.021484375, -0.013671875, -0.005859375, -0.0234375, -0.015625, -0.001953125, 0.005859375, 0.00390625, 0.095703125, -0.001953125, -0.001953125, 0.013671875, 0.017578125, 0.0078125, 0.00390625, 0.03515625, 0.017578125, 0.0234375, 0.015625, 0.041015625, 0.04296875, 0.0234375, 0.04296875, 0.083984375, -0.021484375, -0.068359375, -0.107421875, -0.04296875, -0.021484375, -0.09765625, -0.06640625, -0.064453125, -0.05859375, -0.068359375, -0.005859375, -0.005859375, -0.05859375, -0.001953125, -0.033203125, -0.013671875, -0.001953125, -0.013671875, -0.00390625, -0.00390625, -0.00390625, -0.001953125, 0.0078125, -0.01953125, -0.025390625, -0.005859375, -0.005859375, 0.08984375, 0.021484375, 0.021484375, 0.091796875, 0.123046875}
  43.  
  44.     static int nbIterations = 0;
  45.    
  46.     static Double[] list5 = {};
  47.     //static Double[] list5 = {0.142578125, 0.001953125, 0.001953125, 0.080078125, 0.09375, 0.294921875, 0.556640625, -0.03125, -0.01953125, -0.087890625, -0.0546875, -0.05859375, -0.041015625, -0.01953125, -0.00390625, -0.01953125, -0.015625, 0.0, -0.009765625, -0.001953125, 0.00390625, 0.001953125, 0.0078125, 0.025390625, 0.0, 0.005859375, 0.015625, 0.013671875, 0.0078125, 0.0078125, 0.03515625, 0.0546875, 0.041015625, 0.029296875, 0.01171875, 0.08984375, 0.119140625, -0.171875, -0.119140625, -0.025390625, -0.12890625, -0.076171875, -0.037109375, -0.05859375, -0.056640625, -0.0078125, -0.009765625, -0.0390625, -0.013671875, -0.009765625, -0.00390625, -0.0078125, -0.001953125, 0.001953125, -0.009765625, -0.0078125, 0.0, 0.001953125, 0.0078125, 0.005859375, 0.00390625, 0.0234375, 0.025390625, 0.03125, 0.0234375, 0.060546875, 0.009765625, -0.36328125, -0.326171875};
  48.     //static Double[] list5 = {0.140625, 0.01171875, 0.1015625, 0.017578125, 0.138671875, 0.76171875, -0.095703125, -0.015625, -0.068359375, -0.056640625, -0.01171875, -0.046875, -0.033203125, -0.013671875, -0.0234375, -0.0078125, -0.005859375, 0.0, 0.005859375, 0.005859375, 0.00390625, 0.00390625, 0.0078125, 0.02734375, 0.00390625, 0.013671875, 0.009765625, 0.013671875, 0.013671875, 0.01171875, 0.01953125, 0.056640625, 0.033203125, 0.033203125, 0.029296875, 0.00390625, 0.060546875, 0.0234375, 0.03515625, 0.005859375, -0.01953125, -0.037109375, -0.017578125, -0.083984375, -0.138671875, -0.076171875, -0.03125, -0.072265625, -0.076171875, -0.025390625, -0.048828125, -0.009765625, -0.0078125, -0.037109375, -0.005859375, -0.00390625, -0.013671875, -0.001953125, 0.013671875, -0.005859375, -0.001953125, 0.0, 0.00390625, 0.009765625, 0.025390625, 0.015625, 0.025390625, 0.025390625, 0.005859375, 0.099609375, -0.40234375, -0.322265625};
  49.     //static Double[] list5 = {0.140625, 0.01171875, 0.1015625, 0.017578125, 0.138671875, 0.76171875, -0.095703125, -0.015625, -0.068359375, -0.056640625, -0.01171875, -0.046875, -0.033203125, -0.013671875, -0.0234375, -0.0078125, -0.005859375, 0.0, 0.005859375, 0.005859375, 0.00390625, 0.00390625, 0.0078125, 0.02734375, 0.00390625, 0.013671875, 0.009765625, 0.013671875, 0.013671875, 0.01171875, 0.01953125, 0.056640625, 0.033203125, 0.033203125, 0.029296875, 0.00390625, 0.060546875, 0.0234375, 0.03515625, 0.005859375, -0.01953125, -0.037109375, -0.017578125, -0.083984375, -0.138671875, -0.076171875, -0.03125, -0.072265625, -0.076171875, -0.025390625, -0.048828125, -0.009765625, -0.0078125, -0.037109375, -0.005859375, -0.00390625, -0.013671875, -0.001953125, 0.013671875, -0.005859375, -0.001953125, 0.0, 0.00390625, 0.009765625, 0.025390625, 0.015625, 0.025390625, 0.025390625, 0.005859375, 0.099609375, -0.40234375, -0.322265625};
  50.     //static Double[] list5 = {0.140625, 0.005859375, 0.0078125, 0.095703125, 0.123046875, 0.3359375, 0.462890625, -0.033203125, -0.017578125, -0.091796875, -0.056640625, -0.0625, -0.044921875, -0.017578125, -0.00390625, -0.021484375, -0.013671875, -0.001953125, -0.01171875, -0.00390625, 0.00390625, 0.005859375, 0.009765625, 0.017578125, 0.0, 0.00390625, 0.013671875, 0.015625, 0.009765625, 0.005859375, 0.033203125, 0.05078125, 0.03515625, 0.02734375, 0.015625, 0.0859375, 0.1484375, -0.166015625, -0.1171875, -0.025390625, -0.125, -0.072265625, -0.0390625, -0.06640625, -0.052734375, -0.01171875, -0.009765625, -0.0390625, -0.015625, -0.009765625, -0.005859375, -0.0078125, 0.0, 0.0078125, -0.009765625, -0.001953125};
  51.     //static Double[] list5 = {0.140625, 0.005859375, 0.0078125, 0.095703125, 0.123046875, 0.3359375, 0.462890625, -0.033203125, -0.017578125, -0.091796875, -0.056640625, -0.0625, -0.044921875, -0.017578125, -0.00390625, -0.021484375, -0.013671875, -0.001953125, -0.01171875, -0.00390625, 0.00390625, 0.005859375, 0.009765625, 0.017578125, 0.0, 0.00390625, 0.013671875, 0.015625, 0.009765625, 0.005859375, 0.033203125, 0.05078125, 0.03515625, 0.02734375, 0.015625, 0.0859375};
  52.     //static Double[] list5 = {0.140625, 0.015625, 0.083984375, 0.064453125, 0.068359375, 0.798828125, -0.06640625, -0.064453125, -0.03515625, -0.05078125, -0.033203125, -0.03515625, -0.037109375, -0.01953125, -0.001953125, -0.015625, -0.01171875, -0.001953125, 0.001953125, 0.013671875, -0.00390625, 0.013671875, 0.005859375, 0.001953125, 0.00390625, 0.01171875, 0.029296875, 0.015625, 0.00390625, 0.03515625, 0.0078125, 0.04296875, 0.009765625, 0.03515625, 0.00390625, 0.0546875, 0.0625, 0.0625, 0.068359375, -0.103515625, -0.072265625, -0.025390625, -0.017578125, -0.142578125, -0.013671875, -0.078125, -0.0859375, -0.078125, -0.01171875, -0.044921875, -0.029296875, -0.0234375, -0.0078125, -0.001953125, -0.021484375, -0.0078125, -0.001953125, 0.009765625, -0.009765625, 0.0, 0.0, 0.015625, 0.02734375, 0.01953125, 0.0078125, 0.015625, 0.01953125, 0.0390625, 0.01953125, 0.02734375, 0.04296875};
  53.     //static Double[] list5 = {0.142578125, 0.005859375, 0.009765625, 0.001953125, 0.0546875, 0.1328125, 0.82421875, -0.091796875, -0.041015625, -0.00390625, -0.064453125, -0.0390625, -0.041015625, -0.005859375, -0.013671875, -0.00390625, -0.009765625, -0.03125, -0.005859375, -0.001953125, -0.009765625, -0.00390625, -0.001953125, -0.005859375, 0.0, 0.0, 0.009765625, 0.009765625, 0.03125, 0.001953125, 0.013671875, 0.0078125, 0.009765625, 0.03125, 0.001953125, 0.01953125, 0.0390625, 0.017578125, 0.03125, 0.01171875, 0.041015625, 0.078125, 0.037109375, 0.0234375, 0.0234375, -0.083984375, -0.119140625, -0.087890625, -0.08984375, -0.041015625, -0.017578125, -0.01171875, -0.03125, -0.03515625, -0.0234375, -0.068359375, -0.025390625, -0.037109375, -0.029296875, -0.005859375, -0.015625, -0.005859375, -0.00390625, 0.0, 0.017578125, 0.009765625, 0.01953125, 0.03125, 0.052734375, 0.068359375, 0.076171875};
  54.     //static Double[] list5 = {0.142578125, 0.005859375, 0.009765625, 0.001953125, 0.0546875, 0.1328125, 0.82421875, -0.091796875, -0.041015625, -0.00390625, -0.064453125, -0.0390625, -0.041015625, -0.005859375, -0.013671875, -0.00390625, -0.009765625, -0.03125, -0.005859375, -0.001953125, -0.009765625, -0.00390625, -0.001953125, -0.005859375, 0.0, 0.0, 0.009765625, 0.009765625, 0.03125, 0.001953125, 0.013671875, 0.0078125, 0.009765625, 0.03125, 0.001953125, 0.01953125, 0.0390625, 0.017578125, 0.03125, 0.01171875, 0.041015625, 0.078125, 0.037109375, 0.0234375, 0.0234375, -0.083984375, -0.119140625, -0.087890625, -0.08984375, -0.041015625};
  55.     //static Double[] list5 = {0.0, 0.0, 0.0, 0.0, 0.0, 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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, 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.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, 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.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, 0.0, 0.142578125, 0.052734375, 0.0234375, 0.1171875, 0.197265625, 0.208984375, 0.126953125, 0.30078125, -0.052734375, -0.056640625, -0.037109375, -0.052734375, -0.017578125, -0.0234375, -0.029296875, -0.03515625, -0.017578125, -0.001953125, -0.013671875, -0.013671875, -0.00390625, -0.0078125, 0.0, 0.00390625, 0.00390625, 0.033203125, 0.0, 0.0078125, 0.0, 0.005859375, 0.025390625, 0.01171875, 0.02734375, 0.03125, 0.037109375, 0.017578125, 0.01171875, 0.072265625, 0.00390625, 0.072265625, 0.029296875, 0.078125, -0.16015625, -0.076171875, -0.119140625, -0.013671875, -0.1171875, -0.056640625, -0.07421875, -0.05859375, -0.017578125, -0.025390625, -0.033203125, -0.0078125, -0.00390625};
  56.     //static Double[] list5 = {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,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,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,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,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,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,0,0,0,0,0,0,0,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0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
  57.     //static Double[] list5 = {0.140625, -0.001953125, -0.00390625, -0.01171875, 0.0, 0.015625, 0.052734375, 0.029296875, 0.01953125, 0.27734375, 0.330078125};
  58.     //static Double[] list5 = {0.142578125, 0.001953125, 0.001953125, 0.080078125, 0.09375, 0.294921875, 0.556640625, -0.03125, -0.01953125, -0.087890625, -0.0546875, -0.05859375, -0.041015625, -0.01953125, -0.00390625, -0.01953125, -0.015625, 0.0, -0.009765625, -0.001953125, 0.00390625, 0.001953125, 0.0078125, 0.025390625, 0.0, 0.005859375, 0.015625, 0.013671875, 0.0078125, 0.0078125, 0.03515625, 0.0546875, 0.041015625, 0.029296875, 0.01171875, 0.08984375, 0.119140625, -0.171875, -0.119140625, -0.025390625, -0.12890625, -0.076171875, -0.037109375, -0.05859375, -0.056640625, -0.0078125, -0.009765625, -0.0390625, -0.013671875};
  59.     //static Double[] list5 = {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.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.125, 0.0234375, 0.97265625, -0.091796875, -0.052734375, -0.03125, -0.013671875, -0.0546875, -0.052734375, -0.021484375, -0.013671875, -0.005859375, -0.0234375, -0.015625, -0.001953125, 0.005859375, 0.00390625, 0.01171875, 0.005859375, 0.009765625, 0.015625, 0.029296875, 0.009765625, 0.005859375, 0.044921875, 0.029296875, 0.02734375, 0.021484375, 0.0546875, 0.05078125};
  60.     //static Double[] list5 = {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.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.125, 0.0234375, 0.97265625, -0.091796875, -0.052734375, -0.03125, -0.013671875, -0.0546875, -0.052734375, -0.021484375, -0.013671875, -0.005859375, -0.0234375, -0.015625, -0.001953125, 0.005859375, 0.00390625};
  61.     //static Double[] list5 = {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.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.142578125, 0.001953125, 0.001953125, 0.029296875, 0.046875, 0.033203125, 0.02734375, 0.19921875, 0.365234375, 0.005859375, 0.005859375, 0.005859375, 0.021484375, 0.03515625, 0.04296875, 0.04296875, 0.009765625, 0.0703125, 0.060546875};
  62.     //static Double[] list5 = {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.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  63.     //static Double[] list5 = {0.140625, 0.017578125, 0.013671875, 0.072265625, 0.064453125, 0.373046875, 0.490234375, -0.01953125, -0.01953125, -0.0859375, -0.0546875, -0.060546875, -0.04296875, -0.015625, -0.009765625, -0.01171875, -0.01171875, -0.005859375, -0.005859375, -0.001953125, 0.001953125, 0.005859375, 0.0078125, 0.001953125, 0.00390625, 0.013671875, 0.013671875, 0.015625, 0.0078125, 0.01171875, 0.017578125, 0.01953125, 0.025390625, 0.025390625, 0.01171875, 0.068359375, 0.0703125, 0.052734375, -0.09765625, -0.029296875, -0.12109375, -0.091796875, -0.05078125, -0.083984375, -0.064453125, -0.01953125, -0.013671875, -0.037109375, -0.01953125, -0.017578125, -0.009765625, -0.013671875, -0.005859375, 0.0, -0.00390625};
  64.     //static Double[] list5 = {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.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, 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.0, 0.0, 0.0,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, 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.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, 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.0, 0.0, 0.322265625, -0.0390625, -0.08203125, -0.0078125, -0.041015625, 0.005859375, -0.015625, -0.013671875, -0.013671875, 0.00390625, 0.0234375, 0.0625, 0.0234375, 0.1015625, 0.083984375, 0.087890625, 0.087890625, 0.091796875, 0.08203125, 0.083984375, 0.033203125, 0.01171875, 0.04296875, 0.041015625, 0.041015625, 0.04296875, 0.04296875, 0.060546875, 0.01171875, 0.0234375};
  65.     //static Double[] list5 = {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.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, 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.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, 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.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, 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.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, 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.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, 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.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, 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.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, 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.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, 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.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, 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.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, 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.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, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.322265625, -0.0390625, -0.08203125, -0.0078125, -0.041015625, 0.005859375, -0.015625, -0.013671875, -0.013671875, 0.00390625, 0.0234375, 0.0625, 0.0234375, 0.1015625, 0.083984375, 0.087890625, 0.087890625, 0.091796875, 0.08203125, 0.083984375};
  66.     //static Double[] list5 = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 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 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.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, 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.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, 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.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  67.     //static Double[] list5 = {0.140625, -0.01953125, -0.03515625, -0.033203125, -0.009765625, -0.009765625, 0.001953125, 0.001953125, 0.001953125, 0.001953125, 0.005859375, 0.044921875, 0.23046875, 0.18359375, 0.041015625, 0.19921875, -0.064453125, -0.01171875, -0.076171875, -0.041015625, -0.048828125, -0.017578125, -0.017578125, -0.013671875, -0.001953125, 0.001953125, 0.001953125, 0.015625, 0.017578125, 0.017578125, 0.0625, 0.09375, 0.08203125, 0.0546875, 0.044921875, 0.1796875, 0.146484375, -0.0703125, -0.048828125, -0.01171875, -0.05078125, -0.033203125, -0.021484375, -0.0234375, -0.0234375, -0.00390625, -0.0078125, -0.0078125, -0.001953125, -0.001953125, 0.0, 0.0, -0.0078125, -0.0078125, -0.001953125, 0.021484375, 0.017578125, 0.013671875, 0.021484375, 0.005859375, 0.013671875, 0.0234375, 0.0234375, 0.0234375, 0.021484375, 0.021484375, 0.017578125, 0.017578125, 0.025390625, 0.0234375, 0.0234375, 0.03125, 0.0234375, 0.0625, -0.0625, -0.0625, -0.0625, -0.0625, -0.064453125, -0.064453125, -0.06640625, -0.033203125, -0.07421875, -0.064453125, -0.015625, -0.015625, -0.01953125, -0.021484375, -0.02734375, -0.01171875, -0.0078125, -0.0078125};
  68.     //static Double[] list5 = {0.142578125, -0.01953125, -0.03515625, -0.03515625, -0.009765625, -0.009765625, 0.001953125, 0.001953125, 0.001953125, 0.005859375, 0.001953125, 0.04296875, 0.232421875, 0.130859375, 0.048828125, 0.244140625};
  69.     static ArrayList<Double> list6 = new ArrayList<Double>();
  70.    
  71.     static ArrayList<Double> coordX = new ArrayList<Double>();
  72.     static ArrayList<Double> coordY = new ArrayList<Double>();
  73.    
  74.     static ArrayList<Double> coordX2 = new ArrayList<Double>();
  75.     static ArrayList<Double> coordY2 = new ArrayList<Double>();
  76.    
  77.     static double x1,y1,x2,y2,x3,y3;
  78.    
  79.     static KeyEvent keyEvent2;
  80.     static KeyEvent keyEvent;
  81.    
  82.     static final double increment = 0.0078125/4;
  83.    
  84.     public static void init() {
  85.  
  86.         coordX = new ArrayList<Double>();
  87.         coordY = new ArrayList<Double>();
  88.        
  89.         coordX2 = new ArrayList<Double>();
  90.         coordY2 = new ArrayList<Double>();
  91.        
  92.         a = 31;
  93.         m = true;
  94.  
  95.         t = new Complex(0, 0);
  96.         k = 0;
  97.         z = new Complex(0, 0);
  98.         v = 0;
  99.         d = 2;
  100.         s = 0;
  101.        
  102.         for (int i = 0; i < 10; i++) {
  103.             list4[i] = new Complex(0,0);
  104.             list4old[i] = new Complex(0,0);
  105.         }
  106.        
  107.         for (int i = 2; i <= n; i++) {
  108.             a = y9(a);
  109.             list4old[i].re = (8*a/w-4)/3;
  110.             a = y9(a);
  111.             list4old[i].im = 2*a/w-1;
  112.             list4[i].re = list4old[i].re;
  113.             list4[i].im = list4old[i].im;
  114.             list4[i].setValue(new Complex(list4[i].getAbs(), list4[i].getArg()));
  115.         }
  116.        
  117.         for (int i = 0; i < nbIterations; i++) {
  118.             a = y9(a);
  119.             z.im += 0.04+a/w;
  120.         }
  121.        
  122.         olda = a;
  123.     }
  124.    
  125.     public static void main(String[] args) {
  126.        
  127.         //cout minimum de 2833.7236730753207: 1 3 4 2 5 8 6 7 9
  128.         //cout minimum de 2456.113277149299: 1 3 6 7 8 5 2 4 9
  129.        
  130.         //3,9,4,2,5,8,6,7 : 2693 (max 9307)
  131.         //
  132.         init();
  133.         window = new Window();
  134.        
  135.        
  136.         int[] listeIter = {506, 683, 730, 911, 924, 1052, 1277, 1348, 1373, 2175, 2198, 3168, 3211, 3462, 3734, 3980, 4869, 5533, 5558, 5974, 6567, 6611, 7308, 7427, 7805, 8748, 8869, 9413, 9795, 9805};
  137.        
  138.         for (int i = 0; i < listeIter.length; i++) {
  139.             nbIterations = listeIter[i];
  140.             init();
  141.             if (auto()) {
  142.                 System.out.println("score final = "+s);
  143.                 System.out.println(nbIterations + "x{0} + "+list6.toString().replaceAll("\\[", "{").replaceAll("\\]", "}"));
  144.             }
  145.         }
  146.        
  147.         /*ArrayList<Integer> listeIter = new ArrayList<Integer>();
  148.         double j = 0;
  149.         for (int i = 0; i < 100000; i++) {
  150.             a = y9(a);
  151.             j += (0.04+a/w);
  152.             if (j%(2*Math.PI) < 0.001 || j%(2*Math.PI) > (2*Math.PI-0.001) ) {
  153.                 System.out.println("angle de "+j%(2*Math.PI)+" pour "+i+" iterations");
  154.                
  155.                 listeIter.add(i);
  156.                
  157.                 //System.out.println(sb.toString());
  158.             }
  159.         }
  160.         System.out.println(listeIter.toString());
  161.         System.exit(0);*/
  162.        
  163.         /*double[][] mat = new double[9][9];
  164.        
  165.         for (int i = 1; i <= n; i++) {
  166.             for (int j = 1; j <= n; j++) {
  167.                 mat[i-1][j-1] = 500*diff(list4[i], list4[j]);
  168.             }
  169.         }
  170.        
  171.         System.out.println(mat[3][8]);
  172.         System.out.println(mat[2][8]);
  173.         System.out.println(mat[6][8]);
  174.         System.out.println(mat[2][3]);
  175.         System.out.println(Arrays.deepToString(mat));*/
  176.         //System.exit(0);
  177.         /*double minCout = 999999;
  178.         for (int i = 0; i < 1; i++) {
  179.             for (int j = 0; j < 9; j++) {
  180.                 if (i == j) continue;
  181.                 for (int k = 0; k < 9; k++) {
  182.                     if (k == i || k == j) continue;
  183.                     for (int l = 0; l < 9; l++) {
  184.                         if (l == i || l == j || l == k) continue;
  185.                         for (int m = 0; m < 9; m++) {
  186.                             if (m == i || m == j || m == k || m == l) continue;
  187.                             for (int n = 0; n < 9; n++) {
  188.                                 if (n == i || n == j || n == k || n == l || n == m) continue;
  189.                                 for (int o = 0; o < 9; o++) {
  190.                                     if (o == i || o == j || o == k || o == l || o == m || o == n) continue;
  191.                                     for (int p = 0; p < 9; p++) {
  192.                                         if (p == i || p == j || p == k || p == l || p == m || p == n || p == o) continue;
  193.                                         for (int q = 0; q < 9; q++) {
  194.                                             if (q == i || q == j || q == k || q == l || q == m || q == n || q == o || q == p) continue;
  195.                                            
  196.                                             double cout = mat[i][j] + mat[j][k] + mat[k][l] + mat[l][m] + mat[m][n] + mat[n][o] + mat[o][p] + mat[p][q];
  197.                                             if (cout < minCout) {
  198.                                                 System.out.println("cout minimum de "+cout +": "+(i+1)+" "+(j+1)+" "+(k+1)+" "+(l+1)+" "+(m+1)+" "+(n+1)+" "+(o+1)+" "+(p+1)+" "+(q+1));
  199.                                                 minCout = cout;
  200.                                             }
  201.                                            
  202.                                         }
  203.                                     }
  204.                                 }
  205.                             }
  206.                         }
  207.                     }
  208.                 }
  209.             }
  210.         }*/
  211.        
  212.         //System.exit(0);
  213.        
  214.         //System.out.println(Arrays.toString(list4));
  215.  
  216.        
  217.         //auto();
  218.  
  219.         if (list5.length == 0) {
  220.             list5 = new Double[] {list4[3].re};
  221.         }
  222.         while (true) {
  223.            
  224.             if (keyEvent != null) {
  225.                 if (keyEvent.getKeyCode() == KeyEvent.VK_NUMPAD1) {
  226.                     v += 10*increment;
  227.                 } else if (keyEvent.getKeyCode() == KeyEvent.VK_NUMPAD0) {
  228.                     v -= 10*increment;
  229.                 }
  230.                 if (keyEvent.getKeyCode() == KeyEvent.VK_RIGHT) {
  231.                     v += increment;
  232.                 } else if (keyEvent.getKeyCode() == KeyEvent.VK_LEFT) {
  233.                     v -= increment;
  234.                 } else if (keyEvent.getKeyCode() == KeyEvent.VK_DOWN) {
  235.                     System.out.println("undo");
  236.                     list6.remove(list6.size()-1);
  237.                     list5 = list6.toArray(new Double[0]);
  238.                     list6.clear();
  239.                     init();
  240.                 }
  241.             }
  242.            
  243.             m = m && (keyEvent == null || keyEvent.getKeyCode() != KeyEvent.VK_UP);
  244.            
  245.             if (m) {
  246.                 if (d == 0) {
  247.                     m = list5.length > list6.size();
  248.                 } else {
  249.                     m = list5.length != 0;
  250.                 }
  251.             }
  252.             if (m) {
  253.                 if (d == 0) {
  254.                     v = list5[list6.size()];
  255.                 } else {
  256.                     v = list5[0];
  257.                 }
  258.             } else {
  259.             }
  260.            
  261.             if (d == 2 || m || keyEvent != null && (keyEvent.getKeyCode() == KeyEvent.VK_UP)) {
  262.                 //if (keyEvent != null) System.out.println(keyEvent.getKeyChar());
  263.                 if (d < 2) {
  264.                     if (d == 0) {
  265.                         list6.add(v);
  266.                     } else {
  267.                         if (list6.size() > 0) {
  268.                             list6.set(0, v);
  269.                         } else {
  270.                             list6.add(v);
  271.                         }
  272.                         d = 1;
  273.                     }
  274.                     t.setValue(z);
  275.                     a = y9(a);
  276.                     z.im = z.im+(0.04+a/w)/(9*Math.abs(z.re)+1);
  277.                     z.re = z.re+v;
  278.                     //s = s - 500*new Complex(z.re*Math.cos(z.im) - t.re*Math.cos(t.im), z.re*Math.sin(z.im)- t.re*Math.sin(t.im)).getAbs();
  279.                     s = s - 500*diff(z, t);
  280.                     for (int i = 0; i <= n; i++) {
  281.                         if (i == 1 && list4[1].im == n-1 && z.re*t.re <= 0
  282.                                 || i > 1 && Math.PI >= list4[i].im && b >= diff(z, list4[i])) {
  283.                            
  284.                             if (i > 1) {
  285.                                 list4[i].im += 2*Math.PI;
  286.                             }
  287.                             list4[1].im += 1;
  288.                             System.out.println("Score increase by "+(500*(3-Math.min(1, diff(z, list4[i])) - Math.min(1, Math.abs(z.re - list4[i].re)))));
  289.                             s = s + 500*(3-Math.min(1, diff(z, list4[i])) - Math.min(1, Math.abs(z.re - list4[i].re)));
  290.                             System.out.println(nbIterations + "x{0} + "+list6.toString().replaceAll("\\[", "{").replaceAll("\\]", "}"));
  291.                         }
  292.                     }
  293.                 }
  294.                
  295.                 coordX.add(z.re * Math.cos(z.im));
  296.                 coordY.add(z.re * Math.sin(z.im));
  297.  
  298.                
  299.                 //System.out.println(s);
  300.                 //System.out.println(z.im);
  301.                 /*System.out.print("{");
  302.                 for (int i = 0; i < list6.size(); i++) {
  303.                     System.out.print(list6.get(i));
  304.                     if (i < list6.size()-1) {
  305.                         System.out.print(", ");
  306.                     }
  307.                 }
  308.                 System.out.println("}");*/
  309.  
  310.                 autoPredict();
  311.                 d = Math.max(0, d-1);
  312.             }
  313.            
  314.  
  315.             if (keyEvent2 != null) {
  316.                 keyEvent = keyEvent2;
  317.                 keyEvent2 = null;
  318.             } else {
  319.                 keyEvent = null;
  320.             }
  321.             window.panel.repaint();
  322.             //System.out.println(keyEvent);
  323.         }
  324.        
  325.     }
  326.  
  327.     static ArrayList<Double> values = new ArrayList<Double>();
  328.    
  329.     public static boolean auto() {
  330.        
  331.         Complex[] list4old_2 = Arrays.copyOf(list4old, list4old.length);
  332.        
  333.         //list4old_2[6].re += 0.0849;
  334.         //list4old_2[9].re -= 0.07;
  335.        
  336.         list5 = new Double[0];
  337.         init();
  338.         int[] chemin = {3,9,4,2,5,8,7,6,1};
  339.  
  340.         coordX.add(z.re * Math.cos(z.im));
  341.         coordY.add(z.re * Math.sin(z.im));
  342.        
  343.         Complex t2 = new Complex(t);
  344.         Complex z2 = new Complex(z);
  345.         double a2 = a;
  346.         double v2;
  347.         iterate(list4[chemin[0]].re);
  348.        
  349.         for (int i = 1; i < chemin.length; i++) {
  350.  
  351.             //System.out.println("direction "+chemin[i]);
  352.             while (true) {
  353.                 z2.setValue(z);
  354.                 //t2.setValue(z2);
  355.                 a2 = a;
  356.                 a2 = y9(a2);
  357.                
  358.                 double b = Math.sin(z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1));
  359.                 double c = Math.cos(z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1));
  360.                 double d = z2.re * Math.sin(z2.im);
  361.                 double e = z2.re * Math.cos(z2.im);
  362.                 double f = list4old_2[chemin[i]].im;
  363.                 double g = list4old_2[chemin[i]].re;
  364.                
  365.                 v2 = (b*e*z.re-b*g*z.re-c*d*z.re+c*f*z.re+d*g-e*f)/(b*(g-e)+c*(d-f));
  366.                
  367.                 //System.out.println("(y3-y1)/(x3-x1) = "+((f-d)/(g-e)));
  368.                 //System.out.println("(y2-y1)/(x2-x1) = "+(((z2.re+v2)*b-d)/((z2.re+v2)*c-e)));
  369.                
  370.                 x1 = e;
  371.                 y1 = d;
  372.                 x2 = (z2.re+v2)*c;
  373.                 y2 = (z2.re+v2)*b;
  374.                 x3 = g;
  375.                 y3 = f;
  376.                
  377.                 if (diff(z2, list4[chemin[i]]) < diff(new Complex(z2.re+v2, z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1)), list4[chemin[i]])) {
  378.                     //System.out.println("Couldn't evaluate");
  379.                     v2 = -1/(200*b*b+c*c) * (Math.sqrt(b*b*(289-40000*g*g) + 80000*b*c*f*g+c*c*(289-40000*f*f)) + 200*b*b*z2.re - 200*b*f + 200*c*c*z2.re - 200*c*g);
  380.                     if (Double.isNaN(v2)) {
  381.                         System.out.println("no solution");
  382.                         return false;
  383.                     }
  384.                     //v2 = 1/(200*b*b+c*c) * (Math.sqrt(b*b*(289-40000*g*g) + 80000*b*c*f*g+c*c*(289-40000*f*f)) - 200*b*b*z2.re + 200*b*f - 200*c*c*z2.re + 200*c*g);
  385.                 }
  386.                 x2 = (z2.re+v2)*c;
  387.                 y2 = (z2.re+v2)*b;
  388.                 //System.out.println("(y3-y1)/(x3-x1) = "+(y3-y1)/(x3-x1));
  389.                 //System.out.println("(y2-y1)/(x2-x1) = "+(y2-y1)/(x2-x1));
  390.  
  391.                 //System.out.println("x1 = "+x1+", y1 = "+y1+", x2 = "+x2+", y2 = "+y2+", x3 = "+x3+", y3 = "+y3);
  392.                 window.panel.repaint();
  393.                 try {
  394.                     Thread.sleep(100);
  395.                 } catch (InterruptedException e1) {
  396.                     e1.printStackTrace();
  397.                 }
  398.                 if (iterate(v2)) {
  399.                     break;
  400.                 }
  401.                
  402.                
  403.             }
  404.            
  405.         }
  406.         return true;
  407.        
  408.     }
  409.    
  410.     public static void autoPredict() {
  411.        
  412.         Complex[] list4old_2 = Arrays.copyOf(list4old, list4old.length);
  413.        
  414.         //list4old_2[6].re += 0.0849;
  415.         //list4old_2[9].re -= 0.07;
  416.        
  417.         int[] chemin = {3,9,4,2,5,8,7,1};
  418.  
  419.         coordX.add(z.re * Math.cos(z.im));
  420.         coordY.add(z.re * Math.sin(z.im));
  421.        
  422.         Complex t2 = new Complex(t);
  423.         Complex z2 = new Complex(z);
  424.         double a2 = a;
  425.         double v2;
  426.        
  427.         for (int i = (int)list4[1].im; i < chemin.length; i++) {
  428.  
  429.             if (chemin[i] == 1) {
  430.                 v = -z.re;
  431.                 return;
  432.             }
  433.             //System.out.println("direction "+chemin[i]);
  434.             while (true) {
  435.                 z2.setValue(z);
  436.                 //t2.setValue(z2);
  437.                 a2 = a;
  438.                 a2 = y9(a2);
  439.                
  440.                 double b = Math.sin(z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1));
  441.                 double c = Math.cos(z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1));
  442.                 double d = z2.re * Math.sin(z2.im);
  443.                 double e = z2.re * Math.cos(z2.im);
  444.                 double f = list4old_2[chemin[i]].im;
  445.                 double g = list4old_2[chemin[i]].re;
  446.                
  447.                 v2 = (b*e*z2.re-b*g*z2.re-c*d*z2.re+c*f*z2.re+d*g-e*f)/(b*(g-e)+c*(d-f));
  448.                
  449.                 //System.out.println("(y3-y1)/(x3-x1) = "+((f-d)/(g-e)));
  450.                 //System.out.println("(y2-y1)/(x2-x1) = "+(((z2.re+v2)*b-d)/((z2.re+v2)*c-e)));
  451.                
  452.                 x1 = e;
  453.                 y1 = d;
  454.                 x2 = (z2.re+v2)*c;
  455.                 y2 = (z2.re+v2)*b;
  456.                 x3 = g;
  457.                 y3 = f;
  458.                
  459.                 if (diff(z2, list4[chemin[i]]) < diff(new Complex(z2.re+v2, z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1)), list4[chemin[i]])) {
  460.                     //System.out.println("Couldn't evaluate");
  461.                     v2 = -1/(200*b*b+c*c) * (Math.sqrt(b*b*(289-40000*g*g) + 80000*b*c*f*g+c*c*(289-40000*f*f)) + 200*b*b*z2.re - 200*b*f + 200*c*c*z2.re - 200*c*g);
  462.                     if (Double.isNaN(v2)) {
  463.                         System.out.println("no solution");
  464.                     }
  465.                     //v2 = 1/(200*b*b+c*c) * (Math.sqrt(b*b*(289-40000*g*g) + 80000*b*c*f*g+c*c*(289-40000*f*f)) - 200*b*b*z2.re + 200*b*f - 200*c*c*z2.re + 200*c*g);
  466.                 }
  467.                 x2 = (z2.re+v2)*c;
  468.                 y2 = (z2.re+v2)*b;
  469.                 //System.out.println("(y3-y1)/(x3-x1) = "+(y3-y1)/(x3-x1));
  470.                 //System.out.println("(y2-y1)/(x2-x1) = "+(y2-y1)/(x2-x1));
  471.                
  472.                 v = v2;
  473.                 return;
  474.                
  475.                
  476.                
  477.             }
  478.            
  479.         }
  480.        
  481.     }
  482.    
  483.     public static boolean iterate(double v) {
  484.         boolean scoreenplus = false;
  485.         values.add(v);
  486.         list6.add(v);
  487.         t.setValue(z);
  488.         a = y9(a);
  489.         z.im = z.im+(0.04+a/w)/(9*Math.abs(z.re)+1);
  490.         z.re = z.re+v;
  491.         //s = s - 500*new Complex(z.re*Math.cos(z.im) - t.re*Math.cos(t.im), z.re*Math.sin(z.im)- t.re*Math.sin(t.im)).getAbs();
  492.         s = s - 500*diff(z, t);
  493.         for (int i = 0; i <= n; i++) {
  494.             if (i == 1 && list4[1].im == n-1 && z.re*t.re <= 0
  495.                     || i > 1 && Math.PI >= list4[i].im && b >= diff(z, list4[i])) {
  496.                
  497.                 if (i > 1) {
  498.                     list4[i].im += 2*Math.PI;
  499.                 }
  500.                 list4[1].im += 1;
  501.                 //System.out.println("Score increase by "+(500*(3-Math.min(1, diff(z, list4[i])) - Math.min(1, Math.abs(z.re - list4[i].re)))));
  502.                 s = s + 500*(3-Math.min(1, diff(z, list4[i])) - Math.min(1, Math.abs(z.re - list4[i].re)));
  503.                 scoreenplus = true;
  504.             }
  505.         }
  506.         coordX.add(z.re * Math.cos(z.im));
  507.         coordY.add(z.re * Math.sin(z.im));
  508.  
  509.         //System.out.println(nbIterations + "x{0} + "+list6.toString().replaceAll("\\[", "{").replaceAll("\\]", "}"));
  510.         window.panel.repaint();
  511.         return scoreenplus;
  512.        
  513.     }
  514.    
  515.     public static void predict(double v2) {
  516.         coordX2.clear();
  517.         coordY2.clear();
  518.         double a2 = a;
  519.         Complex t2 = new Complex(t);
  520.         Complex z2 = new Complex(z);
  521.         coordX2.add(z2.re * Math.cos(z2.im));
  522.         coordY2.add(z2.re * Math.sin(z2.im));
  523.         for (int h = 0; h < 1; h++) {
  524.            
  525.             t2.setValue(z2);
  526.             a2 = y9(a2);
  527.             z2.im = z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1);
  528.             z2.re = z2.re+v2;
  529.             //s = s - 500*new Complex(z.re*Math.cos(z.im) - t.re*Math.cos(t.im), z.re*Math.sin(z.im)- t.re*Math.sin(t.im)).getAbs();
  530.             if (h == 0) {
  531.                 s1 = - 500*diff(z2, t2);
  532.                 s2 = 0;
  533.                 for (int i = 0; i <= n; i++) {
  534.                     if (i == 1 && list4[1].im == n-1 && z2.re*t2.re <= 0
  535.                             || i > 1 && Math.PI >= list4[i].im && b >= diff(z2, list4[i])) {
  536.                        
  537.                         s2 = 500*(3-Math.min(1, diff(z2, list4[i])) - Math.min(1, Math.abs(z2.re - list4[i].re)));
  538.                         s3 = Math.min(1, diff(z2, list4[i]));
  539.                         s4 = Math.min(1, Math.abs(z2.re - list4[i].re));
  540.                     }
  541.                 }
  542.             }
  543.            
  544.             /*if (list4[1].im == 7) {
  545.                 System.out.println("dist 6 : "+diff(z2,list4[6]));
  546.             }*/
  547.            
  548.            
  549.             coordX2.add(z2.re * Math.cos(z2.im));
  550.             coordY2.add(z2.re * Math.sin(z2.im));
  551.         }
  552.        
  553.     }
  554.    
  555.     public static double diff(Complex c1, Complex c2) {
  556.         return new Complex(
  557.                 c1.re*Math.cos(c1.im) - c2.re*Math.cos(c2.im),
  558.                 c1.re*Math.sin(c1.im) - c2.re*Math.sin(c2.im)).getAbs();
  559.     }
  560.    
  561.     public static double y9(double x) {
  562.         return p*x-w*((int)(p*x/w));
  563.     }
  564.    
  565. }
  566.  
  567. class Complex {
  568.    
  569.     public double re;
  570.     public double im;
  571.    
  572.     public Complex(double re, double im) {
  573.         this.re = re;
  574.         this.im = im;
  575.     }
  576.    
  577.     public Complex(Complex c) {
  578.         this.re = c.re;
  579.         this.im = c.im;
  580.     }
  581.    
  582.     public void setValue(Complex c) {
  583.         this.re = c.re;
  584.         this.im = c.im;
  585.     }
  586.    
  587.     public double getAbs() {
  588.         return Math.sqrt(this.re*this.re + this.im*this.im);
  589.     }
  590.    
  591.     public double getArg() {
  592.         return 2*Math.atan(this.im/(this.re+getAbs()));
  593.     }
  594.    
  595.     @Override public String toString() {
  596.         return this.re+"+"+this.im+"i";
  597.     }
  598. }
  599.  
  600. class Window extends JFrame {
  601.    
  602.     public Panel panel = new Panel();
  603.    
  604.     public Window() {
  605.        
  606.         this.setTitle("courage");
  607.         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  608.         this.setSize(1200, 800);
  609.         this.setContentPane(panel);
  610.         this.setVisible(true);
  611.         this.setLocationRelativeTo(null);
  612.        
  613.         panel.setBackground(Color.WHITE);
  614.         panel.setFocusable(true);
  615.        
  616.        
  617.     }
  618.    
  619. }
  620.  
  621.  
  622. class Panel extends JPanel implements KeyListener {
  623.  
  624.     public Panel() {
  625.  
  626.         addKeyListener(this);
  627.     }
  628.    
  629.     @Override
  630.     public void paintComponent(Graphics g) {
  631.         super.paintComponent(g);
  632.         requestFocusInWindow();
  633.         Graphics2D g2d = (Graphics2D)g;
  634.         g2d.setBackground(Color.WHITE);
  635.        
  636.         /*g2d.setColor(Color.ORANGE);
  637.         Courage.predict(Courage.v-Courage.increment);
  638.         for (int i = 1; i < Courage.coordX2.size(); i++) {
  639.             g2d.drawLine(this.getWidth()/2+Courage.coordX2.get(i-1), this.getHeight()/2-Courage.coordY2.get(i-1),
  640.                     this.getWidth()/2+Courage.coordX2.get(i), this.getHeight()/2-Courage.coordY2.get(i));
  641.         }
  642.        
  643.         g2d.setColor(Color.MAGENTA);
  644.         Courage.predict(Courage.v+Courage.increment);
  645.         for (int i = 1; i < Courage.coordX2.size(); i++) {
  646.             g2d.drawLine(this.getWidth()/2+Courage.coordX2.get(i-1), this.getHeight()/2-Courage.coordY2.get(i-1),
  647.                     this.getWidth()/2+Courage.coordX2.get(i), this.getHeight()/2-Courage.coordY2.get(i));
  648.         }*/
  649.        
  650.         g2d.setColor(Color.BLACK);
  651.        
  652.         for (int i = 1; i <= Courage.n; i++) {
  653.             g2d.drawOval(this.getWidth()/2+(int)(Courage.f*Courage.list4old[i].re-Courage.f*Courage.b),
  654.                     this.getHeight()/2-(int)(Courage.f*Courage.list4old[i].im+Courage.f*Courage.b),
  655.                     (int)(Courage.f*Courage.b*2), (int)(Courage.f*Courage.b*2));
  656.             //g2d.setColor(Color.RED);
  657.             //g2d.drawLine(this.getWidth()/2+(int)(Courage.f*Courage.list4old[i].re), this.getHeight()/2-(int)(Courage.f*Courage.list4old[i].im),
  658.                     //this.getWidth()/2+(int)(Courage.f*Courage.list4old[i].re), this.getHeight()/2-(int)(Courage.f*Courage.list4old[i].im));
  659.             g2d.setColor(Color.BLACK);
  660.             g2d.drawString(""+i, this.getWidth()/2+(int)(Courage.f*Courage.list4old[i].re), this.getHeight()/2-(int)(Courage.f*Courage.list4old[i].im));
  661.             //g2d.drawString(i+": "+Courage.list4[i].re, 10, 140+20*i);
  662.         }
  663.        
  664.         for (int i = 1; i < Courage.coordX.size(); i++) {
  665.             g2d.drawLine(this.getWidth()/2+(int)(Courage.f*Courage.coordX.get(i-1)), this.getHeight()/2-(int)(Courage.f*Courage.coordY.get(i-1)),
  666.                     this.getWidth()/2+(int)(Courage.f*Courage.coordX.get(i)), this.getHeight()/2-(int)(Courage.f*Courage.coordY.get(i)));
  667.         }
  668.        
  669.  
  670.  
  671.         g2d.setColor(Color.BLACK);
  672.        
  673.         //g2d.drawString("v = "+String.format("%.2f", Courage.v), 10, 20);
  674.         g2d.drawString("v = "+Courage.v, 10, 20);
  675.         g2d.drawString("s = "+Courage.s+" ("+(Courage.s1+Courage.s2)+")", 10, 40);
  676.         g2d.drawString("    ("+Courage.s1+", ", 10, 60);
  677.         g2d.drawString("     "+Courage.s2+", ", 10, 80);
  678.         g2d.drawString("     "+Courage.s3+")", 10, 100);
  679.         g2d.drawString("     "+Courage.s4+")", 10, 120);
  680.         g2d.drawString("z = "+Courage.z, 10, 140);
  681.         g2d.drawString("a = "+Courage.a+"("+Courage.y9(Courage.a)+")", 10, 160);
  682.        
  683.         /*g2d.setColor(Color.GREEN);
  684.         g2d.drawLine(this.getWidth()/2+(int)(Courage.x1*Courage.f), this.getHeight()/2-(int)(Courage.y1*Courage.f), this.getWidth()/2+(int)(Courage.x3*Courage.f), this.getHeight()/2-(int)(Courage.y3*Courage.f));
  685.  
  686.         g2d.setColor(Color.RED);
  687.         g2d.drawLine(this.getWidth()/2+(int)(Courage.x1*Courage.f), this.getHeight()/2-(int)(Courage.y1*Courage.f), this.getWidth()/2+(int)(Courage.x2*Courage.f), this.getHeight()/2-(int)(Courage.y2*Courage.f));
  688.         //g2d.setColor(Color.RED);*/
  689.         Courage.predict(Courage.v);
  690.        
  691.         g2d.setColor(Color.GREEN);
  692.         double x1 = Courage.coordX.get(Courage.coordX.size()-1);
  693.         double y1 = Courage.coordY.get(Courage.coordX.size()-1);
  694.         double x2 = Courage.coordX2.get(1);
  695.         double y2 = Courage.coordY2.get(1);
  696.         if (x2 != x1) {
  697.            
  698.             double slope = (((double)y2-y1)/(x2-x1));
  699.            
  700.             double x3 = 10000*(x2-x1);
  701.             double b = y1-slope*x1;
  702.             double y3 = slope*x3+b;
  703.             //System.out.println(y3);
  704.             //System.out.println("test droite : "+(int)(Courage.f*x1)+" "+ (int)(Courage.f*y1)+" "+  (int)(Courage.f*x3)+" "+ (int)(Courage.f*y3));
  705.             g2d.drawLine(this.getWidth()/2+(int)(Courage.f*x2), this.getHeight()/2-(int)(Courage.f*y2), this.getWidth()/2+(int)(Courage.f*x3), this.getHeight()/2-(int)(Courage.f*y3));
  706.         }
  707.  
  708.         //for (int i = 1; i < Courage.coordX2.size(); i++) {
  709.         for (int i = 1; i < 2; i++) {
  710.             if (i == 1) {
  711.                 g2d.setColor(Color.RED);
  712.             } else {
  713.                 g2d.setColor(Color.ORANGE);
  714.             }
  715.             g2d.drawLine(this.getWidth()/2+(int)(Courage.f*Courage.coordX2.get(i-1)), this.getHeight()/2-(int)(Courage.f*Courage.coordY2.get(i-1)),
  716.                     this.getWidth()/2+(int)(Courage.f*Courage.coordX2.get(i)), this.getHeight()/2-(int)(Courage.f*Courage.coordY2.get(i)));
  717.         }
  718.        
  719.        
  720.        
  721.        
  722.     }
  723.  
  724.     @Override
  725.     public void keyPressed(KeyEvent e) {
  726.         //System.out.println("key pressed : "+e.getKeyCode());
  727.         Courage.keyEvent2 = e;
  728.     }
  729.  
  730.     @Override
  731.     public void keyReleased(KeyEvent e) {
  732.     }
  733.  
  734.     @Override
  735.     public void keyTyped(KeyEvent e) {
  736.        
  737.     }
  738.    
  739. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement