public GoTop() { d_boardModel = new BoardModel(19); d_groups = new Groups(); Contract.Ensures(d_groups.count == 0); }
public static void ClassInit(TestContext context) { ds_sz = 19; ds_boardModel = new BoardModel(ds_sz); Assert.IsTrue(BoardModelUtil.IsEmpty(ds_boardModel)); }
public static bool IsEmpty(BoardModel bm) { for (int row = 1; row <= bm.width; row++) { for (int col = 1; col <= bm.width; col++) { if (bm.GetCell(row, col) != CellState.EMPTY) { return false; } } } return true; }
public static string GetCellLabel(BoardModel bm, int row, int col) { return CellStateToString(bm.GetCell(row, col)) + row + ":" + col; }
public static void GenerateRandomConfiguration(int numPoints, BoardModel bm) { Random rnd = new Random(); for (int ii = 0; ii < numPoints; ii++) { int row = rnd.Next() % bm.width + 1; int col = rnd.Next() % bm.width + 1; golib.CellState st = IndexToState(rnd.Next() % 3); bm.SetCell(st, row, col); } }
public static void ClearBoard( BoardModel bm ) { for (int ii = 1; ii <= bm.width; ++ii) { for (int jj = 1; jj <= bm.width; ++jj) { bm.ClearCell(ii, jj); } } }
public static void ClassInit(TestContext context) { ds_sz = 19; ds_boardModel = new BoardModel(ds_sz); }