Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package courage;
- import java.awt.Color;
- import java.awt.Graphics;
- import java.awt.Graphics2D;
- import java.awt.event.KeyEvent;
- import java.awt.event.KeyListener;
- import java.util.ArrayList;
- import java.util.Arrays;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- public class Courage {
- static double s = 0;
- static double s1, s2, s3, s4;
- static final double n = 9;
- static final double b = 0.085;
- static final double w = 65537;
- static final double p = 75;
- static double olda = 0;
- static double a = 31;
- static final double f = 200;
- static Complex t = new Complex(0, 0);
- static double k = 0;
- static Complex z = new Complex(0, 0);
- static double v = 0;
- static double d = 2;
- static Window window;
- static boolean m = true;
- static Complex[] list4 = new Complex[10];
- static Complex[] list4old = new Complex[10];
- //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}
- //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}
- //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}
- //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}
- static int nbIterations = 0;
- static Double[] list5 = {};
- //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};
- //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};
- //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};
- //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};
- //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};
- //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};
- //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};
- //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};
- //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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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.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};
- //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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,};
- //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};
- //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};
- //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};
- //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};
- //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};
- //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};
- //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};
- //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,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, -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};
- //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};
- //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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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};
- //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};
- //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};
- static ArrayList<Double> list6 = new ArrayList<Double>();
- static ArrayList<Double> coordX = new ArrayList<Double>();
- static ArrayList<Double> coordY = new ArrayList<Double>();
- static ArrayList<Double> coordX2 = new ArrayList<Double>();
- static ArrayList<Double> coordY2 = new ArrayList<Double>();
- static double x1,y1,x2,y2,x3,y3;
- static KeyEvent keyEvent2;
- static KeyEvent keyEvent;
- static final double increment = 0.0078125/4;
- public static void init() {
- coordX = new ArrayList<Double>();
- coordY = new ArrayList<Double>();
- coordX2 = new ArrayList<Double>();
- coordY2 = new ArrayList<Double>();
- a = 31;
- m = true;
- t = new Complex(0, 0);
- k = 0;
- z = new Complex(0, 0);
- v = 0;
- d = 2;
- s = 0;
- for (int i = 0; i < 10; i++) {
- list4[i] = new Complex(0,0);
- list4old[i] = new Complex(0,0);
- }
- for (int i = 2; i <= n; i++) {
- a = y9(a);
- list4old[i].re = (8*a/w-4)/3;
- a = y9(a);
- list4old[i].im = 2*a/w-1;
- list4[i].re = list4old[i].re;
- list4[i].im = list4old[i].im;
- list4[i].setValue(new Complex(list4[i].getAbs(), list4[i].getArg()));
- }
- for (int i = 0; i < nbIterations; i++) {
- a = y9(a);
- z.im += 0.04+a/w;
- }
- olda = a;
- }
- public static void main(String[] args) {
- //cout minimum de 2833.7236730753207: 1 3 4 2 5 8 6 7 9
- //cout minimum de 2456.113277149299: 1 3 6 7 8 5 2 4 9
- //3,9,4,2,5,8,6,7 : 2693 (max 9307)
- //
- init();
- window = new Window();
- 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};
- for (int i = 0; i < listeIter.length; i++) {
- nbIterations = listeIter[i];
- init();
- if (auto()) {
- System.out.println("score final = "+s);
- System.out.println(nbIterations + "x{0} + "+list6.toString().replaceAll("\\[", "{").replaceAll("\\]", "}"));
- }
- }
- /*ArrayList<Integer> listeIter = new ArrayList<Integer>();
- double j = 0;
- for (int i = 0; i < 100000; i++) {
- a = y9(a);
- j += (0.04+a/w);
- if (j%(2*Math.PI) < 0.001 || j%(2*Math.PI) > (2*Math.PI-0.001) ) {
- System.out.println("angle de "+j%(2*Math.PI)+" pour "+i+" iterations");
- listeIter.add(i);
- //System.out.println(sb.toString());
- }
- }
- System.out.println(listeIter.toString());
- System.exit(0);*/
- /*double[][] mat = new double[9][9];
- for (int i = 1; i <= n; i++) {
- for (int j = 1; j <= n; j++) {
- mat[i-1][j-1] = 500*diff(list4[i], list4[j]);
- }
- }
- System.out.println(mat[3][8]);
- System.out.println(mat[2][8]);
- System.out.println(mat[6][8]);
- System.out.println(mat[2][3]);
- System.out.println(Arrays.deepToString(mat));*/
- //System.exit(0);
- /*double minCout = 999999;
- for (int i = 0; i < 1; i++) {
- for (int j = 0; j < 9; j++) {
- if (i == j) continue;
- for (int k = 0; k < 9; k++) {
- if (k == i || k == j) continue;
- for (int l = 0; l < 9; l++) {
- if (l == i || l == j || l == k) continue;
- for (int m = 0; m < 9; m++) {
- if (m == i || m == j || m == k || m == l) continue;
- for (int n = 0; n < 9; n++) {
- if (n == i || n == j || n == k || n == l || n == m) continue;
- for (int o = 0; o < 9; o++) {
- if (o == i || o == j || o == k || o == l || o == m || o == n) continue;
- for (int p = 0; p < 9; p++) {
- if (p == i || p == j || p == k || p == l || p == m || p == n || p == o) continue;
- for (int q = 0; q < 9; q++) {
- if (q == i || q == j || q == k || q == l || q == m || q == n || q == o || q == p) continue;
- 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];
- if (cout < minCout) {
- 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));
- minCout = cout;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }*/
- //System.exit(0);
- //System.out.println(Arrays.toString(list4));
- //auto();
- if (list5.length == 0) {
- list5 = new Double[] {list4[3].re};
- }
- while (true) {
- if (keyEvent != null) {
- if (keyEvent.getKeyCode() == KeyEvent.VK_NUMPAD1) {
- v += 10*increment;
- } else if (keyEvent.getKeyCode() == KeyEvent.VK_NUMPAD0) {
- v -= 10*increment;
- }
- if (keyEvent.getKeyCode() == KeyEvent.VK_RIGHT) {
- v += increment;
- } else if (keyEvent.getKeyCode() == KeyEvent.VK_LEFT) {
- v -= increment;
- } else if (keyEvent.getKeyCode() == KeyEvent.VK_DOWN) {
- System.out.println("undo");
- list6.remove(list6.size()-1);
- list5 = list6.toArray(new Double[0]);
- list6.clear();
- init();
- }
- }
- m = m && (keyEvent == null || keyEvent.getKeyCode() != KeyEvent.VK_UP);
- if (m) {
- if (d == 0) {
- m = list5.length > list6.size();
- } else {
- m = list5.length != 0;
- }
- }
- if (m) {
- if (d == 0) {
- v = list5[list6.size()];
- } else {
- v = list5[0];
- }
- } else {
- }
- if (d == 2 || m || keyEvent != null && (keyEvent.getKeyCode() == KeyEvent.VK_UP)) {
- //if (keyEvent != null) System.out.println(keyEvent.getKeyChar());
- if (d < 2) {
- if (d == 0) {
- list6.add(v);
- } else {
- if (list6.size() > 0) {
- list6.set(0, v);
- } else {
- list6.add(v);
- }
- d = 1;
- }
- t.setValue(z);
- a = y9(a);
- z.im = z.im+(0.04+a/w)/(9*Math.abs(z.re)+1);
- z.re = z.re+v;
- //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();
- s = s - 500*diff(z, t);
- for (int i = 0; i <= n; i++) {
- if (i == 1 && list4[1].im == n-1 && z.re*t.re <= 0
- || i > 1 && Math.PI >= list4[i].im && b >= diff(z, list4[i])) {
- if (i > 1) {
- list4[i].im += 2*Math.PI;
- }
- list4[1].im += 1;
- 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)))));
- s = s + 500*(3-Math.min(1, diff(z, list4[i])) - Math.min(1, Math.abs(z.re - list4[i].re)));
- System.out.println(nbIterations + "x{0} + "+list6.toString().replaceAll("\\[", "{").replaceAll("\\]", "}"));
- }
- }
- }
- coordX.add(z.re * Math.cos(z.im));
- coordY.add(z.re * Math.sin(z.im));
- //System.out.println(s);
- //System.out.println(z.im);
- /*System.out.print("{");
- for (int i = 0; i < list6.size(); i++) {
- System.out.print(list6.get(i));
- if (i < list6.size()-1) {
- System.out.print(", ");
- }
- }
- System.out.println("}");*/
- autoPredict();
- d = Math.max(0, d-1);
- }
- if (keyEvent2 != null) {
- keyEvent = keyEvent2;
- keyEvent2 = null;
- } else {
- keyEvent = null;
- }
- window.panel.repaint();
- //System.out.println(keyEvent);
- }
- }
- static ArrayList<Double> values = new ArrayList<Double>();
- public static boolean auto() {
- Complex[] list4old_2 = Arrays.copyOf(list4old, list4old.length);
- //list4old_2[6].re += 0.0849;
- //list4old_2[9].re -= 0.07;
- list5 = new Double[0];
- init();
- int[] chemin = {3,9,4,2,5,8,7,6,1};
- coordX.add(z.re * Math.cos(z.im));
- coordY.add(z.re * Math.sin(z.im));
- Complex t2 = new Complex(t);
- Complex z2 = new Complex(z);
- double a2 = a;
- double v2;
- iterate(list4[chemin[0]].re);
- for (int i = 1; i < chemin.length; i++) {
- //System.out.println("direction "+chemin[i]);
- while (true) {
- z2.setValue(z);
- //t2.setValue(z2);
- a2 = a;
- a2 = y9(a2);
- double b = Math.sin(z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1));
- double c = Math.cos(z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1));
- double d = z2.re * Math.sin(z2.im);
- double e = z2.re * Math.cos(z2.im);
- double f = list4old_2[chemin[i]].im;
- double g = list4old_2[chemin[i]].re;
- 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));
- //System.out.println("(y3-y1)/(x3-x1) = "+((f-d)/(g-e)));
- //System.out.println("(y2-y1)/(x2-x1) = "+(((z2.re+v2)*b-d)/((z2.re+v2)*c-e)));
- x1 = e;
- y1 = d;
- x2 = (z2.re+v2)*c;
- y2 = (z2.re+v2)*b;
- x3 = g;
- y3 = f;
- 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]])) {
- //System.out.println("Couldn't evaluate");
- 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);
- if (Double.isNaN(v2)) {
- System.out.println("no solution");
- return false;
- }
- //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);
- }
- x2 = (z2.re+v2)*c;
- y2 = (z2.re+v2)*b;
- //System.out.println("(y3-y1)/(x3-x1) = "+(y3-y1)/(x3-x1));
- //System.out.println("(y2-y1)/(x2-x1) = "+(y2-y1)/(x2-x1));
- //System.out.println("x1 = "+x1+", y1 = "+y1+", x2 = "+x2+", y2 = "+y2+", x3 = "+x3+", y3 = "+y3);
- window.panel.repaint();
- try {
- Thread.sleep(100);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
- if (iterate(v2)) {
- break;
- }
- }
- }
- return true;
- }
- public static void autoPredict() {
- Complex[] list4old_2 = Arrays.copyOf(list4old, list4old.length);
- //list4old_2[6].re += 0.0849;
- //list4old_2[9].re -= 0.07;
- int[] chemin = {3,9,4,2,5,8,7,1};
- coordX.add(z.re * Math.cos(z.im));
- coordY.add(z.re * Math.sin(z.im));
- Complex t2 = new Complex(t);
- Complex z2 = new Complex(z);
- double a2 = a;
- double v2;
- for (int i = (int)list4[1].im; i < chemin.length; i++) {
- if (chemin[i] == 1) {
- v = -z.re;
- return;
- }
- //System.out.println("direction "+chemin[i]);
- while (true) {
- z2.setValue(z);
- //t2.setValue(z2);
- a2 = a;
- a2 = y9(a2);
- double b = Math.sin(z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1));
- double c = Math.cos(z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1));
- double d = z2.re * Math.sin(z2.im);
- double e = z2.re * Math.cos(z2.im);
- double f = list4old_2[chemin[i]].im;
- double g = list4old_2[chemin[i]].re;
- 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));
- //System.out.println("(y3-y1)/(x3-x1) = "+((f-d)/(g-e)));
- //System.out.println("(y2-y1)/(x2-x1) = "+(((z2.re+v2)*b-d)/((z2.re+v2)*c-e)));
- x1 = e;
- y1 = d;
- x2 = (z2.re+v2)*c;
- y2 = (z2.re+v2)*b;
- x3 = g;
- y3 = f;
- 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]])) {
- //System.out.println("Couldn't evaluate");
- 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);
- if (Double.isNaN(v2)) {
- System.out.println("no solution");
- }
- //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);
- }
- x2 = (z2.re+v2)*c;
- y2 = (z2.re+v2)*b;
- //System.out.println("(y3-y1)/(x3-x1) = "+(y3-y1)/(x3-x1));
- //System.out.println("(y2-y1)/(x2-x1) = "+(y2-y1)/(x2-x1));
- v = v2;
- return;
- }
- }
- }
- public static boolean iterate(double v) {
- boolean scoreenplus = false;
- values.add(v);
- list6.add(v);
- t.setValue(z);
- a = y9(a);
- z.im = z.im+(0.04+a/w)/(9*Math.abs(z.re)+1);
- z.re = z.re+v;
- //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();
- s = s - 500*diff(z, t);
- for (int i = 0; i <= n; i++) {
- if (i == 1 && list4[1].im == n-1 && z.re*t.re <= 0
- || i > 1 && Math.PI >= list4[i].im && b >= diff(z, list4[i])) {
- if (i > 1) {
- list4[i].im += 2*Math.PI;
- }
- list4[1].im += 1;
- //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)))));
- s = s + 500*(3-Math.min(1, diff(z, list4[i])) - Math.min(1, Math.abs(z.re - list4[i].re)));
- scoreenplus = true;
- }
- }
- coordX.add(z.re * Math.cos(z.im));
- coordY.add(z.re * Math.sin(z.im));
- //System.out.println(nbIterations + "x{0} + "+list6.toString().replaceAll("\\[", "{").replaceAll("\\]", "}"));
- window.panel.repaint();
- return scoreenplus;
- }
- public static void predict(double v2) {
- coordX2.clear();
- coordY2.clear();
- double a2 = a;
- Complex t2 = new Complex(t);
- Complex z2 = new Complex(z);
- coordX2.add(z2.re * Math.cos(z2.im));
- coordY2.add(z2.re * Math.sin(z2.im));
- for (int h = 0; h < 1; h++) {
- t2.setValue(z2);
- a2 = y9(a2);
- z2.im = z2.im+(0.04+a2/w)/(9*Math.abs(z2.re)+1);
- z2.re = z2.re+v2;
- //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();
- if (h == 0) {
- s1 = - 500*diff(z2, t2);
- s2 = 0;
- for (int i = 0; i <= n; i++) {
- if (i == 1 && list4[1].im == n-1 && z2.re*t2.re <= 0
- || i > 1 && Math.PI >= list4[i].im && b >= diff(z2, list4[i])) {
- s2 = 500*(3-Math.min(1, diff(z2, list4[i])) - Math.min(1, Math.abs(z2.re - list4[i].re)));
- s3 = Math.min(1, diff(z2, list4[i]));
- s4 = Math.min(1, Math.abs(z2.re - list4[i].re));
- }
- }
- }
- /*if (list4[1].im == 7) {
- System.out.println("dist 6 : "+diff(z2,list4[6]));
- }*/
- coordX2.add(z2.re * Math.cos(z2.im));
- coordY2.add(z2.re * Math.sin(z2.im));
- }
- }
- public static double diff(Complex c1, Complex c2) {
- return new Complex(
- c1.re*Math.cos(c1.im) - c2.re*Math.cos(c2.im),
- c1.re*Math.sin(c1.im) - c2.re*Math.sin(c2.im)).getAbs();
- }
- public static double y9(double x) {
- return p*x-w*((int)(p*x/w));
- }
- }
- class Complex {
- public double re;
- public double im;
- public Complex(double re, double im) {
- this.re = re;
- this.im = im;
- }
- public Complex(Complex c) {
- this.re = c.re;
- this.im = c.im;
- }
- public void setValue(Complex c) {
- this.re = c.re;
- this.im = c.im;
- }
- public double getAbs() {
- return Math.sqrt(this.re*this.re + this.im*this.im);
- }
- public double getArg() {
- return 2*Math.atan(this.im/(this.re+getAbs()));
- }
- @Override public String toString() {
- return this.re+"+"+this.im+"i";
- }
- }
- class Window extends JFrame {
- public Panel panel = new Panel();
- public Window() {
- this.setTitle("courage");
- this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- this.setSize(1200, 800);
- this.setContentPane(panel);
- this.setVisible(true);
- this.setLocationRelativeTo(null);
- panel.setBackground(Color.WHITE);
- panel.setFocusable(true);
- }
- }
- class Panel extends JPanel implements KeyListener {
- public Panel() {
- addKeyListener(this);
- }
- @Override
- public void paintComponent(Graphics g) {
- super.paintComponent(g);
- requestFocusInWindow();
- Graphics2D g2d = (Graphics2D)g;
- g2d.setBackground(Color.WHITE);
- /*g2d.setColor(Color.ORANGE);
- Courage.predict(Courage.v-Courage.increment);
- for (int i = 1; i < Courage.coordX2.size(); i++) {
- g2d.drawLine(this.getWidth()/2+Courage.coordX2.get(i-1), this.getHeight()/2-Courage.coordY2.get(i-1),
- this.getWidth()/2+Courage.coordX2.get(i), this.getHeight()/2-Courage.coordY2.get(i));
- }
- g2d.setColor(Color.MAGENTA);
- Courage.predict(Courage.v+Courage.increment);
- for (int i = 1; i < Courage.coordX2.size(); i++) {
- g2d.drawLine(this.getWidth()/2+Courage.coordX2.get(i-1), this.getHeight()/2-Courage.coordY2.get(i-1),
- this.getWidth()/2+Courage.coordX2.get(i), this.getHeight()/2-Courage.coordY2.get(i));
- }*/
- g2d.setColor(Color.BLACK);
- for (int i = 1; i <= Courage.n; i++) {
- g2d.drawOval(this.getWidth()/2+(int)(Courage.f*Courage.list4old[i].re-Courage.f*Courage.b),
- this.getHeight()/2-(int)(Courage.f*Courage.list4old[i].im+Courage.f*Courage.b),
- (int)(Courage.f*Courage.b*2), (int)(Courage.f*Courage.b*2));
- //g2d.setColor(Color.RED);
- //g2d.drawLine(this.getWidth()/2+(int)(Courage.f*Courage.list4old[i].re), this.getHeight()/2-(int)(Courage.f*Courage.list4old[i].im),
- //this.getWidth()/2+(int)(Courage.f*Courage.list4old[i].re), this.getHeight()/2-(int)(Courage.f*Courage.list4old[i].im));
- g2d.setColor(Color.BLACK);
- g2d.drawString(""+i, this.getWidth()/2+(int)(Courage.f*Courage.list4old[i].re), this.getHeight()/2-(int)(Courage.f*Courage.list4old[i].im));
- //g2d.drawString(i+": "+Courage.list4[i].re, 10, 140+20*i);
- }
- for (int i = 1; i < Courage.coordX.size(); i++) {
- g2d.drawLine(this.getWidth()/2+(int)(Courage.f*Courage.coordX.get(i-1)), this.getHeight()/2-(int)(Courage.f*Courage.coordY.get(i-1)),
- this.getWidth()/2+(int)(Courage.f*Courage.coordX.get(i)), this.getHeight()/2-(int)(Courage.f*Courage.coordY.get(i)));
- }
- g2d.setColor(Color.BLACK);
- //g2d.drawString("v = "+String.format("%.2f", Courage.v), 10, 20);
- g2d.drawString("v = "+Courage.v, 10, 20);
- g2d.drawString("s = "+Courage.s+" ("+(Courage.s1+Courage.s2)+")", 10, 40);
- g2d.drawString(" ("+Courage.s1+", ", 10, 60);
- g2d.drawString(" "+Courage.s2+", ", 10, 80);
- g2d.drawString(" "+Courage.s3+")", 10, 100);
- g2d.drawString(" "+Courage.s4+")", 10, 120);
- g2d.drawString("z = "+Courage.z, 10, 140);
- g2d.drawString("a = "+Courage.a+"("+Courage.y9(Courage.a)+")", 10, 160);
- /*g2d.setColor(Color.GREEN);
- 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));
- g2d.setColor(Color.RED);
- 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));
- //g2d.setColor(Color.RED);*/
- Courage.predict(Courage.v);
- g2d.setColor(Color.GREEN);
- double x1 = Courage.coordX.get(Courage.coordX.size()-1);
- double y1 = Courage.coordY.get(Courage.coordX.size()-1);
- double x2 = Courage.coordX2.get(1);
- double y2 = Courage.coordY2.get(1);
- if (x2 != x1) {
- double slope = (((double)y2-y1)/(x2-x1));
- double x3 = 10000*(x2-x1);
- double b = y1-slope*x1;
- double y3 = slope*x3+b;
- //System.out.println(y3);
- //System.out.println("test droite : "+(int)(Courage.f*x1)+" "+ (int)(Courage.f*y1)+" "+ (int)(Courage.f*x3)+" "+ (int)(Courage.f*y3));
- 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));
- }
- //for (int i = 1; i < Courage.coordX2.size(); i++) {
- for (int i = 1; i < 2; i++) {
- if (i == 1) {
- g2d.setColor(Color.RED);
- } else {
- g2d.setColor(Color.ORANGE);
- }
- g2d.drawLine(this.getWidth()/2+(int)(Courage.f*Courage.coordX2.get(i-1)), this.getHeight()/2-(int)(Courage.f*Courage.coordY2.get(i-1)),
- this.getWidth()/2+(int)(Courage.f*Courage.coordX2.get(i)), this.getHeight()/2-(int)(Courage.f*Courage.coordY2.get(i)));
- }
- }
- @Override
- public void keyPressed(KeyEvent e) {
- //System.out.println("key pressed : "+e.getKeyCode());
- Courage.keyEvent2 = e;
- }
- @Override
- public void keyReleased(KeyEvent e) {
- }
- @Override
- public void keyTyped(KeyEvent e) {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement