import java.util.*;
import java.util.zip.*;
import java.util.List;
import java.util.regex.*;
import java.util.concurrent.*;
import java.util.concurrent.atomic.*;
import java.util.concurrent.locks.*;
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.swing.table.*;
import java.io.*;
import java.net.*;
import java.lang.reflect.*;
import java.lang.ref.*;
import java.lang.management.*;
import java.security.*;
import java.security.spec.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.imageio.*;
import java.math.*;
import javax.net.ssl.*;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.text.SimpleDateFormat;
import java.text.*;
import javax.imageio.metadata.*;
import javax.imageio.stream.*;
import java.text.NumberFormat;
import java.awt.datatransfer.StringSelection;
public class main {
public static void main(final String[] args) throws Exception {
pExperiment();
DerivedMechLists lists = new DerivedMechLists();
BakedBot bot = new BakedBot(lists);
lists.setText("NL Logic Examples", "\n input(how many $faces are on a $rubiks_cube) && fact(a $rubiks_cube has $six $faces) => output($six)\n \n input(how many segments are on a face of a rubik's cube) => input(how many segments are on a {face of a rubik's cube})\n ");
lists.setText("Rule & Fact Lists", "");
lists.setText("Default active scripts", "");
for (String s : ll("how many segments are on a {face of a rubik's cube}", "how many segments are on a face of a rubik's cube")) bot.pcheckOrPrintLog(s, "9");
}
public static void pExperiment() {
if (!isMain())
return;
autoRestart(5);
experimentIcon();
centerHigherConsole();
tt();
}
public static List ll(A... a) {
ArrayList l = new ArrayList(a.length);
for (A x : a) l.add(x);
return l;
}
public static boolean isMain() {
return isMainProgram();
}
public static double autoRestart_interval = 10;
public static boolean autoRestart_on, autoRestart_debug, autoRestart_simulate;
public static java.util.Timer autoRestart_timer;
public static void autoRestart(double interval) {
autoRestart_interval = interval;
autoRestart();
}
public static void autoRestart() {
if (!isMain() || autoRestart_on)
return;
autoRestart_on = true;
autoRestart_schedule();
preloadProgramTitle();
}
public static void autoRestart_off() {
if (!autoRestart_on)
return;
stopTimer(autoRestart_timer);
autoRestart_timer = null;
}
public static void autoRestart_schedule() {
autoRestart_timer = doLater_daemon(toMS(autoRestart_interval), "autoRestart_check");
}
public static void autoRestart_check() {
try {
String newMD5;
try {
newMD5 = serverAutoRestartMD5(programID());
} catch (Throwable e) {
return;
}
if (!isMD5(newMD5)) {
if (autoRestart_debug)
print("autoRestart: no server transpilation");
return;
}
if (autoRestart_localMD5 == null)
autoRestart_localMD5 = md5(loadCachedTranspilation(programID()));
String localMD5 = autoRestart_localMD5();
if (neq(localMD5, newMD5)) {
if (autoRestart_simulate)
print("Would upgrade now. " + localMD5 + " -> " + newMD5);
else {
infoBox("Upgrading " + programTitle());
restartWithDelay(500);
sleep();
}
}
} finally {
if (autoRestart_debug)
print("autoRestart: Done");
autoRestart_schedule();
}
}
public static void experimentIcon() {
consoleAndDefaultFrameIcon("#1101173");
}
public static void centerHigherConsole() {
if (headless())
return;
setConsoleHeight(600);
centerConsole();
}
public static void tt() {
typeWriterConsole();
}
public static String tt(Object contents, Object... params) {
return tag("tt", contents, params);
}
public static boolean isMainProgram() {
return creator() == null;
}
public static void preloadProgramTitle() {
{
Thread _t_0 = new Thread() {
public void run() {
try {
programTitle();
} catch (Throwable __e) {
_handleException(__e);
}
}
};
startThread(_t_0);
}
}
public static void stopTimer(java.util.Timer timer) {
if (timer != null)
timer.cancel();
}
public static java.util.Timer doLater_daemon(long delay, final Object r) {
final java.util.Timer timer = new java.util.Timer(true);
timer.schedule(timerTask(r), delay);
return timer;
}
public static java.util.Timer doLater_daemon(double delaySeconds, final Object r) {
return doLater_daemon(toMS(delaySeconds), r);
}
public static long toMS(double seconds) {
return (long) (seconds * 1000);
}
public static int serverAutoRestartMD5_timeout = 10000;
public static String serverAutoRestartMD5(String programID) {
return loadPageSilentlyWithTimeout("http://botcompany.de/1010693/raw?id=" + psI(programID), serverAutoRestartMD5_timeout);
}
public static String serverAutoRestartMD5() {
return serverAutoRestartMD5(programID());
}
public static String programID() {
return getProgramID();
}
public static String programID(Object o) {
return getProgramID(o);
}
public static boolean isMD5(String s) {
return l(s) == 32 && isLowerHexString(s);
}
public static volatile StringBuffer local_log = new StringBuffer();
public static volatile Appendable print_log = local_log;
public static volatile int print_log_max = 1024 * 1024;
public static volatile int local_log_max = 100 * 1024;
public static boolean print_silent;
public static Object print_byThread_lock = new Object();
public static volatile ThreadLocal