From: gitknilch Date: Tue, 26 Feb 2013 08:58:01 +0000 (+0100) Subject: trim trailing spaces X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/FreeShisen/commitdiff_plain/2b29ab86a9dc7266750ef6c67a76d587ed5d6f99 trim trailing spaces --- diff --git a/src/de/cwde/shisensho/Board.java b/src/de/cwde/shisensho/Board.java index 140b855..f1627b0 100644 --- a/src/de/cwde/shisensho/Board.java +++ b/src/de/cwde/shisensho/Board.java @@ -7,351 +7,351 @@ import java.util.List; public class Board { private static String charpieces = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - public int difficulty=1; // 1=Hard ... N=Easy - public boolean gravity=true; - public int [] boardSize; - public char[][] board; - public LinkedList history; - - // ---------------------- - // Public methods - // ---------------------- - - public Board() { - } - - // The board always has a 1-square width free rectangle that has - // to be taken into account when specifying the size - public void initialize(int sizeI, int sizeJ) { - boardSize = new int[2]; - boardSize[0]=sizeI; - boardSize[1]=sizeJ; - board = new char[boardSize[0]][boardSize[1]]; - for (int i=0;i(); - } - - public static String pieceToString(char piece) { - return charpieces.substring(piece,1); - } - - public static char StringToPiece(String piece) { - char upiece; - long charpiecesLen=charpieces.length(); - for(upiece=0;(upiece0) result+=" "; - result+=""+(j%10); - } - result+="\n "+StringRepeat("--",boardSize[1]); - for (int i=0;i0) result+=" "; + public int difficulty=1; // 1=Hard ... N=Easy + public boolean gravity=true; + public int [] boardSize; + public char[][] board; + public LinkedList history; + + // ---------------------- + // Public methods + // ---------------------- + + public Board() { + } + + // The board always has a 1-square width free rectangle that has + // to be taken into account when specifying the size + public void initialize(int sizeI, int sizeJ) { + boardSize = new int[2]; + boardSize[0]=sizeI; + boardSize[1]=sizeJ; + board = new char[boardSize[0]][boardSize[1]]; + for (int i=0;i(); + } + + public static String pieceToString(char piece) { + return charpieces.substring(piece,1); + } + + public static char StringToPiece(String piece) { + char upiece; + long charpiecesLen=charpieces.length(); + for(upiece=0;(upiece0) result+=" "; + result+=""+(j%10); + } + result+="\n "+StringRepeat("--",boardSize[1]); + for (int i=0;i0) result+=" "; result+=charpieces.substring(board[i][j],board[i][j]+1); - } - result+=" |\n"; - if (i getPairs(int maxResults) { - List result=new ArrayList(); - List pieces=new ArrayList(); - List> piecePoints=new ArrayList>(); - for (int i=0;i points0=new ArrayList(); - points0.add(p); - pieces.add(piece); + if (upiece getPairs(int maxResults) { + List result=new ArrayList(); + List pieces=new ArrayList(); + List> piecePoints=new ArrayList>(); + for (int i=0;i points0=new ArrayList(); + points0.add(p); + pieces.add(piece); piecePoints.add(points0); - key=pieces.indexOf(piece); - piecePoints.get(key); - } else { - List points1=piecePoints.get(key); - points1.add(p); - } - } - - int nresults=0; - for (List points : piecePoints) { - int n=(int)points.size(); - for (int i=0;i path=getPath(a.copy(),b.copy()); - if (path!=null && path.size()>0) { - result.add(new Line(a,b)); - if (nresults++==maxResults) break; - } - } - if (nresults==maxResults) break; - } - if (nresults==maxResults) break; - } - return result; - } - - public int getNumPieces() { - int result=0; - for (int j=0;j points1=piecePoints.get(key); + points1.add(p); + } + } + + int nresults=0; + for (List points : piecePoints) { + int n=(int)points.size(); + for (int i=0;i path=getPath(a.copy(),b.copy()); + if (path!=null && path.size()>0) { + result.add(new Line(a,b)); + if (nresults++==maxResults) break; + } + } + if (nresults==maxResults) break; + } + if (nresults==maxResults) break; + } + return result; + } + + public int getNumPieces() { + int result=0; + for (int j=0;j getHorizontalLines(Point excludeA, Point excludeB) { - List result=new ArrayList(); - for (int i=0;i getHorizontalLines(Point excludeA, Point excludeB) { + List result=new ArrayList(); + for (int i=0;i getVerticalLines(Point excludeA, Point excludeB) { List result=new ArrayList();