///library for neural network import nn.*; //////java for counting database import java.io.*; Button submit; Button record; GameButton recordButton; GameButton guessButton; ///// screen size int Width = 640; int Height = 480; //////datas from drawings ArrayList points; int lineCount = 0; PFont f; ////////for vectors ArrayList path; ArrayList pathGuess; PrintWriter output; ArrayList pixelData; // The Neural Network Network nn; // How many training cycles have we done int trainingCount; // We will train 5,000 iterations int maxTrainingIterations = 15000; int w = 0; int h = 0; ///////////// File[] filelist; boolean lookForChange = false; int y; int x; boolean startGame = false; boolean startRecord = false; boolean training = false; boolean trainingComplete = false; boolean guessing = false; boolean welcome = true; boolean getRecord = false ; boolean clearBack = false; int total = 0; float guess = 0; String[] lines = new String[24]; float[] lineString = new float[24]; float[] binaryPixels = new float[24]; float[] guessVectorArray; void setup(){ size(Width, Height); ////drawing points points = new ArrayList(); //////vector path path = new ArrayList(); pathGuess = new ArrayList(); background(255); pixelData = new ArrayList(); ///// scaling images for speed w = width/100; h = height/100; getFile(); maxTrainingIterations = 15000*total; f = createFont("Georgia",16,true); // Setup network // println(w*h); nn = new Network(24,16); submit = new Button(150,440,160,25, "submit"); record = new Button(320, 440, 160, 25, "record"); guessButton = new GameButton(150,340,160,25, "guess"); recordButton = new GameButton(320, 340, 160, 25, "record gesture"); } void draw(){ background(255); drawing(); } void drawing(){ // Welcome screen if (welcome) { welcome(); // Training screen } else if (training) { if (!trainingComplete) { train(); } showTraining(); // Guessing screen } else if (getRecord){ vectorRecord(); getRecord(); } else { // vectorRecord(); getRecord(); guess(); } } void getFile(){ File folder = new File(sketchPath("database")); filelist = folder.listFiles(); //println(filelist.length); total = filelist.length; }