/* candyGrab.pde Written by Justin Hsia CandyGrab game (nim variant) implemented in Processing. Only a few simple player types ("agents") implemented. Plays N games and reports the winning statistics based on pieces remaining and move taken for the player who goes first. */ // choose whether to play 1 game at a time by clicking (true) // or play N games all at once (false) boolean step = false; int numPieces = 10, N = 100000; int[][] moveWon = new int[2][numPieces]; // 2D array to track times won by playing this move int[][] movePlay = new int[2][numPieces]; // 2D array to track times played this move void setup() { size(1000,300); background(255); textAlign(CENTER); rectMode(CENTER); // initialize arrays for(int i=0; i