Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Class SodokuBoard {
- static class BoardCellIndex {
- public int row;
- public int col;
- public BoardCellIndex(int row, int col){
- this.row = row;
- this.col = col;
- }
- }
- Map<BoardCellIndex, List<Integer>> board;
- public SodokuBoard(){
- board = new HashMap<BoardCellIndex, List<Integer>>();
- tmpIndex = new BoardCellIndex(0,0);
- // init board
- for(int row = 0; row < 9 ; ++row){
- for( int col = 0; col < 9 ; ++col){
- BoardCellIndex index = new BoardCellIndex(row, col);
- board.put(index, new ArrayList<Integer>);
- }
- }
- }
- // don't create new object for access of Map
- BoardCellIndex tmpIndex;
- /**
- * Ezen keresztul elered az adott cellahoz tartozo List<int>-et
- * ami a jelölteket tartalmazza, es hozza tudsz adni vagy el tudsz venni
- * jelolteket
- * pl.
- * myboard.getCandidates(1,2).add(9);
- * myboard.getCandidates(1.3).remove(1);
- */
- public List<int> getCandidates(int row, int col){
- tmpIndex.row = row;
- tmpIndex.col = col;
- return board.get(tmpIndex);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement