//LinkedListSudoku LLS[]; /*protected class LinkedListSudoku { //Total list. LinkedListSudoku previouse = null; LinkedListSudoku next = null; //Row LinkedListSudoku left = null; LinkedListSudoku right = null; //Column LinkedListSudoku top = null; LinkedListSudoku bottom = null; //Box LinkedListSudoku boxPreviouse = null; LinkedListSudoku boxNext = null; //Value Integer value = null; Integer calculatedValue = null; LinkedListSudoku(int iValue) { value = Integer.valueOf(iValue); } public String GetValue() { return (value!=Integer.valueOf(0)?value:calculatedValue!=null?calculatedValue:Integer.valueOf(0)).toString(); } public boolean IsInput() { return value==0?false:true; } private boolean HasDuplicates(Integer[] arrayList) { ArrayList vals = new ArrayList(); boolean returnValue = false; for(int i=0; i vals = new HashSet(); for (int i=1; i<=9; i++) vals.add(i); //remove row LinkedListSudoku begin = this.GetLeft(); LinkedListSudoku next; next = begin; do{ vals.remove(next.value); vals.remove(next.calculatedValue); next = next.right; }while(next != null); //remove column begin = this.GetTop(); next = begin; do{ vals.remove(next.value); vals.remove(next.calculatedValue); next = next.bottom; }while(next != null); //remove box begin = this.GetFirstBox(); next = begin; do{ vals.remove(next.value); vals.remove(next.calculatedValue); next = next.boxNext; }while(next != null); //remove last value if (this.calculatedValue != null) for (int i=1; i<=this.calculatedValue; i++) vals.remove(i); //return value if (!vals.isEmpty()) { this.calculatedValue = vals.iterator().next(); return false; } else { this.calculatedValue = 0; return true; } } } } } else // is input return false; //not valid return true; } }*/ //returns false if grid is valid /*protected boolean CheckGridForValidation(LinkedListSudoku iLLS[]) { //check grid for errors for (int i=0;i<9;i++) { if ( iLLS[i*10].CheckRow() ) return true; if ( iLLS[i*10].CheckColumn() ) return true; if ( iLLS[6].CheckBox() ) return true; } for (int i=0; i<81; i+=27) { for (int x=0; x<9; x+=3) { if ( iLLS[i+x].CheckBox() ) return true; } } return false; } */ /*public void Send(View v) { AssembleLL(); Toast.makeText(this, CheckGridForValidation(LLS)?"Your Sudoku is Invalid.":"Your Sudoku is Valid.", Toast.LENGTH_LONG).show(); for (int i=0;i<81;i++) { if (LLS[i].GetValidNummer()) { if (i==0) { if (LLS[i].IsInput()) break; break; } i-=2; } } SetGridData(GetListOfLL()); }*/ /*protected void AssembleLL() { ArrayList list = GetGridData(); LLS = new LinkedListSudoku[81]; LLS[0] = new LinkedListSudoku(Integer.parseInt(list.get(0))); //list for (int i=1; i<81; i++) { LLS[i] = new LinkedListSudoku(Integer.parseInt(list.get(i))); LLS[i-1].next = LLS[i]; LLS[i].previouse = LLS[i-1]; } //rows for (int r=0;r<9;r++) { for (int i=(r*9)+1;i<(r*9)+9;i++) { LLS[i-1].right = LLS[i]; LLS[i].left = LLS[i-1]; } } //columns for (int c=0;c<9;c++) { for (int i=1;i<9;i++) { LLS[c+((i-1)*9)].bottom = LLS[c+(i*9)]; LLS[c+(i*9)].top = LLS[c+((i-1)*9)]; } } //boxes LinkedListSudoku temp = null; for (int e=0; e<81; e+=27) { temp = null; for (int i=e+0; i GetListOfLL() { if (LLS != null) { ArrayList list = new ArrayList(); for (int i=0;i<81;i++) { list.add(LLS[i].GetValue()); } return list; } return null; }*/