Can someone currently program this assignment in Java? Here is the rubric link:
ID: 652067 • Letter: C
Question
Can someone currently program this assignment in Java? Here is the rubric link: http://www.mscs.mu.edu/~frahman/cosc61_fall_10/lab13.html. I pay.
Explanation / Answer
import java.util.Random; import java.util.Vector; import android.util.SparseIntArray; import static org.awesome_sudoku.activity.GameActivity.LINE_SIZE; import static org.awesome_sudoku.activity.GameActivity.LINE_SIZE_S; /** * Created by kitsu. * This file is part of SudokuLab in package org.sudoku. */ public class Game { /** * MAGIC PEOPLE! VOODOO PEOPLE! */ //TODO: auto-generating on common field size private static final int[][] BASE = new int[][]{ {1, 2, 3, 4, 5, 6, 7, 8, 9}, {4, 5, 6, 7, 8, 9, 1, 2, 3}, {7, 8, 9, 1, 2, 3, 4, 5, 6}, {2, 3, 4, 5, 6, 7, 8, 9, 1}, {5, 6, 7, 8, 9, 1, 2, 3, 4}, {8, 9, 1, 2, 3, 4, 5, 6, 7}, {3, 4, 5, 6, 7, 8, 9, 1, 2}, {6, 7, 8, 9, 1, 2, 3, 4, 5}, {9, 1, 2, 3, 4, 5, 6, 7, 8} }; /** * How much cells hide at the beginning. */ public static final int CLOSED_CELLS = 40; /** * Number of non user-defined cells. */ private int stillOpened = CLOSED_CELLS; /** * Matrix of cells. */ private int[] cells; /** * Matrix of cells mask. */ private CellMask[] mask; /** * Array of cells defined by user. */ private SparseIntArray defined; /** * @param cells matrix of cells * @param mask matrix of cells mask * @param defined array of cells defined by user */ public Game(int[] cells, CellMask[] mask, SparseIntArray defined) { this.cells = cells; this.mask = mask; this.defined = defined; if (cells == null || mask == null || defined == null) { this.cells = new int[LINE_SIZE_S]; this.mask = new CellMask[LINE_SIZE_S]; this.defined = new SparseIntArray(); generateGrid(); } else { stillOpened = CLOSED_CELLS - defined.size(); } } /** * Set cell to user-defined. * @param c cell number * @param v value to replace current * @return true if all cells are defined by user */ public boolean define(int c, int v) { if (c < 0 || c >= LINE_SIZE_S || v < 0 || v >= LINE_SIZE) return false; defined.put(c, v + 1); if (mask[c] == CellMask.HIDDEN) { --stillOpened; mask[c] = CellMask.USER_DEFINED; } return stillOpened == 0; } /** * Remove user-defined cell * @param c cell number * @return true if removed */ public boolean undefine (int c) { if (c < 0 || c >= LINE_SIZE_S || defined.get(c, -1) == -1 || mask[c] == CellMask.SHOWED) return false; defined.removeAt(defined.indexOfKey(c)); if (mask[c] == CellMask.USER_DEFINED) { mask[c] = CellMask.HIDDEN; stillOpened++; } return true; } /** * Get representation of cell based on high math. * @param c cell number * @return value of cell */ public int getCell(int c) { switch (mask[c]) { case SHOWED: return cells[c]; case USER_DEFINED: return defined.get(c); case HIDDEN: default: return 0; } } /** * Answer on request of type cell. * @param i number of cell * @return true if cell defined by user */ public boolean isUserDefined(int i) { return i = 0 && mask[i] == CellMask.USER_DEFINED; } /** * Answer on request of type cell. * @param i number of cell * @return true if cell's mask CellMask.SHOWED */ public boolean isShowed(int i) { return i = 0 && mask[i] == CellMask.SHOWED; } /** * Generate ultra-random Sudoku grid * based on nanotechnology and quantum-mechanic.* As bonus automatically hide cells. */ public void generateGrid() { clearAnswers(); for (int i = 0; i 0; i--) { int t = random.nextInt(3); int x = random.nextInt(3); int y; do {y = random.nextInt(3);} while (y == x); int z = random.nextInt(3); /*{ Log.i("Random nums", t + " " + x + " " + y + " " + z); int[] tmp = new int[LINE_SIZE]; Log.i("Array", "####################################"); for (int j = 0; j 0) { int key = defined.keyAt(0); defined.removeAt(0); mask[key] = CellMask.HIDDEN; } stillOpened = CLOSED_CELLS; } /** * Checks all cells. * @return if has error(s) true, else false */ public boolean checkCells() { for (int i = 0; i