/* This implements a board and pieces for 9-man morris. The board is 11 columns by 7 rows */ package { import flash.display.Sprite; import flash.events.MouseEvent; public class morris2 extends Sprite { private var squares:Array; // contents of the board private var pieces:Array; // an array of symbols, //representing the pieces private var pieceHeld: int; // the piece you're holding private const winSzX = 550; private const winSzY = 550; private const vertGridSz = 35; private const horizGridSz = 45; private const numCols = int(Math.floor(winSzX/horizGridSz)); private const numRows = int(Math.floor(winSzY/vertGridSz)); private const numSquares=numRows * numCols; private const vertSize = numRows * vertGridSz; public function morris2() { var i, j, pn:int; squares = new Array(numSquares); // 11 rows * 11 columns setUpBoard(); // set up the board to start pieceHeld = -1; // set up the symbols; they will be the game pieces pieces = new Array(18); for (i=0; i<9; ++i) { pieces[i] = new wtPiece(); // pieces 0-8 are white pieces[i+9] = new bkPiece(); // 9-17 are black } // put the symbols on the stage, // but make them act like they're on a board for (i=0; i