1 // Decompiled by Jad v1.5.8c. Copyright 2001 Pavel Kouznetsov. 2 // Jad home page: http://www.geocities.com/kpdus/jad.html 3 // Decompiler options: packimports(3) 4 // Source File Name: LifePoet.java 5 6 import java.applet.Applet; 7 import java.awt.*; 8 9 public class fear extends Applet 10 implements Runnable 11 { 12 13 public void init() 14 { 15 tracker = new MediaTracker(this); 16 firstGen = false; 17 if(setting == 1) 18 { 19 image1 = getImage(getDocumentBase(), "love.gif"); 20 oneGen = Color.magenta; 21 nextGen = Color.red; 22 } else 23 { 24 image1 = getImage(getDocumentBase(), "fear.gif"); 25 oneGen = Color.green; 26 nextGen = Color.blue; 27 } 28 image = createImage(390, 240); 29 setBackground(Color.black); 30 cWidth = 97; 31 cHeight = 59; 32 cSize = 4; 33 cDensity = 1000; 34 world = new LifeMatrix(cWidth, cHeight, cSize, cDensity); 35 offscreen = image.getGraphics(); 36 loadpaint(); 37 repaint(); 38 } 39 40 public void start() 41 { 42 if(lifeThread == null) 43 { 44 lifeThread = new Thread(this); 45 lifeThread.start(); 46 } 47 } 48 49 public void stop() 50 { 51 lifeThread.stop(); 52 lifeThread = null; 53 } 54 55 public void run() 56 { 57 loadpaint(); 58 do 59 try 60 { 61 if(tracker.checkID(0, true)) 62 { 63 world.generate(); 64 paintGeneration(); 65 } else 66 { 67 loadpaint(); 68 } 69 Thread.sleep(0L); 70 } 71 catch(InterruptedException _ex) { } 72 while(true); 73 } 74 75 public void loadpaint() 76 { 77 offscreen.setFont(new Font("Dialog", 0, 12)); 78 offscreen.setColor(Color.red); 79 if(lpaint == 0) 80 { 81 offscreen.setColor(Color.black); 82 offscreen.fillRect(0, 0, 390, 240); 83 offscreen.drawString("transmitting", 300, 230); 84 } 85 if(lpaint == 1) 86 offscreen.drawString("transmitting.", 300, 230); 87 if(lpaint == 2) 88 offscreen.drawString("transmitting..", 300, 230); 89 if(lpaint == 3) 90 { 91 offscreen.drawString("transmitting...", 300, 230); 92 lpaint = -1; 93 } 94 lpaint++; 95 repaint(); 96 } 97 98 public void paint(Graphics g) 99 { 100 g.drawImage(image, 0, 0, this); 101 } 102 103 public void update(Graphics g) 104 { 105 paint(g); 106 } 107 108 void paintGeneration() 109 { 110 offscreen.setColor(Color.black); 111 offscreen.fillRect(0, 0, 390, 240); 112 xWobble += (int)(Math.random() * 1000D) % 3 - 1; 113 if(xWobble < 0) 114 xWobble = 1; 115 if(xWobble < 9) 116 xWobble = 8; 117 yWobble += (int)(Math.random() * 1000D) % 3 - 1; 118 if(yWobble < 0) 119 yWobble = 1; 120 if(yWobble < 9) 121 yWobble = 8; 122 offscreen.drawImage(image1, xWobble, yWobble, this); 123 for(int l = 0; l < cHeight; l++) 124 { 125 int j = l * cSize + margin; 126 for(int k = 0; k < cWidth; k++) 127 { 128 int i = k * cSize + margin; 129 if(world.grid[k][l] == 2) 130 { 131 offscreen.setColor(nextGen); 132 offscreen.fillOval(i, j, cSize, cSize); 133 } else 134 if(world.grid[k][l] == 1) 135 { 136 offscreen.setColor(oneGen); 137 offscreen.fillOval(i, j, cSize, cSize); 138 } 139 } 140 141 } 142 143 if(mCount > 3) 144 { 145 fontSize = (int)(Math.random() * 1000D) % 8 + 12; 146 offscreen.setFont(new Font("Dialog", 1, fontSize)); 147 if(setting == 0) 148 oString = fear[(int)(Math.random() * 1111D) % fear.length]; 149 if(setting == 1) 150 oString = love[(int)(Math.random() * 1111D) % love.length]; 151 mCount = 0; 152 if(setting == 1) 153 pInk = tableLove[(int)(Math.random() * 1000D) % tableLove.length]; 154 else 155 pInk = tableFear[(int)(Math.random() * 1000D) % tableFear.length]; 156 FontMetrics fontmetrics = offscreen.getFontMetrics(); 157 stringWidth = fontmetrics.stringWidth(oString); 158 str_x = (int)(Math.random() * 1000D) % (390 - stringWidth); 159 str_y = (int)(Math.random() * 1000D) % 210 + 22; 160 } 161 mCount++; 162 offscreen.setColor(Color.black); 163 offscreen.drawString(oString, str_x + 1, str_y + 1); 164 offscreen.drawString(oString, str_x + 2, str_y + 2); 165 offscreen.setColor(pInk); 166 offscreen.drawString(oString, str_x, str_y); 167 if(firstGen) 168 { 169 offscreen.setColor(Color.black); 170 offscreen.fillRect(0, 0, 390, 240); 171 firstGen = false; 172 return; 173 } else 174 { 175 repaint(); 176 return; 177 } 178 } 179 180 public fear() 181 { 182 oString = new String(); 183 setting = 0; 184 mCount = 4; 185 lpaint = 0; 186 xWobble = 5; 187 yWobble = 5; 188 lifeThread = null; 189 str_x = 0; 190 str_y = 0; 191 fontSize = 0; 192 image1 = null; 193 tableLove = (new Color[] { 194 Color.orange, new Color(0x4169e1), new Color(0xc0c0c0), Color.red, new Color(0x800080), new Color(0xdc143), new Color(0xffd700), new Color(0xee82ee), Color.white 195 }); 196 tableFear = (new Color[] { 197 Color.gray, new Color(0x4169e1), new Color(0xc0c0c0), Color.red, new Color(0x800080), new Color(0xdc143), new Color(0xffd700), new Color(0xee82ee), Color.white 198 }); 199 oneGen = Color.magenta; 200 nextGen = Color.red; 201 } 202 203 private String love[] = { 204 "love = true", "contagion == evolution", "her gentle slime envelops you", "evolving amoebic macros", "penetrating your essence", "sHe grafts to your code", "in viscous delirium", "crossing the singularity", "together foreva", "child of my blood", 205 "perfect intercellular symbiosis" 206 }; 207 private String fear[] = { 208 "fear = false", "disease == life", "there is no future without her", "code necessitates decoding", "sHe lapps your cellular shoreline", "evading recognition", "slipping lipid envelopes inside u", "conjugating logical nodes", "her swarming consciousness", "transversing territory", 209 "child of your blood" 210 }; 211 private String oString; 212 private int setting; 213 private int mCount; 214 private int lpaint; 215 private int xWobble; 216 private int yWobble; 217 static int margin = 1; 218 private boolean firstGen; 219 private int cWidth; 220 private int cHeight; 221 private int cSize; 222 private int cDensity; 223 Thread lifeThread; 224 Graphics offscreen; 225 int stringWidth; 226 int str_x; 227 int str_y; 228 int fontSize; 229 Color pInk; 230 MediaTracker tracker; 231 Image image; 232 Image image1; 233 Color tableLove[]; 234 Color tableFear[]; 235 Color oneGen; 236 Color nextGen; 237 LifeMatrix world; 238 239 }