/** CheckerBoard egress model for project guts. By Joshua Thorp */ long steps = 0; long ticks = 0; Board board; long timeperturn = 80; int pieceAlpha = 155; InfoDisplay info; InfoPanel help; float textHeight = 24; PFont font; int penniesExited = 0; void setup() { size(500,600); //size(800,1000); //info = new InfoDisplay(0,500,500,150); info = new InfoDisplay(0,height-100,width,100); help = new InfoPanel("help.pde"); board = new Board(24,24,width,height-100); //board = new Board(16,16,width,height-100); //board = new Board(100,100,width,height-100); //board.addPiece(); } void tick() { ticks += 1; } void reset() { board.reset(); ticks = 0; penniesExited = 0; } void draw() { if (showhelp) { help.showInfo(); noLoop(); } else { long delta = millis(); background(0,0,50); steps += 1; if((info.runButton.active.status || stepit)) { tick(); if (info.addPiecesButton.active.status) board.addPiece(); if (board.move()) { board.updateBoard(); } if (info.runButton.active.status && board.pieces.size() == 0) { info.runButton.active.status = false; } loop(); } else { noLoop(); } stepit = false; board.draw(); info.draw(); delta = millis() - delta; if (steps % 100 == 0) { println("Ticks: " + ticks + " Steps: " + steps + " delta: " + delta + " frameRate: " + frameRate + " numPieces: " + board.numPieces()); } try { Thread.currentThread().sleep(max(0, timeperturn - delta)); } catch (Exception e) { println(e); } } }