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();
BakedBot bot = new BakedBot();
bot.lists.setText("NL Logic Examples", "\n input(Working?) => output(Sure)\n ");
assertEqualsVerbose("Sure", callAnswerMethod(bot, "working"));
}
public static void pExperiment() {
if (!isMain())
return;
autoRestart(5);
experimentIcon();
centerHigherConsole();
tt();
}
public static A assertEqualsVerbose(Object x, A y) {
assertEqualsVerbose((String) null, x, y);
return y;
}
public static A assertEqualsVerbose(String msg, Object x, A y) {
if (!eq(x, y)) {
throw fail((msg != null ? msg + ": " : "") + (y) + " != " + (x));
} else
print("OK: " + (x));
return y;
}
public static int callAnswerMethod_version;
public static String callAnswerMethod(String s) {
if (callAnswerMethod_version == 0)
if (hasMethod(mc(), "answer", "", new ArrayList()))
callAnswerMethod_version = 1;
else if (hasMethod(mc(), "answer", ""))
callAnswerMethod_version = 2;
else
callAnswerMethod_version = -1;
if (callAnswerMethod_version == 1)
return (String) callMC("answer", s, emptyList());
else if (callAnswerMethod_version == 2)
return (String) callMC("answer", s);
return null;
}
public static String callAnswerMethod(Object responder, String s) {
return callAnswerMethod(responder, s, litlist(s));
}
public static String callAnswerMethod(Object responder, String s, List history) {
String answer = (String) callOpt(responder, "answer", s, history);
if (answer == null)
answer = (String) callOpt(responder, "answer", s);
return emptyToNull(answer);
}
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 eq(Object a, Object b) {
return a == null ? b == null : a == b || a.equals(b);
}
public static RuntimeException fail() {
throw new RuntimeException("fail");
}
public static RuntimeException fail(Throwable e) {
throw asRuntimeException(e);
}
public static RuntimeException fail(Object msg) {
throw new RuntimeException(String.valueOf(msg));
}
public static RuntimeException fail(String msg) {
throw new RuntimeException(msg == null ? "" : msg);
}
public static RuntimeException fail(String msg, Throwable innerException) {
throw new RuntimeException(msg, innerException);
}
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