1 // Source File Name: DoubleHelix.java 2 3 import java.applet.Applet; 4 import java.awt.*; 5 import java.util.StringTokenizer; 6 7 public class DoubleHelix extends Applet 8 implements Runnable 9 { 10 11 public void init() 12 { 13 appletDim = size(); 14 cFlag = 0; 15 lpaint = 0; 16 yOffset = 38; 17 currentAngle = 0; 18 nAngleBase = 0; 19 countD = 0; 20 vOffset = 0; 21 resize(appletDim.width, appletDim.height); 22 image1 = getImage(getDocumentBase(), "transmission.jpg"); 23 tracker = new MediaTracker(this); 24 tracker.addImage(image1, 0); 25 String s = getParameter("licencedUser"); 26 if(!s.equals("melt@subtle.net")) 27 return; 28 s = getParameter("creator"); 29 if(!s.equals("(c)daemn1/99:aeon@iaccess.com.au")) 30 { 31 return; 32 } else 33 { 34 //So the string is taken from the parameter to show it's an interdependnet system. 35 //Also, it's the same system of authorizing that they use to control access; HCV authenticates in this way. 36 //A piece of code from the outside interpolated into the machine code. 37 textString = getParameter("textString"); 38 setBackground(bGround); 39 image = createImage(appletDim.width, appletDim.height); 40 offscreen = image.getGraphics(); 41 offscreen.setFont(new Font("Dialog", 0, 12)); 42 offscreen.setColor(bGround); 43 offscreen.fillRect(0, 0, appletDim.width, appletDim.height); 44 return; 45 } 46 } 47 48 public void start() 49 { 50 if(DHelix == null) 51 { 52 DHelix = new Thread(this); 53 DHelix.setPriority(6); 54 DHelix.start(); 55 } 56 } 57 58 public void run() 59 { 60 do 61 try 62 { 63 if(tracker.checkID(0, true)) 64 { 65 yOffset -= 3; 66 if(yOffset < 8) 67 { 68 yOffset = 38; 69 currentAngle = (currentAngle + 21) % 360; 70 makeDna(); 71 if(countD-- < 1) 72 addCString(); 73 } 74 plotXHelix(); 75 setYOffset(); 76 HelixPaint(); 77 } else 78 { 79 loadpaint(); 80 } 81 repaint(); 82 Thread.sleep(0L); 83 } 84 catch(InterruptedException _ex) { } 85 while(true); 86 } 87 88 public void paint(Graphics g) 89 { 90 g.drawImage(image, 0, 0, this); 91 } 92 93 public void update(Graphics g) 94 { 95 paint(g); 96 } 97 98 public void loadpaint() 99 { 100 offscreen.setColor(Color.black); 101 offscreen.fillRect(0, 0, 230, 290); 102 offscreen.setColor(Color.red); 103 if(lpaint == 0) 104 offscreen.drawString("transmitting", 100, 280); 105 if(lpaint == 1) 106 offscreen.drawString("transmitting.", 100, 280); 107 if(lpaint == 2) 108 offscreen.drawString("transmitting..", 100, 280); 109 if(lpaint == 3) 110 { 111 offscreen.drawString("transmitting...", 100, 280); 112 lpaint = -1; 113 } 114 lpaint++; 115 } 116 117 public void stop() 118 { 119 if(DHelix != null) 120 { 121 DHelix.stop(); 122 DHelix = null; 123 } 124 } 125 126 public void plotXHelix() 127 { 128 nAngleBase = (currentAngle + 21) % 360; 129 for(int plotLoop = 0; plotLoop < 10; plotLoop++) 130 { 131 DNAarray[plotLoop] = (int)(32D * Math.sin((double)currentAngle * 0.017500000000000002D)); 132 currentAngle = (currentAngle + 21) % 360; 133 } 134 135 currentAngle = nAngleBase; 136 } 137 138 public void setYOffset() 139 { 140 if(currentAngle < 45) 141 { 142 vOffset = 0; 143 return; 144 } 145 if(currentAngle < 90) 146 { 147 vOffset = 1; 148 return; 149 } 150 if(currentAngle < 135) 151 { 152 vOffset = 2; 153 return; 154 } 155 if(currentAngle < 180) 156 { 157 vOffset = 1; 158 return; 159 } 160 if(currentAngle < 225) 161 { 162 vOffset = 0; 163 return; 164 } 165 if(currentAngle < 270) 166 { 167 vOffset = -1; 168 return; 169 } 170 if(currentAngle < 315) 171 { 172 vOffset = -2; 173 return; 174 } else 175 { 176 vOffset = -1; 177 return; 178 } 179 } 180 181 public void HelixPaint() 182 { 183 offscreen.drawImage(image1, 0, 0, this); 184 for(int plotLoop = 0; plotLoop < 9; plotLoop++) 185 { 186 xPlus = 100 + DNAarray[plotLoop]; 187 xMinus = 100 - DNAarray[plotLoop]; 188 ySet = 30 * plotLoop + yOffset; 189 if(plotLoop != 8) 190 { 191 offscreen.setColor(lStrand); 192 offscreen.drawLine(xPlus - 1, ySet, (100 + DNAarray[plotLoop + 1]) - 1, 30 * (plotLoop + 1) + yOffset); 193 offscreen.drawLine(xPlus + 1, ySet, 100 + DNAarray[plotLoop + 1] + 1, 30 * (plotLoop + 1) + yOffset); 194 offscreen.setColor(rStrand); 195 offscreen.drawLine(xMinus - 1, ySet, 100 - DNAarray[plotLoop + 1] - 1, 30 * (plotLoop + 1) + yOffset); 196 offscreen.drawLine(xMinus + 1, ySet, (100 - DNAarray[plotLoop + 1]) + 1, 30 * (plotLoop + 1) + yOffset); 197 } 198 offscreen.setColor(dnaLine); 199 offscreen.drawLine(xPlus, (ySet + vOffset) - 1, xMinus, ySet - vOffset - 1); 200 offscreen.drawLine(xPlus, ySet + vOffset + 1, xMinus, (ySet - vOffset) + 1); 201 parseDNAStr(plotLoop); 202 offscreen.setColor(spherez); 203 offscreen.fillOval(xPlus - 7, ySet - 7, 14, 14); 204 offscreen.setColor(lStrand); 205 offscreen.drawString(myLChar, xPlus - 4, ySet + 4); 206 offscreen.setColor(spherez); 207 offscreen.fillOval(xMinus - 7, ySet - 7, 14, 14); 208 offscreen.setColor(rStrand); 209 offscreen.drawString(myRChar, xMinus - 4, ySet + 4); 210 if(cFlag != 1) 211 offscreen.setColor(Color.yellow); 212 else 213 offscreen.setColor(rText); 214 offscreen.drawString(myLChar, 185, ySet); 215 offscreen.drawString(myRChar, 15, ySet); 216 } 217 218 } 219 220 public void parseDNAStr(int pos) 221 { //we see double-encoding here 222 cFlag = 0; 223 String gChar = dnaStr.substring(pos, pos + 1); 224 if(gChar.equals("#")) 225 { 226 myLChar = "a"; 227 myRChar = "t"; 228 return; 229 } 230 if(gChar.equals("$")) 231 { 232 myLChar = "t"; 233 myRChar = "a"; 234 return; 235 } 236 if(gChar.equals("%")) 237 { 238 myLChar = "g"; 239 myRChar = "c"; 240 return; 241 } 242 if(gChar.equals("^")) 243 { 244 myLChar = "c"; 245 myRChar = "g"; 246 return; 247 } else 248 { 249 cFlag = 1; 250 myLChar = gChar; 251 myRChar = gChar; 252 return; 253 } 254 } 255 256 public void addCString() 257 { 258 dnaStr = dnaStr.substring(0, textString.length() + 1) + textString; 259 countD = textString.length() + 10 + (int)(Math.random() * 1000D) % 8; 260 } 261 262 public void makeDna() 263 { 264 int val = (int)(Math.random() * 1000D) % 4; 265 if(val == 0) 266 dnaStr = dnaStr.substring(1) + "#"; 267 else 268 if(val == 1) 269 dnaStr = dnaStr.substring(1) + "$"; 270 else 271 if(val == 2) 272 dnaStr = dnaStr.substring(1) + "%"; 273 else 274 if(val == 3) 275 dnaStr = dnaStr.substring(1) + "^"; 276 } 277 278 private Color lookupRGBColor(String description, Color defaultColor) 279 { 280 try 281 { 282 StringTokenizer tokens = new StringTokenizer(description, ","); 283 int red = Integer.parseInt(tokens.nextToken()); 284 int green = Integer.parseInt(tokens.nextToken()); 285 int blue = Integer.parseInt(tokens.nextToken()); 286 return new Color(red, green, blue); 287 } 288 catch(Exception _ex) 289 { 290 return defaultColor; 291 } 292 } 293 294 public Color convertColor(String colStr) 295 { 296 int rd = (Integer.valueOf(colStr, 16).intValue() & 0xff0000) >> 16; 297 int gn = (Integer.valueOf(colStr, 16).intValue() & 0xff00) >> 8; 298 int bl = Integer.valueOf(colStr, 16).intValue() & 0xff; 299 return new Color(rd, gn, bl); 300 } 301 302 public DoubleHelix() 303 { 304 dnaStr = "#^%$^#%$^%$%#^%$%#^%$%#^^$%#$%$^##$%%$%^#^#%$^#^#%$#%^$%#%$^"; 305 cFlag = 0; 306 textString = new String(); 307 lpaint = 0; 308 yOffset = 38; 309 bGround = Color.black; 310 DNAarray = new int[36]; 311 currentAngle = 0; 312 nAngleBase = 0; 313 countD = 0; 314 vOffset = 0; 315 image1 = null; 316 } 317 318 Thread DHelix; 319 Dimension appletDim; 320 private String dnaStr; 321 private final String Secure = "melt@subtle.net"; 322 private final String Creator = "(c)daemn1/99:aeon@iaccess.com.au"; 323 private final int xCenter = 100; 324 private final int yCenter = 145; 325 private final int circle = 360; 326 private int cFlag; 327 private final int rad = 32; 328 private final int appRate = 125; 329 private final int iNodes = 9; 330 private final int aglStep = 21; 331 private final int ydProg = 3; 332 private final int nodePxDist = 30; 333 private String textString; 334 private final int textFromCen = 85; 335 private int lpaint; 336 private int yOffset; 337 private final Color lStrand = new Color(0xcc0000); 338 private final Color rStrand = new Color(13209); 339 private final Color bGround; 340 private final Color rText = new Color(52224); 341 private final Color vText = new Color(34952); 342 private final Color spherez = new Color(0x330033); 343 private final Color dnaLine = new Color(0x222255); 344 private int DNAarray[]; 345 private final double inc = 0.017500000000000002D; 346 private int currentAngle; 347 private int nAngleBase; 348 private int countD; 349 private int vOffset; 350 private String myLChar; 351 private String myRChar; 352 private int xPlus; 353 private int xMinus; 354 private int ySet; 355 Graphics offscreen; 356 Image image; 357 Image image1; 358 MediaTracker tracker; 359 }