Source Code re-formatted
authorMarkus Bröker <mbroeker@largo.homelinux.org>
Fri, 17 Dec 2010 22:30:33 +0100
changeset 13 f83884cc7d2f
parent 12 d28c1e402d82
child 14 f12f77aa13b2
Source Code re-formatted
org/homelinux/largo/checkers/Checkers.java
org/homelinux/largo/checkers/KIBoard.java
org/homelinux/largo/games/board/Board.java
org/homelinux/largo/games/board/History.java
org/homelinux/largo/games/board/MouseListener.java
org/homelinux/largo/games/board/Move.java
org/homelinux/largo/games/board/Piece.java
org/homelinux/largo/games/board/Point.java
org/homelinux/largo/games/board/checkersboard/CheckersBoard.java
org/homelinux/largo/games/board/chessboard/ChessBoard.java
org/homelinux/largo/schach/KIBoard.java
org/homelinux/largo/schach/Schach.java
org/homelinux/largo/utils/BrowserLaunch.java
org/homelinux/largo/utils/ImgComponent.java
--- a/org/homelinux/largo/checkers/Checkers.java
+++ b/org/homelinux/largo/checkers/Checkers.java
@@ -22,214 +22,214 @@
 import org.homelinux.largo.utils.BrowserLaunch;
 
 public class Checkers extends JFrame implements Runnable {
-	static final long serialVersionUID = 250408;
-	static final String helpURL = "http://largo.homelinux.org/cgi-bin/gitweb.cgi?p=games/Schach.git;a=summary";
+    static final long serialVersionUID = 250408;
+    static final String helpURL = "http://largo.homelinux.org/cgi-bin/gitweb.cgi?p=games/Schach.git;a=summary";
 
-	MouseListener listener;
-	KIBoard board;
-	Point p;
-	JLabel    human = new JLabel("<html><font size='5' color='#FFFFFF'>Human</font></html>");
-	JLabel computer = new JLabel("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-	JButton     neu = new JButton("Play");
-	JButton  pconly = new JButton("PC-PC");
-	JButton    back = new JButton("Back");
-	JButton forward = new JButton("For");
-	JButton    help = new JButton("Source");
+    MouseListener listener;
+    KIBoard board;
+    Point p;
+    JLabel human = new JLabel("<html><font size='5' color='#FFFFFF'>Human</font></html>");
+    JLabel computer = new JLabel("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+    JButton neu = new JButton("Play");
+    JButton pconly = new JButton("PC-PC");
+    JButton back = new JButton("Back");
+    JButton forward = new JButton("For");
+    JButton help = new JButton("Source");
 
-	SpinnerNumberModel model = new SpinnerNumberModel(4, 1, 8, 1);
-	JSpinner combo = new JSpinner(model);
+    SpinnerNumberModel model = new SpinnerNumberModel(4, 1, 8, 1);
+    JSpinner combo = new JSpinner(model);
 
-	JPanel panel;
-	JPanel fpanel;
+    JPanel panel;
+    JPanel fpanel;
 
-	int search_depth;
+    int search_depth;
 
-	boolean pc_only;
+    boolean pc_only;
 
-	public Checkers (int w, int h) {
-		super("Checkers by Largo Enterprises");
-		setDefaultCloseOperation (javax.swing.JFrame.EXIT_ON_CLOSE);
-		board = new KIBoard(w, h);
+    public Checkers(int w, int h) {
+        super("Checkers by Largo Enterprises");
+        setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
+        board = new KIBoard(w, h);
 
-		fpanel = new JPanel();
-		fpanel.add(back);
-		fpanel.add(neu);
-		fpanel.add(combo);
-		fpanel.add(pconly);
-		fpanel.add(help);
-		fpanel.add(forward);
+        fpanel = new JPanel();
+        fpanel.add(back);
+        fpanel.add(neu);
+        fpanel.add(combo);
+        fpanel.add(pconly);
+        fpanel.add(help);
+        fpanel.add(forward);
 
-		panel = new JPanel();
-		panel.setLayout(new BorderLayout());
-		panel.add(human, "West");
-		panel.add(fpanel, "Center");
-		panel.add(computer, "East");
+        panel = new JPanel();
+        panel.setLayout(new BorderLayout());
+        panel.add(human, "West");
+        panel.add(fpanel, "Center");
+        panel.add(computer, "East");
 
-		fpanel.setBackground(new Color(50, 100, 200));
-		panel.setBackground(new Color(50, 100, 200));
+        fpanel.setBackground(new Color(50, 100, 200));
+        panel.setBackground(new Color(50, 100, 200));
 
-		getContentPane().setLayout(new BorderLayout());
-		getContentPane().add(panel, "North");
-		getContentPane().add(board, "Center");
+        getContentPane().setLayout(new BorderLayout());
+        getContentPane().add(panel, "North");
+        getContentPane().add(board, "Center");
 
-		neu.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent actionevent) {
-				human.setText("<html><font size='5' color='#FFFFFF'>Human</font></html>");
-				computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				pc_only = false;
-				board.init();
-				board.negateEstimation(false);
-			}
-		});
+        neu.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionevent) {
+                human.setText("<html><font size='5' color='#FFFFFF'>Human</font></html>");
+                computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                pc_only = false;
+                board.init();
+                board.negateEstimation(false);
+            }
+        });
 
-		pconly.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent actionevent) {
-				human.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				pc_only = true;
-			}
-		});
+        pconly.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionevent) {
+                human.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                pc_only = true;
+            }
+        });
 
-		back.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent actionevent) {
-				board.backwards();
-			}
-		});
+        back.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionevent) {
+                board.backwards();
+            }
+        });
 
-		forward.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent actionevent) {
-				board.forward();
-			}
-		});
+        forward.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionevent) {
+                board.forward();
+            }
+        });
 
-		help.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent actionevent) {
-				BrowserLaunch browser = new BrowserLaunch();
-				browser.openURL(helpURL);
-			}
-		});
+        help.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionevent) {
+                BrowserLaunch browser = new BrowserLaunch();
+                browser.openURL(helpURL);
+            }
+        });
 
-		listener = board.getMouseListener();
+        listener = board.getMouseListener();
 
-		pc_only = false;
-		search_depth = 3;
-		pack();
-	}
+        pc_only = false;
+        search_depth = 3;
+        pack();
+    }
 
-	public void computer_play () {
-		while (pc_only) {
-			search_depth = model.getNumber().intValue()-1;
+    public void computer_play() {
+        while (pc_only) {
+            search_depth = model.getNumber().intValue() - 1;
 
-			if ( !board.isBlacksTurn() ) {
-				human.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
-				board.negateEstimation(true);
-				if (!board.doBestMove(search_depth) ) {
-					pc_only = false;
-					return;
-				}
-				board.negateEstimation(false);
-				human.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				board.setBlacksTurn(true);
-			} else {
-				computer.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
-				if (!board.doBestMove(search_depth) ) {
-					pc_only = false;
-					return;
-				}
-				computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				board.setBlacksTurn(false);
+            if (!board.isBlacksTurn()) {
+                human.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
+                board.negateEstimation(true);
+                if (!board.doBestMove(search_depth)) {
+                    pc_only = false;
+                    return;
+                }
+                board.negateEstimation(false);
+                human.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                board.setBlacksTurn(true);
+            } else {
+                computer.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
+                if (!board.doBestMove(search_depth)) {
+                    pc_only = false;
+                    return;
+                }
+                computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                board.setBlacksTurn(false);
 
-				if (board.simu_debug()) {
-					for (int i=0;i<64;i++) {
-						if((i+1)%8 == 0 )
-							System.err.printf("%2d=%d%n", i, board.getValue(i));
-						else
-							System.err.printf("%2d=%d ", i, board.getValue(i));
-					}
-				}
+                if (board.simu_debug()) {
+                    for (int i = 0; i < 64; i++) {
+                        if ((i + 1) % 8 == 0)
+                            System.err.printf("%2d=%d%n", i, board.getValue(i));
+                        else
+                            System.err.printf("%2d=%d ", i, board.getValue(i));
+                    }
+                }
 
-				try {
-					Thread.sleep (10);
-				} catch (InterruptedException e) {
-					System.err.println("computer_play: " + e.getLocalizedMessage());
-					System.err.println("========================================================================");
-					e.printStackTrace();
-					System.err.println("========================================================================");
-					return;
-				}
-			}
-		}
-	}
+                try {
+                    Thread.sleep(10);
+                } catch (InterruptedException e) {
+                    System.err.println("computer_play: " + e.getLocalizedMessage());
+                    System.err.println("========================================================================");
+                    e.printStackTrace();
+                    System.err.println("========================================================================");
+                    return;
+                }
+            }
+        }
+    }
 
-	public void run () {
-		for (;;) {
+    public void run() {
+        for (;;) {
 
-			/* is this thread safe */
-			search_depth = model.getNumber().intValue()-1;
+            /* is this thread safe */
+            search_depth = model.getNumber().intValue() - 1;
 
-			if (pc_only) {
-				computer_play ();
-			}
+            if (pc_only) {
+                computer_play();
+            }
 
-			if ( !board.isBlacksTurn() ) {
-				if (listener.isSelected ()) {
-					p = listener.getSelection ();
-					if (board.move (p))
-						board.setBlacksTurn(true);
-				}
-				try {
-					Thread.sleep (50);
-				}
-				catch (InterruptedException e) {
-					System.err.println("Schach::run: " + e.getLocalizedMessage());
-					System.err.println("========================================================================");
-					e.printStackTrace();
-					System.err.println("========================================================================");
-					return;
-				}
-			} else {
-				human.setText("<html><font size='5' color='#FFFFFF'>Human</font></html>");
-				computer.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
-				board.doBestMove(search_depth);
-				human.setText("<html><font size='5' color='#FF3333'>Human</font></html>");
-				computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				board.setBlacksTurn(false);
+            if (!board.isBlacksTurn()) {
+                if (listener.isSelected()) {
+                    p = listener.getSelection();
+                    if (board.move(p))
+                        board.setBlacksTurn(true);
+                }
+                try {
+                    Thread.sleep(50);
+                } catch (InterruptedException e) {
+                    System.err.println("Schach::run: " + e.getLocalizedMessage());
+                    System.err.println("========================================================================");
+                    e.printStackTrace();
+                    System.err.println("========================================================================");
+                    return;
+                }
+            } else {
+                human.setText("<html><font size='5' color='#FFFFFF'>Human</font></html>");
+                computer.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
+                board.doBestMove(search_depth);
+                human.setText("<html><font size='5' color='#FF3333'>Human</font></html>");
+                computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                board.setBlacksTurn(false);
 
-				if (board.simu_debug()) {
-					for (int i=0;i<64;i++) {
-						if((i+1)%8 == 0 )
-							System.out.printf("%2d=%d%n", i, board.getValue(i));
-						else
-							System.out.printf("%2d=%d ", i, board.getValue(i));
-					}
-				}
-			}
-		}
-	}
+                if (board.simu_debug()) {
+                    for (int i = 0; i < 64; i++) {
+                        if ((i + 1) % 8 == 0)
+                            System.out.printf("%2d=%d%n", i, board.getValue(i));
+                        else
+                            System.out.printf("%2d=%d ", i, board.getValue(i));
+                    }
+                }
+            }
+        }
+    }
 
-	public static void main (String args[]) {
-		Checkers c = new Checkers (74, 74);
+    public static void main(String args[]) {
+        Checkers c = new Checkers(74, 74);
 
-		c.setResizable(false);
-		c.setVisible (true);
+        c.setResizable(false);
+        c.setVisible(true);
 
-		if (args.length == 1 ) {
-			if ( args[0].equals("full") )
-				c.board.setDebug(true, true);
-			else if ( args[0].equals("simu") )
-				c.board.setDebug(true, false);
-			else if ( args[0].equals("undo") )
-				c.board.setDebug(false, true);
-			else if ( args[0].equals("none") )
-				c.board.setDebug(false, false);
-			else {
-				System.out.println("   Chess: java -jar games.jar [full|simu|undo|none]");
-				System.out.println("Checkers: java -cp games.jar org.homelinux.largo.checkers.Checkers [full|simu|undo|none]");
-			}
-		}
+        if (args.length == 1) {
+            if (args[0].equals("full"))
+                c.board.setDebug(true, true);
+            else if (args[0].equals("simu"))
+                c.board.setDebug(true, false);
+            else if (args[0].equals("undo"))
+                c.board.setDebug(false, true);
+            else if (args[0].equals("none"))
+                c.board.setDebug(false, false);
+            else {
+                System.out.println("   Chess: java -jar games.jar [full|simu|undo|none]");
+                System.out
+                        .println("Checkers: java -cp games.jar org.homelinux.largo.checkers.Checkers [full|simu|undo|none]");
+            }
+        }
 
-		Thread t = new Thread(c);
-		t.setPriority(Thread.NORM_PRIORITY-1);
-		t.start();
-	}
+        Thread t = new Thread(c);
+        t.setPriority(Thread.NORM_PRIORITY - 1);
+        t.start();
+    }
 }
--- a/org/homelinux/largo/checkers/KIBoard.java
+++ b/org/homelinux/largo/checkers/KIBoard.java
@@ -9,194 +9,196 @@
 import org.homelinux.largo.games.board.checkersboard.CheckersBoard;
 
 public class KIBoard extends CheckersBoard {
-	static final long serialVersionUID = 250408;
-	static final int game_const = 500;
+    static final long serialVersionUID = 250408;
+    static final int game_const = 500;
 
-	protected boolean SIMU_DEBUG  = false;
-	private boolean negate_estimation = false;
+    protected boolean SIMU_DEBUG = false;
+    private boolean negate_estimation = false;
 
-	private Move bestMove;
-	private int desired_depth;
+    private Move bestMove;
+    private int desired_depth;
 
-	public KIBoard(int w, int h) {
-		super(w, h);
-		desired_depth = -1;
-	}
+    public KIBoard(int w, int h) {
+        super(w, h);
+        desired_depth = -1;
+    }
 
-	/**
-	 * Set the current DEBUG-Level:
-	 * simu: print all valid, simulated moves
-	 * undo: print all undos
-	 */
-	public void setDebug(boolean simu, boolean undo) {
-		SIMU_DEBUG = simu;
-		UNDO_DEBUG = undo;
-	}
+    /**
+     * Set the current DEBUG-Level: simu: print all valid, simulated moves undo:
+     * print all undos
+     */
+    public void setDebug(boolean simu, boolean undo) {
+        SIMU_DEBUG = simu;
+        UNDO_DEBUG = undo;
+    }
 
-	public boolean simu_debug() {
-		return SIMU_DEBUG;
-	}
+    public boolean simu_debug() {
+        return SIMU_DEBUG;
+    }
 
-	public boolean undo_debug() {
-		return UNDO_DEBUG;
-	}
+    public boolean undo_debug() {
+        return UNDO_DEBUG;
+    }
 
-	/**
-	 * This function flips the sides: Player A maximizes and Player B minimizes
-	 */
-	public void negateEstimation(boolean b) {
-		negate_estimation = b;
-	}
+    /**
+     * This function flips the sides: Player A maximizes and Player B minimizes
+     */
+    public void negateEstimation(boolean b) {
+        negate_estimation = b;
+    }
 
-	/**
-	 * The Minimax-Algorithm works for TWO-PLAYER Games
-	 * Player A minimizes, Player B maximizes
-	 */
-	public int estimateFunction() {
-		int i;
-		int white = 0;
-		int black = 0;
+    /**
+     * The Minimax-Algorithm works for TWO-PLAYER Games Player A minimizes,
+     * Player B maximizes
+     */
+    public int estimateFunction() {
+        int i;
+        int white = 0;
+        int black = 0;
 
-		for(i=0;i<64;i++) {
-			if (isWhite(i))
-				white+=getValue(i);
-			if (isBlack(i))
-				black+=getValue(i);
-		}
+        for (i = 0; i < 64; i++) {
+            if (isWhite(i))
+                white += getValue(i);
+            if (isBlack(i))
+                black += getValue(i);
+        }
 
-		/**
-		 * solves ticket #3
-		 */
-		if ( negate_estimation )
-			return white-black;
+        /**
+         * solves ticket #3
+         */
+        if (negate_estimation)
+            return white - black;
 
-		return black-white;
-	}
+        return black - white;
+    }
 
-	/**
-	 * simulates and returns the next possible move for a Player or null, when no more moves are possible.
-	 * The Turn will flip automatically if "simulate(...)" finds a valid move.
-	 */
-	Move simulate(int t, int o) {
-		Move move = null;
-		int value;
+    /**
+     * simulates and returns the next possible move for a Player or null, when
+     * no more moves are possible. The Turn will flip automatically if
+     * "simulate(...)" finds a valid move.
+     */
+    Move simulate(int t, int o) {
+        Move move = null;
+        int value;
 
-		if ( validTurn(o) ) {
-			while ( t < 64 ) {
-				if (!simulateMove(t, o) ) {
-					t++;
-					continue;
-				}
+        if (validTurn(o)) {
+            while (t < 64) {
+                if (!simulateMove(t, o)) {
+                    t++;
+                    continue;
+                }
 
-				value = estimateFunction();
-				move = new Move(value, t, o);
+                value = estimateFunction();
+                move = new Move(value, t, o);
 
-				/* Flip Sides */
-				setBlacksTurn(!isBlacksTurn());
-				return move;
-			}
-		}
-		return null;
-	}
+                /* Flip Sides */
+                setBlacksTurn(!isBlacksTurn());
+                return move;
+            }
+        }
+        return null;
+    }
 
-	/**
-	 * AlphaBeta-Algorithm: the Maximizer
-	 */
-	int max_alpha_beta (int depth, int alpha, int beta) {
-		int moveValue;
-		int o, t;
-		Move move = null;
+    /**
+     * AlphaBeta-Algorithm: the Maximizer
+     */
+    int max_alpha_beta(int depth, int alpha, int beta) {
+        int moveValue;
+        int o, t;
+        Move move = null;
 
-		if ( desired_depth == -1 )
-			desired_depth = depth;
+        if (desired_depth == -1)
+            desired_depth = depth;
 
-		for (o = 0; o < 64; o++) {
-			t=0;
-			while ( (move=simulate(t, o)) != null ) {
-				/* particular move from black */
-				t = move.target;
+        for (o = 0; o < 64; o++) {
+            t = 0;
+            while ((move = simulate(t, o)) != null) {
+                /* particular move from black */
+                t = move.target;
 
-				if ( depth == 0 || Math.abs(move.value) > game_const )
-					moveValue = move.value;
-				else /* best next move */
-					moveValue = min_alpha_beta(depth-1, alpha, beta);
+                if (depth == 0 || Math.abs(move.value) > game_const)
+                    moveValue = move.value;
+                else
+                    /* best next move */
+                    moveValue = min_alpha_beta(depth - 1, alpha, beta);
 
-				undo();
-				t++;
+                undo();
+                t++;
 
-				if ( moveValue >= beta )
-					return beta;
+                if (moveValue >= beta)
+                    return beta;
 
-				if ( moveValue > alpha ) {
-					alpha = moveValue;
-					if ( depth == desired_depth )
-						bestMove = move;
-				}
-			}
-		}
+                if (moveValue > alpha) {
+                    alpha = moveValue;
+                    if (depth == desired_depth)
+                        bestMove = move;
+                }
+            }
+        }
 
-		return alpha;
-	}
+        return alpha;
+    }
 
-	/**
-	 * AlphaBeta-Algorithm: the Minimizer
-	 */
-	int min_alpha_beta(int depth, int alpha, int beta) {
-		int moveValue;
-		int o, t;
-		Move move = null;
+    /**
+     * AlphaBeta-Algorithm: the Minimizer
+     */
+    int min_alpha_beta(int depth, int alpha, int beta) {
+        int moveValue;
+        int o, t;
+        Move move = null;
 
-		for (o = 0; o < 64; o++) {
-			t=0;
-			while ( (move=simulate(t, o)) != null ) {
-				/* particular move from white */
-				t = move.target;
+        for (o = 0; o < 64; o++) {
+            t = 0;
+            while ((move = simulate(t, o)) != null) {
+                /* particular move from white */
+                t = move.target;
 
-				if ( depth == 0 || Math.abs(move.value) > game_const )
-					moveValue = move.value;
-				else /* best next move */
-					moveValue = max_alpha_beta(depth-1, alpha, beta);
+                if (depth == 0 || Math.abs(move.value) > game_const)
+                    moveValue = move.value;
+                else
+                    /* best next move */
+                    moveValue = max_alpha_beta(depth - 1, alpha, beta);
 
-				undo();
-				t++;
+                undo();
+                t++;
 
-				if ( moveValue <= alpha )
-					return alpha;
+                if (moveValue <= alpha)
+                    return alpha;
 
-				if ( moveValue < beta )
-					beta = moveValue;
-			}
-		}
+                if (moveValue < beta)
+                    beta = moveValue;
+            }
+        }
 
-		return beta;
-	}
+        return beta;
+    }
 
-	/**
-	 * Evaluates the next, best Move after search_depth half-moves.
-	 * When the Machine has Black, set negateEstimation(false);
-	 * When the Machine has White, set negateEstimation(true);
-	 */
-	public boolean doBestMove(int search_depth) {
-		int value;
+    /**
+     * Evaluates the next, best Move after search_depth half-moves. When the
+     * Machine has Black, set negateEstimation(false); When the Machine has
+     * White, set negateEstimation(true);
+     */
+    public boolean doBestMove(int search_depth) {
+        int value;
 
-		desired_depth = -1;
-		bestMove = null;
-		value = max_alpha_beta(search_depth, Integer.MIN_VALUE, Integer.MAX_VALUE);
+        desired_depth = -1;
+        bestMove = null;
+        value = max_alpha_beta(search_depth, Integer.MIN_VALUE, Integer.MAX_VALUE);
 
-		if ( bestMove == null ) {
-			System.err.println("Computing once more...");
-			value = max_alpha_beta(1, Integer.MIN_VALUE, Integer.MAX_VALUE);
-			if (bestMove == null) {
-				System.out.println("Finito " + value);
-				return false;
-			}
-		}
+        if (bestMove == null) {
+            System.err.println("Computing once more...");
+            value = max_alpha_beta(1, Integer.MIN_VALUE, Integer.MAX_VALUE);
+            if (bestMove == null) {
+                System.out.println("Finito " + value);
+                return false;
+            }
+        }
 
-		if (doMove(bestMove.target, bestMove.origin)) {
-			System.out.println("Next Move");
-			return true;
-		}
+        if (doMove(bestMove.target, bestMove.origin)) {
+            System.out.println("Next Move");
+            return true;
+        }
 
-		return false;
-	}
+        return false;
+    }
 }
--- a/org/homelinux/largo/games/board/Board.java
+++ b/org/homelinux/largo/games/board/Board.java
@@ -14,382 +14,381 @@
 import javax.swing.JPanel;
 
 public class Board extends JPanel {
-	static final long serialVersionUID = 140208;
+    static final long serialVersionUID = 140208;
+
+    protected boolean UNDO_DEBUG = false;
 
-	protected boolean UNDO_DEBUG  = false;
+    protected Piece board_pieces[];
+    private Piece pieces[];
 
-	protected Piece board_pieces[];
-	private Piece pieces[];
+    protected Vector<History> stack;
+    protected int moveNr;
 
-	protected Vector<History> stack;
-	protected int moveNr;
+    protected static final int EMPTY = 0;
+
+    Color color_black;
+    Color color_white;
 
-	protected static final int EMPTY = 0;
+    int iHeight;
+    int iWidth;
+    int xPos;
+    int yPos;
 
-	Color color_black;
-	Color color_white;
+    boolean black;
+    boolean blacksTurn;
 
-	int iHeight;
-	int iWidth;
-	int xPos;
-	int yPos;
+    MouseListener listener;
 
-	boolean black;
-	boolean blacksTurn;
-
-	MouseListener listener;
+    /**
+     * The init method initializes an empty board with a history.
+     */
+    public void init() {
+        int i;
+        pieces = new Piece[64];
 
-	/**
-	 * The init method initializes an empty board with a history.
-	 */
-	public void init() {
-		int i;
-		pieces = new Piece[64];
+        for (i = 0; i < 64; i++) {
+            pieces[i] = new Piece(null, null, EMPTY, 0);
+        }
+
+        xPos = 0;
+        yPos = 0;
 
-		for (i = 0; i < 64; i++) {
-			pieces[i] = new Piece(null, null, EMPTY, 0);
-		}
-
-		xPos = 0;
-		yPos = 0;
+        black = false;
+        blacksTurn = false;
+        board_pieces = getPieces(pieces);
+        stack = new Vector<History>();
+        moveNr = 0;
+    }
 
-		black = false;
-		blacksTurn = false;
-		board_pieces = getPieces(pieces);
-		stack = new Vector<History>();
-		moveNr = 0;
-	}
+    public Board(int w, int h) {
+        iWidth = w;
+        iHeight = h;
+        color_white = new Color(255, 255, 255);
+        color_black = new Color(50, 100, 200);
+        setPreferredSize(new Dimension(8 * iWidth, 8 * iHeight));
 
-	public Board (int w, int h) {
-		iWidth = w;
-		iHeight = h;
-		color_white = new Color (255, 255, 255);
-		color_black = new Color (50, 100, 200);
-		setPreferredSize (new Dimension(8 * iWidth, 8 * iHeight));
+        init();
+        listener = new MouseListener(iWidth, iHeight);
+        addMouseListener(listener);
+    }
 
-		init();
-		listener = new MouseListener(iWidth, iHeight);
-		addMouseListener(listener);
-	}
+    /**
+     * getPiece returns a Piece-Object from the Board Cache. It might not be
+     * visible on the current board.
+     */
+    public Piece getPiece(int t) {
+        return pieces[t];
+    }
 
-	/**
-	 * getPiece returns a Piece-Object from the Board Cache. It might not be visible on the current board.
-	 */
-	public Piece getPiece(int t) {
-		return pieces[t];
-	}
+    /**
+     * setPiece sets a Piece-Object into the Board Cache and will not be
+     * visible.
+     */
+    protected void setPiece(int t, Piece p) {
+        pieces[t] = p;
+    }
 
-	/**
-	 * setPiece sets a Piece-Object into the Board Cache and will not be visible.
-	 */
-	protected void setPiece(int t, Piece p) {
-		pieces[t] = p;
-	}
+    protected Piece[] getPieces() {
+        return getPieces(pieces);
+    }
 
-	protected Piece[] getPieces() {
-		return getPieces(pieces);
-	}
+    private Piece[] getPieces(Piece[] which_pieces) {
+        Piece[] p = new Piece[64];
+        int i;
 
-	private Piece[] getPieces(Piece[] which_pieces) {
-		Piece[] p = new Piece[64];
-		int i;
+        for (i = 0; i < 64; i++)
+            p[i] = new Piece(which_pieces[i]);
 
-		for ( i=0;i<64;i++)
-			p[i] = new Piece(which_pieces[i]);
+        return p;
+    }
 
-		return p;
-	}
-
-	protected void setPieces(Piece[] p) {
-		pieces = p;
-	}
+    protected void setPieces(Piece[] p) {
+        pieces = p;
+    }
 
-	/**
-	 * needed in paint(Graphics g)
-	 */
-	private Image getBoardImage (int i) {
-		return board_pieces[i].image;
-	}
+    /**
+     * needed in paint(Graphics g)
+     */
+    private Image getBoardImage(int i) {
+        return board_pieces[i].image;
+    }
 
-	/**
-	 * getMouseListener returns a valid MouseListener for this Board.
-	 */
-	public MouseListener getMouseListener() {
-		return listener;
-	}
+    /**
+     * getMouseListener returns a valid MouseListener for this Board.
+     */
+    public MouseListener getMouseListener() {
+        return listener;
+    }
 
-	/**
-	 * currentMove returns the current stack.size().
-	 */
-	public int currentMove() {
-		return stack.size();
-	}
+    /**
+     * currentMove returns the current stack.size().
+     */
+    public int currentMove() {
+        return stack.size();
+    }
 
-	/**
-	 * returns the color of piece[i].
-	 */
-	public String getColor(int i) {
-		return pieces[i].color;
-	}
+    /**
+     * returns the color of piece[i].
+     */
+    public String getColor(int i) {
+        return pieces[i].color;
+    }
 
-	/**
-	 * returns the current Value of a particular piece.
-	 */
-	public int getValue(int i) {
-		return pieces[i].value;
-	}
+    /**
+     * returns the current Value of a particular piece.
+     */
+    public int getValue(int i) {
+        return pieces[i].value;
+    }
 
-	/**
-	 * Defined Integer Constants: EMTPY = 0
-	 */
-	public int getType(int i) {
-		return pieces[i].type;
-	}
+    /**
+     * Defined Integer Constants: EMTPY = 0
+     */
+    public int getType(int i) {
+        return pieces[i].type;
+    }
 
-	public boolean isEmpty (int i) {
-		if (pieces[i].type == EMPTY)
-			return true;
-		return false;
-	}
+    public boolean isEmpty(int i) {
+        if (pieces[i].type == EMPTY)
+            return true;
+        return false;
+    }
 
-	boolean BoardisEmpty (int i) {
-		if (board_pieces[i].type == EMPTY)
-			return true;
-		return false;
-	}
+    boolean BoardisEmpty(int i) {
+        if (board_pieces[i].type == EMPTY)
+            return true;
+        return false;
+    }
 
-	/**
-	 * blacksTurn = true  -> Black moves
-	 * blacksTurn = false -> White moves
-	 */
-	public boolean isBlacksTurn() {
-		return blacksTurn;
-	}
+    /**
+     * blacksTurn = true -> Black moves blacksTurn = false -> White moves
+     */
+    public boolean isBlacksTurn() {
+        return blacksTurn;
+    }
 
-	public void setBlacksTurn(boolean b) {
-		blacksTurn = b;
-	}
+    public void setBlacksTurn(boolean b) {
+        blacksTurn = b;
+    }
+
+    /**
+     * returns true, when piece[i] is white
+     */
+    public boolean isWhite(int i) {
+        if (isEmpty(i))
+            return false;
 
-	/**
-	 * returns true, when piece[i] is white
-	 */
-	public boolean isWhite(int i) {
-		if ( isEmpty(i) )
-			return false;
+        if (pieces[i].color.equals("white"))
+            return true;
+        return false;
+    }
 
-		if ( pieces[i].color.equals ("white") )
-			return true;
-		return false;
-	}
+    /**
+     * returns true, when piece[i] is black
+     */
+    public boolean isBlack(int i) {
+        if (isEmpty(i))
+            return false;
 
-	/**
-	 * returns true, when piece[i] is black
-	 */
-	public boolean isBlack(int i) {
-		if ( isEmpty(i) )
-			return false;
+        if (pieces[i].color.equals("black"))
+            return true;
+        return false;
+    }
 
-		if ( pieces[i].color.equals ("black") )
-			return true;
-		return false;
-	}
-
-	/**
-	 * returns true, when both pieces have opposite colors
-	 */
-	public boolean isEnemy(int t, int o) {
-		if ( isEmpty(t) )
-			return false;
+    /**
+     * returns true, when both pieces have opposite colors
+     */
+    public boolean isEnemy(int t, int o) {
+        if (isEmpty(t))
+            return false;
 
-		if (!pieces[t].color.equals (pieces[o].color) )
-			return true;
-		return false;
-	}
+        if (!pieces[t].color.equals(pieces[o].color))
+            return true;
+        return false;
+    }
 
-	/**
-	 * returns true, when both pieces have the same color
-	 */
-	public boolean isSamePiece(int t, int o) {
-		if ( isEmpty(t) )
-			return false;
+    /**
+     * returns true, when both pieces have the same color
+     */
+    public boolean isSamePiece(int t, int o) {
+        if (isEmpty(t))
+            return false;
 
-		if (pieces[t].color.equals (pieces[o].color) )
-			return true;
-		return false;
-	}
+        if (pieces[t].color.equals(pieces[o].color))
+            return true;
+        return false;
+    }
 
-	/**
-	 * This function checks for the color of the piece at piece[i] and returns true,
-	 * if the color matches the current Turn.
-	 */
-	public boolean validTurn(int i) {
-		if ( isEmpty(i) )
-			return false;
+    /**
+     * This function checks for the color of the piece at piece[i] and returns
+     * true, if the color matches the current Turn.
+     */
+    public boolean validTurn(int i) {
+        if (isEmpty(i))
+            return false;
 
-		if ( getColor(i).equals("white") && isBlacksTurn() )
-			return false;
-		if ( getColor(i).equals("black") && !isBlacksTurn() )
-			return false;
-		return true;
-	}
+        if (getColor(i).equals("white") && isBlacksTurn())
+            return false;
+        if (getColor(i).equals("black") && !isBlacksTurn())
+            return false;
+        return true;
+    }
 
-	/**
-	 * simulates a "valid" move or returns false.
-	 * all changes are relative to pieces and will not be painted.
-	 * This method sets internal variables for the rochade() method, which will be overidden.
-	 */
-	public boolean simulateMove(int t, int o) {
-		if ( !validMove(t, o) ) {
-			return false;
-		}
+    /**
+     * simulates a "valid" move or returns false. all changes are relative to
+     * pieces and will not be painted. This method sets internal variables for
+     * the rochade() method, which will be overidden.
+     */
+    public boolean simulateMove(int t, int o) {
+        if (!validMove(t, o)) {
+            return false;
+        }
 
-		push(pieces[t], t, pieces[o], o);
+        push(pieces[t], t, pieces[o], o);
 
-		pieces[t] = new Piece(pieces[o]);
-		pieces[o] = new Piece(null, null, EMPTY, 0);
+        pieces[t] = new Piece(pieces[o]);
+        pieces[o] = new Piece(null, null, EMPTY, 0);
 
-		return true;
-	}
+        return true;
+    }
 
-	/**
-	 * Moves a Piece on the Board at Point p
-	 */
-	public boolean move (Point p) {
-		int t;
-		int o;
+    /**
+     * Moves a Piece on the Board at Point p
+     */
+    public boolean move(Point p) {
+        int t;
+        int o;
 
-		t = (p.endy * 8) + p.endx;
-		o = (p.starty * 8) + p.startx;
+        t = (p.endy * 8) + p.endx;
+        o = (p.starty * 8) + p.startx;
 
-		if ( t < 0 || t > 63 )
-			return false;
-		if ( o < 0 || o > 63 )
-			return false;
+        if (t < 0 || t > 63)
+            return false;
+        if (o < 0 || o > 63)
+            return false;
 
-		if (validTurn(o))
-			return doMove (t, o);
+        if (validTurn(o))
+            return doMove(t, o);
 
-		System.out.println("It's not your turn!");
-		return false;
-	}
+        System.out.println("It's not your turn!");
+        return false;
+    }
 
-	/**
-	 * Moves one half-move backward.
-	 */
-	public void backwards() {
-		History h1;
-		History h2;
+    /**
+     * Moves one half-move backward.
+     */
+    public void backwards() {
+        History h1;
+        History h2;
 
-		if ( moveNr < 2)
-			return;
+        if (moveNr < 2)
+            return;
 
-		moveNr -= 2;
+        moveNr -= 2;
 
-		h1 = stack.elementAt(moveNr);
-		h2 = stack.elementAt(moveNr+1);
+        h1 = stack.elementAt(moveNr);
+        h2 = stack.elementAt(moveNr + 1);
 
-		board_pieces[h1.pos] = h1.piece;
-		board_pieces[h2.pos] = h2.piece;
+        board_pieces[h1.pos] = h1.piece;
+        board_pieces[h2.pos] = h2.piece;
 
-		repaint();
-	}
+        repaint();
+    }
 
-	/**
-	 * Moves one half-move forward.
-	 */
-	public void forward() {
-		History h1;
-		History h2;
+    /**
+     * Moves one half-move forward.
+     */
+    public void forward() {
+        History h1;
+        History h2;
 
-		if ( moveNr > stack.size()-2 )
-			return;
+        if (moveNr > stack.size() - 2)
+            return;
 
-		h1 = stack.elementAt(moveNr);
-		h2 = stack.elementAt(moveNr+1);
+        h1 = stack.elementAt(moveNr);
+        h2 = stack.elementAt(moveNr + 1);
 
-		board_pieces[h1.pos] = h2.piece;
-		board_pieces[h2.pos] = new Piece(null, null, EMPTY, 0);
+        board_pieces[h1.pos] = h2.piece;
+        board_pieces[h2.pos] = new Piece(null, null, EMPTY, 0);
 
-		moveNr += 2;
-		repaint();
-	}
+        moveNr += 2;
+        repaint();
+    }
 
-	/**
-	 * pushes 2 pieces onto the stack.
-	 */
-	public void push(Piece p1, int t, Piece p2, int o) {
-		stack.add(new History(p1, t, isBlacksTurn()));
-		stack.add(new History(p2, o, isBlacksTurn()));
-	}
+    /**
+     * pushes 2 pieces onto the stack.
+     */
+    public void push(Piece p1, int t, Piece p2, int o) {
+        stack.add(new History(p1, t, isBlacksTurn()));
+        stack.add(new History(p2, o, isBlacksTurn()));
+    }
 
-	/**
-	 * pop: undo the push operation.
-	 */
-	public void undo() {
-		History h1;
-		History h2;
-		int size = stack.size();
+    /**
+     * pop: undo the push operation.
+     */
+    public void undo() {
+        History h1;
+        History h2;
+        int size = stack.size();
 
-		if ( size < 2 )
-			return;
+        if (size < 2)
+            return;
 
-		h1 = stack.elementAt(size-1);
-		h2 = stack.elementAt(size-2);
+        h1 = stack.elementAt(size - 1);
+        h2 = stack.elementAt(size - 2);
 
-		pieces[h1.pos] = h1.piece;
-		pieces[h2.pos] = h2.piece;
+        pieces[h1.pos] = h1.piece;
+        pieces[h2.pos] = h2.piece;
 
-		stack.setSize(size-2);
+        stack.setSize(size - 2);
 
-		/* Reset the current player */
-		setBlacksTurn(h2.turn);
-	}
+        /* Reset the current player */
+        setBlacksTurn(h2.turn);
+    }
 
-	/**
-	 * This method must be implemented in your "GameBoard"
-	 * Return value:  TRUE: the move IS possible
-	 * Return value: FALSE: the move IS NOT possible
-	 */
-	public boolean validMove(int t, int o) {
-		System.out.println("public boolean validMove(int t, int o): Implement me");
-		return false;
-	}
+    /**
+     * This method must be implemented in your "GameBoard" Return value: TRUE:
+     * the move IS possible Return value: FALSE: the move IS NOT possible
+     */
+    public boolean validMove(int t, int o) {
+        System.out.println("public boolean validMove(int t, int o): Implement me");
+        return false;
+    }
 
-	/**
-	 * This method must be implemented in your "GameBoard"
-	 * Return value:  TRUE: the move was performed
-	 * Return value: FALSE: the move was not performed
-	 */
-	public boolean doMove(int t, int o) {
-		System.out.println("public boolean doMove(int t, int o): Implement me");
-		return false;
-	}
+    /**
+     * This method must be implemented in your "GameBoard" Return value: TRUE:
+     * the move was performed Return value: FALSE: the move was not performed
+     */
+    public boolean doMove(int t, int o) {
+        System.out.println("public boolean doMove(int t, int o): Implement me");
+        return false;
+    }
 
-	public void update(Graphics g){
-		paint(g);
-	}
+    public void update(Graphics g) {
+        paint(g);
+    }
 
-	public void paint (Graphics g) {
-		for (int i = 0; i < 8; i++) {
-			for (int j = 0; j < 8; j++) {
-				if (black == true) {
-					g.setColor (color_black);
-					g.fillRect (xPos, yPos, iWidth, iHeight);
-					black = false;
-				} else {
-					g.setColor (color_white);
-					g.fillRect (xPos, yPos, iWidth, iHeight);
-					black = true;
-				}
-				if ( !BoardisEmpty ((i * 8) + j) )
-					g.drawImage (getBoardImage ((i * 8) + j), xPos + 5, yPos, this);
-				xPos += iWidth;
-			}
-			xPos = 0;
-			yPos += iHeight;
-			black = !black;
-		}
-		xPos = 0;
-		yPos = 0;
-	}
+    public void paint(Graphics g) {
+        for (int i = 0; i < 8; i++) {
+            for (int j = 0; j < 8; j++) {
+                if (black == true) {
+                    g.setColor(color_black);
+                    g.fillRect(xPos, yPos, iWidth, iHeight);
+                    black = false;
+                } else {
+                    g.setColor(color_white);
+                    g.fillRect(xPos, yPos, iWidth, iHeight);
+                    black = true;
+                }
+                if (!BoardisEmpty((i * 8) + j))
+                    g.drawImage(getBoardImage((i * 8) + j), xPos + 5, yPos, this);
+                xPos += iWidth;
+            }
+            xPos = 0;
+            yPos += iHeight;
+            black = !black;
+        }
+        xPos = 0;
+        yPos = 0;
+    }
 }
--- a/org/homelinux/largo/games/board/History.java
+++ b/org/homelinux/largo/games/board/History.java
@@ -5,28 +5,26 @@
 
 package org.homelinux.largo.games.board;
 
-import org.homelinux.largo.games.board.Piece;
+public class History {
+    Piece piece;
+    int pos;
+    boolean turn;
 
-public class History {
-	Piece piece;
-	int pos;
-	boolean turn;
-
-	public History(Piece p, int n, boolean t) {
-		piece = new Piece(p);
-		pos = n;
-		turn = t;
-	}
+    public History(Piece p, int n, boolean t) {
+        piece = new Piece(p);
+        pos = n;
+        turn = t;
+    }
 
-	public Piece piece() {
-		return piece;
-	}
+    public Piece piece() {
+        return piece;
+    }
 
-	public int pos() {
-		return pos;
-	}
+    public int pos() {
+        return pos;
+    }
 
-	public boolean turn() {
-		return turn;
-	}
+    public boolean turn() {
+        return turn;
+    }
 }
--- a/org/homelinux/largo/games/board/MouseListener.java
+++ b/org/homelinux/largo/games/board/MouseListener.java
@@ -9,46 +9,44 @@
 import java.awt.event.MouseEvent;
 
 public class MouseListener extends MouseAdapter {
-	int width;
-	int height;
-	int delta;
+    int width;
+    int height;
+    int delta;
 
-	Point p;
-	boolean selected;
+    Point p;
+    boolean selected;
 
-	public MouseListener (int w, int h) {
-		width = w;
-		height = h;
-		p = new Point ();
-		selected = false;
-	}
+    public MouseListener(int w, int h) {
+        width = w;
+        height = h;
+        p = new Point();
+        selected = false;
+    }
 
-	public void mousePressed (MouseEvent e) {
-		p.startx = (e.getX () / width);
-		p.starty = (e.getY () / height);
-		selected = false;
-	}
+    public void mousePressed(MouseEvent e) {
+        p.startx = (e.getX() / width);
+        p.starty = (e.getY() / height);
+        selected = false;
+    }
 
-	public void mouseReleased (MouseEvent e) {
-		p.endx = (e.getX () / width);
-		p.endy = (e.getY () / height);
+    public void mouseReleased(MouseEvent e) {
+        p.endx = (e.getX() / width);
+        p.endy = (e.getY() / height);
 
-		print();
-		selected = true;
-	}
-
-	public boolean isSelected () {
-		return selected;
-	}
+        print();
+        selected = true;
+    }
 
-	public Point getSelection () {
-		selected = false;
-		return p;
-	}
+    public boolean isSelected() {
+        return selected;
+    }
 
-	public void print() {
-		System.out.printf ("%c%d-%c%d \t",
-				(char)('A' + p.startx), 8-p.starty,
-				(char)('A' + p.endx), 8-p.endy);
-	}
+    public Point getSelection() {
+        selected = false;
+        return p;
+    }
+
+    public void print() {
+        System.out.printf("%c%d-%c%d \t", (char) ('A' + p.startx), 8 - p.starty, (char) ('A' + p.endx), 8 - p.endy);
+    }
 }
--- a/org/homelinux/largo/games/board/Move.java
+++ b/org/homelinux/largo/games/board/Move.java
@@ -6,13 +6,13 @@
 package org.homelinux.largo.games.board;
 
 public class Move extends Object {
-	public int value;
-	public int target;
-	public int origin;
+    public int value;
+    public int target;
+    public int origin;
 
-	public Move(int v, int t, int o) {
-		value = v;
-		target = t;
-		origin = o;
-	}
+    public Move(int v, int t, int o) {
+        value = v;
+        target = t;
+        origin = o;
+    }
 }
--- a/org/homelinux/largo/games/board/Piece.java
+++ b/org/homelinux/largo/games/board/Piece.java
@@ -8,22 +8,22 @@
 import java.awt.Image;
 
 public class Piece extends Object {
-	Image image;
-	String color;
-	int type;
-	int value;
+    Image image;
+    String color;
+    int type;
+    int value;
 
-	public Piece(Piece s) {
-		image = s.image;
-		color = s.color;
-		type = s.type;
-		value = s.value;
-	}
+    public Piece(Piece s) {
+        image = s.image;
+        color = s.color;
+        type = s.type;
+        value = s.value;
+    }
 
-	public Piece(Image img, String c, int t, int v) {
-		image = img;
-		color = c;
-		type = t;
-		value = v;
-	}
+    public Piece(Image img, String c, int t, int v) {
+        image = img;
+        color = c;
+        type = t;
+        value = v;
+    }
 }
--- a/org/homelinux/largo/games/board/Point.java
+++ b/org/homelinux/largo/games/board/Point.java
@@ -6,8 +6,8 @@
 package org.homelinux.largo.games.board;
 
 public class Point {
-	int startx;
-	int starty;
-	int endx;
-	int endy;
+    int startx;
+    int starty;
+    int endx;
+    int endy;
 };
--- a/org/homelinux/largo/games/board/checkersboard/CheckersBoard.java
+++ b/org/homelinux/largo/games/board/checkersboard/CheckersBoard.java
@@ -13,285 +13,286 @@
 import org.homelinux.largo.utils.ImgComponent;
 
 public class CheckersBoard extends Board {
-	static final long serialVersionUID = 250408;
+    static final long serialVersionUID = 250408;
 
-	static final int PIECE = 1;
-	static final int QUEEN = 2;
+    static final int PIECE = 1;
+    static final int QUEEN = 2;
 
-	final Piece white_super_sun =
-		new Piece(new ImgComponent("images/white_super_sun.png").getImage(), "white", QUEEN, 50);
+    final Piece white_super_sun = new Piece(new ImgComponent("images/white_super_sun.png").getImage(), "white", QUEEN,
+            50);
 
-	final Piece black_super_sun =
-		new Piece(new ImgComponent("images/black_super_sun.png").getImage(), "black", QUEEN, 50);
+    final Piece black_super_sun = new Piece(new ImgComponent("images/black_super_sun.png").getImage(), "black", QUEEN,
+            50);
 
-	void initBoard () {
-		for (int i=1;i<8;i+=2)
-			add (new ImgComponent ("images/black_sun.png").getImage (), i, "black", PIECE);
-		for (int i=8;i<15;i+=2)
-			add (new ImgComponent ("images/black_sun.png").getImage (), i, "black", PIECE);
-		for (int i=17;i<=23;i+=2)
-			add (new ImgComponent ("images/black_sun.png").getImage (), i, "black", PIECE);
+    void initBoard() {
+        for (int i = 1; i < 8; i += 2)
+            add(new ImgComponent("images/black_sun.png").getImage(), i, "black", PIECE);
+        for (int i = 8; i < 15; i += 2)
+            add(new ImgComponent("images/black_sun.png").getImage(), i, "black", PIECE);
+        for (int i = 17; i <= 23; i += 2)
+            add(new ImgComponent("images/black_sun.png").getImage(), i, "black", PIECE);
 
-		for (int i=40;i<47;i+=2)
-			add (new ImgComponent ("images/white_sun.png").getImage (), i, "white", PIECE);
-		for (int i=49;i<=55;i+=2)
-			add (new ImgComponent ("images/white_sun.png").getImage (), i, "white", PIECE);
-		for (int i=56;i<63;i+=2)
-			add (new ImgComponent ("images/white_sun.png").getImage (), i, "white", PIECE);
-	}
+        for (int i = 40; i < 47; i += 2)
+            add(new ImgComponent("images/white_sun.png").getImage(), i, "white", PIECE);
+        for (int i = 49; i <= 55; i += 2)
+            add(new ImgComponent("images/white_sun.png").getImage(), i, "white", PIECE);
+        for (int i = 56; i < 63; i += 2)
+            add(new ImgComponent("images/white_sun.png").getImage(), i, "white", PIECE);
+    }
 
-	/**
-	 * The init method initializes a complete checkers board with figures and a history.
-	 */
-	public void init() {
-		super.init();
-		initBoard();
-		board_pieces = getPieces();
-		repaint();
-	}
+    /**
+     * The init method initializes a complete checkers board with figures and a
+     * history.
+     */
+    public void init() {
+        super.init();
+        initBoard();
+        board_pieces = getPieces();
+        repaint();
+    }
 
-	public CheckersBoard (int w, int h) {
-		super(w, h);
-	}
+    public CheckersBoard(int w, int h) {
+        super(w, h);
+    }
 
-	void add (Image img, int i, String c, int t) {
-		int v = 0;
+    void add(Image img, int i, String c, int t) {
+        int v = 0;
 
-		switch(t) {
-		case PIECE:
-			v=10;
-		}
+        switch (t) {
+        case PIECE:
+            v = 10;
+        }
 
-		setPiece(i, new Piece(img, c, t, v));
-	}
+        setPiece(i, new Piece(img, c, t, v));
+    }
 
-	/**
-	 * Checks, wether this move is possible or not.
-	 */
-	public boolean validMove (int t, int o) {
-		int steps;
-		int rows;
+    /**
+     * Checks, wether this move is possible or not.
+     */
+    public boolean validMove(int t, int o) {
+        int steps;
+        int rows;
 
-		if ( t == o )
-			return false;
+        if (t == o)
+            return false;
 
-		if (isSamePiece(t, o))
-			return false;
+        if (isSamePiece(t, o))
+            return false;
 
-		if (getType(o) == EMPTY)
-			return false;
+        if (getType(o) == EMPTY)
+            return false;
 
-		/*
-		 *	00 01 02 03 04 05 06 07
-		 *	08 09 10 11 12 13 14 15
-		 *	16 17 18 19 20 21 22 23
-		 *	24 25 26 27 28 29 30 31
-		 *	32 33 34 35 36 37 38 39
-		 *	40 41 42 43 44 45 46 47
-		 *	48 49 50 51 52 53 54 55
-		 *	56 57 58 59 60 61 62 63
-		 */
+        /*
+         * 00 01 02 03 04 05 06 07
+         * 08 09 10 11 12 13 14 15
+         * 16 17 18 19 20 21 22 23
+         * 24 25 26 27 28 29 30 31
+         * 32 33 34 35 36 37 38 39
+         * 40 41 42 43 44 45 46 47
+         * 48 49 50 51 52 53 54 55
+         * 56 57 58 59 60 61 62 63
+         */
 
-		steps = Math.abs(t-o);
-		rows = Math.abs(t/8 - o/8);
+        steps = Math.abs(t - o);
+        rows = Math.abs(t / 8 - o / 8);
 
-		switch( getType(o) ) {
-		case PIECE:
-			if (steps % 7 == 0 ) {
-				if (steps == 7 && rows == 1 && isEmpty(t)) {
-					if ( isBlack(o) && (t>o) )
-						return true;
-					if ( isWhite(o) && (t<o) )
-						return true;
-				}
+        switch (getType(o)) {
+        case PIECE:
+            if (steps % 7 == 0) {
+                if (steps == 7 && rows == 1 && isEmpty(t)) {
+                    if (isBlack(o) && (t > o))
+                        return true;
+                    if (isWhite(o) && (t < o))
+                        return true;
+                }
 
-				if (steps == 14 && rows == 2  && isEmpty(t)) {
-					if ( isBlack(o) && (t>o) && isEnemy(o+7, o) )
-						return true;
-					if ( isWhite(o) && (t<o) && isEnemy(o-7, o) )
-						return true;
-				}
-			}
+                if (steps == 14 && rows == 2 && isEmpty(t)) {
+                    if (isBlack(o) && (t > o) && isEnemy(o + 7, o))
+                        return true;
+                    if (isWhite(o) && (t < o) && isEnemy(o - 7, o))
+                        return true;
+                }
+            }
 
-			if (steps % 9 == 0 ) {
-				if (steps == 9 && rows == 1 && isEmpty(t)) {
-					if ( isBlack(o) && (t>o) )
-						return true;
-					if ( isWhite(o) && (t<o) )
-						return true;
-				}
+            if (steps % 9 == 0) {
+                if (steps == 9 && rows == 1 && isEmpty(t)) {
+                    if (isBlack(o) && (t > o))
+                        return true;
+                    if (isWhite(o) && (t < o))
+                        return true;
+                }
 
-				if (steps == 18 && rows == 2  && isEmpty(t)) {
-					if ( isBlack(o) && (t>o) && isEnemy(o+9, o) )
-						return true;
-					if ( isWhite(o) && (t<o) && isEnemy(o-9, o) )
-						return true;
-				}
-			}
-			break;
-		case QUEEN:
-			if (steps % 7 == 0 && isEmpty(t) ) {
-				if (steps == 7 && rows == 1)
-					return true;
-				if (steps == 14 && rows == 2)
-					return true;
-				if (steps == 21 && rows == 3)
-					return true;
-				if (steps == 28 && rows == 4)
-					return true;
-				if (steps == 35 && rows == 5)
-					return true;
-				if (steps == 42 && rows == 6)
-					return true;
-				if (steps == 49 && rows == 7)
-					return true;
-			}
+                if (steps == 18 && rows == 2 && isEmpty(t)) {
+                    if (isBlack(o) && (t > o) && isEnemy(o + 9, o))
+                        return true;
+                    if (isWhite(o) && (t < o) && isEnemy(o - 9, o))
+                        return true;
+                }
+            }
+            break;
+        case QUEEN:
+            if (steps % 7 == 0 && isEmpty(t)) {
+                if (steps == 7 && rows == 1)
+                    return true;
+                if (steps == 14 && rows == 2)
+                    return true;
+                if (steps == 21 && rows == 3)
+                    return true;
+                if (steps == 28 && rows == 4)
+                    return true;
+                if (steps == 35 && rows == 5)
+                    return true;
+                if (steps == 42 && rows == 6)
+                    return true;
+                if (steps == 49 && rows == 7)
+                    return true;
+            }
 
-			if (steps % 9 == 0 && isEmpty(t) ) {
-				if (steps == 9 && rows == 1)
-					return true;
-				if (steps == 18 && rows == 2)
-					return true;
-				if (steps == 27 && rows == 3)
-					return true;
-				if (steps == 36 && rows == 4)
-					return true;
-				if (steps == 45 && rows == 5)
-					return true;
-				if (steps == 54 && rows == 6)
-					return true;
-				if (steps == 63 && rows == 7)
-					return true;
-			}
-			break;
-		}
-		return false;
-	}
+            if (steps % 9 == 0 && isEmpty(t)) {
+                if (steps == 9 && rows == 1)
+                    return true;
+                if (steps == 18 && rows == 2)
+                    return true;
+                if (steps == 27 && rows == 3)
+                    return true;
+                if (steps == 36 && rows == 4)
+                    return true;
+                if (steps == 45 && rows == 5)
+                    return true;
+                if (steps == 54 && rows == 6)
+                    return true;
+                if (steps == 63 && rows == 7)
+                    return true;
+            }
+            break;
+        }
+        return false;
+    }
 
-	/**
-	 * pop: undo the push operation.
-	 */
-	public void undo() {
-		History h1 = null;
-		History h2 = null;
-		int size = stack.size();
-		int pos;
+    /**
+     * pop: undo the push operation.
+     */
+    public void undo() {
+        History h1 = null;
+        History h2 = null;
+        int size = stack.size();
+        int pos;
 
-		if ( size < 2 )
-			return;
+        if (size < 2)
+            return;
 
-		h1 = stack.elementAt(size-1);
-		h2 = stack.elementAt(size-2);
+        h1 = stack.elementAt(size - 1);
+        h2 = stack.elementAt(size - 2);
 
-		setPiece(h1.pos(), h1.piece());
-		setPiece(h2.pos(), h2.piece());
+        setPiece(h1.pos(), h1.piece());
+        setPiece(h2.pos(), h2.piece());
 
-		if ( getType(h2.pos()) != EMPTY ) {
-			pos = 2*h2.pos()-h1.pos();
-			if ( pos >= 0 && pos <64)
-				setPiece(pos, new Piece(null, null, EMPTY, 0));
-		}
+        if (getType(h2.pos()) != EMPTY) {
+            pos = 2 * h2.pos() - h1.pos();
+            if (pos >= 0 && pos < 64)
+                setPiece(pos, new Piece(null, null, EMPTY, 0));
+        }
 
-		stack.setSize(size-2);
+        stack.setSize(size - 2);
 
-		/* Reset the current player */
-		setBlacksTurn(h2.turn());
-	}
+        /* Reset the current player */
+        setBlacksTurn(h2.turn());
+    }
 
-	/**
-	 * simulates a "valid" move or returns false.
-	 * all changes are relative to pieces and will not be painted.
-	 */
-	public boolean simulateMove(int t, int o) {
-		int rows = Math.abs(t/8 - o/8);
-		int pos;
+    /**
+     * simulates a "valid" move or returns false. all changes are relative to
+     * pieces and will not be painted.
+     */
+    public boolean simulateMove(int t, int o) {
+        int rows = Math.abs(t / 8 - o / 8);
+        int pos;
 
-		if ( !validMove(t, o) ) {
-			return false;
-		}
+        if (!validMove(t, o)) {
+            return false;
+        }
 
-		if ( rows == 2 && getType(o) == PIECE) {
-			pos =  (t-o)/2 + o;
-			push(getPiece(pos), pos, getPiece(o), o);
-			setPiece(pos, new Piece(null, null, EMPTY, 0));
-		} else
-			push(getPiece(t), t, getPiece(o), o);
+        if (rows == 2 && getType(o) == PIECE) {
+            pos = (t - o) / 2 + o;
+            push(getPiece(pos), pos, getPiece(o), o);
+            setPiece(pos, new Piece(null, null, EMPTY, 0));
+        } else
+            push(getPiece(t), t, getPiece(o), o);
 
-		setPiece(t, new Piece(getPiece(o)));
-		setPiece(o, new Piece(null, null, EMPTY, 0));
+        setPiece(t, new Piece(getPiece(o)));
+        setPiece(o, new Piece(null, null, EMPTY, 0));
 
-		return true;
-	}
+        return true;
+    }
 
-	/**
-	 * performs a "valid" move or returns false.
-	 * all changes are relative to board_pieces and will be painted.
-	 */
-	public boolean doMove(int t, int o) {
-		int steps = Math.abs(t-o);
-		int rows = Math.abs(t/8-o/8);
-		int pos;
+    /**
+     * performs a "valid" move or returns false. all changes are relative to
+     * board_pieces and will be painted.
+     */
+    public boolean doMove(int t, int o) {
+        int steps = Math.abs(t - o);
+        int rows = Math.abs(t / 8 - o / 8);
+        int pos;
 
-		if ( !validMove(t, o) ) {
-			return false;
-		}
+        if (!validMove(t, o)) {
+            return false;
+        }
 
-		if ( rows == 2 && getType(o) == PIECE) {
-			pos =  (t-o)/2 + o;
-			push(getPiece(pos), pos, getPiece(o), o);
-			setPiece(pos, new Piece(null, null, EMPTY, 0));
-		} else	if ( rows >= 2 && getType(o) == QUEEN ) {
-			if (steps % 7 == 0 ) {
-				if ( t > o )
-					for ( pos=o+7;pos <= t-7;pos+=7 ) {
-						if ( isEnemy(pos, o) ) {
-							push(getPiece(pos), pos, getPiece(o), o);
-							setPiece(pos, new Piece(null, null, EMPTY, 0));
-						}
-					}
-				else {
-					for ( pos=o-7;pos >= t+7;pos-=7 ) {
-						if ( isEnemy(pos, o) ) {
-							push(getPiece(pos), pos, getPiece(o), o);
-							setPiece(pos, new Piece(null, null, EMPTY, 0));
-						}
-					}
-				}
-			}
+        if (rows == 2 && getType(o) == PIECE) {
+            pos = (t - o) / 2 + o;
+            push(getPiece(pos), pos, getPiece(o), o);
+            setPiece(pos, new Piece(null, null, EMPTY, 0));
+        } else if (rows >= 2 && getType(o) == QUEEN) {
+            if (steps % 7 == 0) {
+                if (t > o)
+                    for (pos = o + 7; pos <= t - 7; pos += 7) {
+                        if (isEnemy(pos, o)) {
+                            push(getPiece(pos), pos, getPiece(o), o);
+                            setPiece(pos, new Piece(null, null, EMPTY, 0));
+                        }
+                    }
+                else {
+                    for (pos = o - 7; pos >= t + 7; pos -= 7) {
+                        if (isEnemy(pos, o)) {
+                            push(getPiece(pos), pos, getPiece(o), o);
+                            setPiece(pos, new Piece(null, null, EMPTY, 0));
+                        }
+                    }
+                }
+            }
 
-			if (steps % 9 == 0 ) {
-				if ( t > o )
-					for ( pos=o+9;pos <= t-9;pos+=9 ) {
-						if ( isEnemy(pos, o) ) {
-							push(getPiece(pos), pos, getPiece(o), o);
-							setPiece(pos, new Piece(null, null, EMPTY, 0));
-						}
-					}
-				else {
-					for ( pos=o-9;pos >= t+9;pos-=9 ) {
-						if ( isEnemy(pos, o) ) {
-							push(getPiece(pos), pos, getPiece(o), o);
-							setPiece(pos, new Piece(null, null, EMPTY, 0));
-						}
-					}
-				}
-			}
-		}
+            if (steps % 9 == 0) {
+                if (t > o)
+                    for (pos = o + 9; pos <= t - 9; pos += 9) {
+                        if (isEnemy(pos, o)) {
+                            push(getPiece(pos), pos, getPiece(o), o);
+                            setPiece(pos, new Piece(null, null, EMPTY, 0));
+                        }
+                    }
+                else {
+                    for (pos = o - 9; pos >= t + 9; pos -= 9) {
+                        if (isEnemy(pos, o)) {
+                            push(getPiece(pos), pos, getPiece(o), o);
+                            setPiece(pos, new Piece(null, null, EMPTY, 0));
+                        }
+                    }
+                }
+            }
+        }
 
-		if ( t <= 7 && getType(o) == PIECE)
-			setPiece(t, new Piece(white_super_sun));
-		else if (t >=56 && getType(o) == PIECE)
-			setPiece(t, new Piece(black_super_sun));
-		else
-			setPiece(t, new Piece(getPiece(o)));
+        if (t <= 7 && getType(o) == PIECE)
+            setPiece(t, new Piece(white_super_sun));
+        else if (t >= 56 && getType(o) == PIECE)
+            setPiece(t, new Piece(black_super_sun));
+        else
+            setPiece(t, new Piece(getPiece(o)));
 
-		setPiece(o, new Piece(null, null, EMPTY, 0));
+        setPiece(o, new Piece(null, null, EMPTY, 0));
 
-		board_pieces = getPieces();
-		repaint();
+        board_pieces = getPieces();
+        repaint();
 
-		moveNr = stack.size();
+        moveNr = stack.size();
 
-		return true;
-	}
+        return true;
+    }
 }
--- a/org/homelinux/largo/games/board/chessboard/ChessBoard.java
+++ b/org/homelinux/largo/games/board/chessboard/ChessBoard.java
@@ -12,648 +12,646 @@
 import org.homelinux.largo.utils.ImgComponent;
 
 public class ChessBoard extends Board {
-	static final long serialVersionUID = 140208;
+    static final long serialVersionUID = 140208;
 
-	static final int ROOK = 1;
-	static final int KNIGHT = 2;
-	static final int BISHOP = 3;
-	static final int QUEEN = 4;
-	static final int KING = 5;
-	static final int PAWN = 6;
+    static final int ROOK = 1;
+    static final int KNIGHT = 2;
+    static final int BISHOP = 3;
+    static final int QUEEN = 4;
+    static final int KING = 5;
+    static final int PAWN = 6;
 
-	final Piece white_queen = new Piece(new ImgComponent("images/white_queen.png").getImage(),
-					"white", QUEEN, 90);
-	final Piece black_queen = new Piece(new ImgComponent("images/black_queen.png").getImage(),
-					"black", QUEEN, 90);
+    final Piece white_queen = new Piece(new ImgComponent("images/white_queen.png").getImage(), "white", QUEEN, 90);
+    final Piece black_queen = new Piece(new ImgComponent("images/black_queen.png").getImage(), "black", QUEEN, 90);
 
-	boolean white_rochades_small;
-	boolean white_rochades_big;
-	boolean black_rochades_small;
-	boolean black_rochades_big;
+    boolean white_rochades_small;
+    boolean white_rochades_big;
+    boolean black_rochades_small;
+    boolean black_rochades_big;
 
-	void initBoard () {
-		add (new ImgComponent ("images/black_rook.png").getImage (), 0, "black", ROOK);
-		add (new ImgComponent ("images/black_knight.png").getImage (), 1, "black", KNIGHT);
-		add (new ImgComponent ("images/black_bishop.png").getImage (), 2, "black", BISHOP);
-		add (new ImgComponent ("images/black_queen.png").getImage (), 3, "black", QUEEN);
-		add (new ImgComponent ("images/black_king.png").getImage (), 4, "black", KING);
-		add (new ImgComponent ("images/black_bishop.png").getImage (), 5, "black", BISHOP);
-		add (new ImgComponent ("images/black_knight.png").getImage (), 6, "black", KNIGHT);
-		add (new ImgComponent ("images/black_rook.png").getImage (), 7, "black", ROOK);
+    void initBoard() {
+        add(new ImgComponent("images/black_rook.png").getImage(), 0, "black", ROOK);
+        add(new ImgComponent("images/black_knight.png").getImage(), 1, "black", KNIGHT);
+        add(new ImgComponent("images/black_bishop.png").getImage(), 2, "black", BISHOP);
+        add(new ImgComponent("images/black_queen.png").getImage(), 3, "black", QUEEN);
+        add(new ImgComponent("images/black_king.png").getImage(), 4, "black", KING);
+        add(new ImgComponent("images/black_bishop.png").getImage(), 5, "black", BISHOP);
+        add(new ImgComponent("images/black_knight.png").getImage(), 6, "black", KNIGHT);
+        add(new ImgComponent("images/black_rook.png").getImage(), 7, "black", ROOK);
+
+        for (int i = 0; i < 8; i++)
+            add(new ImgComponent("images/black_pawn.png").getImage(), 8 + i, "black", PAWN);
 
-		for (int i = 0; i < 8; i++)
-			add (new ImgComponent ("images/black_pawn.png").getImage (), 8 + i, "black", PAWN);
+        add(new ImgComponent("images/white_rook.png").getImage(), 56, "white", ROOK);
+        add(new ImgComponent("images/white_knight.png").getImage(), 57, "white", KNIGHT);
+        add(new ImgComponent("images/white_bishop.png").getImage(), 58, "white", BISHOP);
+        add(new ImgComponent("images/white_queen.png").getImage(), 59, "white", QUEEN);
+        add(new ImgComponent("images/white_king.png").getImage(), 60, "white", KING);
+        add(new ImgComponent("images/white_bishop.png").getImage(), 61, "white", BISHOP);
+        add(new ImgComponent("images/white_knight.png").getImage(), 62, "white", KNIGHT);
+        add(new ImgComponent("images/white_rook.png").getImage(), 63, "white", ROOK);
 
-		add (new ImgComponent ("images/white_rook.png").getImage (), 56, "white", ROOK);
-		add (new ImgComponent ("images/white_knight.png").getImage (), 57, "white", KNIGHT);
-		add (new ImgComponent ("images/white_bishop.png").getImage (), 58, "white", BISHOP);
-		add (new ImgComponent ("images/white_queen.png").getImage (), 59, "white", QUEEN);
-		add (new ImgComponent ("images/white_king.png").getImage (), 60, "white", KING);
-		add (new ImgComponent ("images/white_bishop.png").getImage (), 61, "white", BISHOP);
-		add (new ImgComponent ("images/white_knight.png").getImage (), 62, "white", KNIGHT);
-		add (new ImgComponent ("images/white_rook.png").getImage (), 63, "white", ROOK);
-
-		for (int i = 0; i < 8; i++)
-			add (new ImgComponent ("images/white_pawn.png").getImage (), 55 - i, "white", PAWN);
-	}
+        for (int i = 0; i < 8; i++)
+            add(new ImgComponent("images/white_pawn.png").getImage(), 55 - i, "white", PAWN);
+    }
 
-	/**
-	 * The init method initializes a complete chess board with figures and a history.
-	 */
-	public void init() {
-		super.init();
-		initBoard();
-		board_pieces = getPieces();
-		repaint();
-	}
+    /**
+     * The init method initializes a complete chess board with figures and a
+     * history.
+     */
+    public void init() {
+        super.init();
+        initBoard();
+        board_pieces = getPieces();
+        repaint();
+    }
 
-	public ChessBoard (int w, int h) {
-		super(w, h);
-	}
+    public ChessBoard(int w, int h) {
+        super(w, h);
+    }
 
-	void add (Image img, int i, String c, int t) {
-		int v = 0;
+    void add(Image img, int i, String c, int t) {
+        int v = 0;
 
-		switch (t) {
-		case ROOK:
-			v = 80;
-			break;
-		case KNIGHT:
-			v = 30;
-			break;
-		case BISHOP:
-			v = 30;
-			break;
-		case QUEEN:
-			v = 90;
-			break;
-		case KING:
-			v = 120;
-			break;
-		case PAWN:
-			v = 10;
-			break;
-		}
+        switch (t) {
+        case ROOK:
+            v = 80;
+            break;
+        case KNIGHT:
+            v = 30;
+            break;
+        case BISHOP:
+            v = 30;
+            break;
+        case QUEEN:
+            v = 90;
+            break;
+        case KING:
+            v = 120;
+            break;
+        case PAWN:
+            v = 10;
+            break;
+        }
 
-		setPiece(i, new Piece(img, c, t, v));
-	}
+        setPiece(i, new Piece(img, c, t, v));
+    }
 
-	/**
-	 * returns true, when the white king is at pieces[i]
-	 */
-	public boolean isWhiteKing(int i) {
-		if ( isWhite(i) && getType(i) == KING)
-			return true;
-		return false;
-	}
+    /**
+     * returns true, when the white king is at pieces[i]
+     */
+    public boolean isWhiteKing(int i) {
+        if (isWhite(i) && getType(i) == KING)
+            return true;
+        return false;
+    }
 
-	/**
-	 * returns true, when the black king is at pieces[i]
-	 */
-	public boolean isBlackKing(int i) {
-		if ( isBlack(i) && getType(i) == KING)
-			return true;
-		return false;
-	}
+    /**
+     * returns true, when the black king is at pieces[i]
+     */
+    public boolean isBlackKing(int i) {
+        if (isBlack(i) && getType(i) == KING)
+            return true;
+        return false;
+    }
 
-	/**
-	 * Returns the score of the current position
-	 * Every field controlled by [color] gives one point
-	 * A King, controlled by [color], gives 10 extra points
-	 */
-	public int controls(String color) {
-		int t, o;
-		int value = 0;
+    /**
+     * Returns the score of the current position Every field controlled by
+     * [color] gives one point A King, controlled by [color], gives 10 extra
+     * points
+     */
+    public int controls(String color) {
+        int t, o;
+        int value = 0;
 
-		for ( o=0;o<64;o++) {
-			if (color.equals(getColor(o))) {
-				for (t=0;t<64;t++) {
-					if(validMove(t, o)) {
-						if ( getType(t) == KING )
-							value+=10;
-						value++;
-					}
-				}
-			}
-		}
-		return value;
-	}
+        for (o = 0; o < 64; o++) {
+            if (color.equals(getColor(o))) {
+                for (t = 0; t < 64; t++) {
+                    if (validMove(t, o)) {
+                        if (getType(t) == KING)
+                            value += 10;
+                        value++;
+                    }
+                }
+            }
+        }
+        return value;
+    }
 
-	/**
-	 * Checks, wether this move is possible or not.
-	 */
-	public boolean validMove (int t, int o) {
-		int steps;
-		int rows;
-		int dx;
+    /**
+     * Checks, wether this move is possible or not.
+     */
+    public boolean validMove(int t, int o) {
+        int steps;
+        int rows;
+        int dx;
 
-		/* Must be here */
-		white_rochades_small = false;
-		white_rochades_big = false;
-		black_rochades_small = false;
-		black_rochades_big = false;
+        /* Must be here */
+        white_rochades_small = false;
+        white_rochades_big = false;
+        black_rochades_small = false;
+        black_rochades_big = false;
 
-		if ( t == o )
-			return false;
+        if (t == o)
+            return false;
 
-		if (isSamePiece(t, o))
-			return false;
+        if (isSamePiece(t, o))
+            return false;
 
-		if (getType(o) == EMPTY)
-			return false;
+        if (getType(o) == EMPTY)
+            return false;
 
-		/*
-		 *	00 01 02 03 04 05 06 07
-		 *	08 09 10 11 12 13 14 15
-		 *	16 17 18 19 20 21 22 23
-		 *	24 25 26 27 28 29 30 31
-		 *	32 33 34 35 36 37 38 39
-		 *	40 41 42 43 44 45 46 47
-		 *	48 49 50 51 52 53 54 55
-		 *	56 57 58 59 60 61 62 63
-		 */
+        /*
+         * 00 01 02 03 04 05 06 07
+         * 08 09 10 11 12 13 14 15
+         * 16 17 18 19 20 21 22 23
+         * 24 25 26 27 28 29 30 31
+         * 32 33 34 35 36 37 38 39
+         * 40 41 42 43 44 45 46 47
+         * 48 49 50 51 52 53 54 55
+         * 56 57 58 59 60 61 62 63
+         */
 
-		steps = Math.abs(t-o);
-		rows = Math.abs(t/8 - o/8);
+        steps = Math.abs(t - o);
+        rows = Math.abs(t / 8 - o / 8);
 
-		switch( getType(o) ) {
-		case ROOK:
-			if (steps < 8 && rows == 0 ) {
-				if(t>o)
-					for ( dx = o+1; dx < t; dx++ ) {
-						if ( getColor(dx) != null ) {
-							return false;
-						}
-					}
-				else
-					for ( dx = o-1; dx > t; dx-- ) {
-						if ( getColor(dx) != null ) {
-							return false;
-						}
-					}
-				return true;
-			}
-			if (steps % 8 == 0 ) {
-				if ( t>o ) {
-					for ( dx = o+8;  dx < t; dx+=8 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				} else {
-					for ( dx = o-8;  dx > t; dx-=8 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				}
-				if (steps == 8 && rows == 1)
-					return true;
-				if (steps == 16 && rows == 2)
-					return true;
-				if (steps == 24 && rows == 3)
-					return true;
-				if (steps == 32 && rows == 4)
-					return true;
-				if (steps == 40 && rows == 5)
-					return true;
-				if (steps == 48 && rows == 6)
-					return true;
-				if (steps == 56 && rows == 7)
-					return true;
-			}
-			break;
-		case KNIGHT:
-			/* works fine */
-			if (steps == 6 && rows == 1)
-				return true;
-			if (steps == 10 && rows == 1)
-				return true;
-			if (steps == 15 && rows == 2)
-				return true;
-			if (steps == 17 && rows == 2)
-				return true;
-			break;
-		case BISHOP:
-			if (steps % 7 == 0 ) {
-				if ( t>o ) {
-					for ( dx = o+7;  dx < t; dx+=7 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				} else {
-					for ( dx = o-7;  dx > t; dx-=7 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				}
-				if (steps == 7 && rows == 1)
-					return true;
-				if (steps == 14 && rows == 2)
-					return true;
-				if (steps == 21 && rows == 3)
-					return true;
-				if (steps == 28 && rows == 4)
-					return true;
-				if (steps == 35 && rows == 5)
-					return true;
-				if (steps == 42 && rows == 6)
-					return true;
-				if (steps == 49 && rows == 7)
-					return true;
-			}
-			if (steps % 9 == 0 ) {
-				if ( t>o ) {
-					for ( dx = o+9;  dx < t; dx+=9 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				} else {
-					for ( dx = o-9; dx > t; dx-=9 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				}
-				if (steps == 9 && rows == 1)
-					return true;
-				if (steps == 18 && rows == 2)
-					return true;
-				if (steps == 27 && rows == 3)
-					return true;
-				if (steps == 36 && rows == 4)
-					return true;
-				if (steps == 45 && rows == 5)
-					return true;
-				if (steps == 54 && rows == 6)
-					return true;
-				if (steps == 63 && rows == 7)
-					return true;
-			}
-			break;
+        switch (getType(o)) {
+        case ROOK:
+            if (steps < 8 && rows == 0) {
+                if (t > o)
+                    for (dx = o + 1; dx < t; dx++) {
+                        if (getColor(dx) != null) {
+                            return false;
+                        }
+                    }
+                else
+                    for (dx = o - 1; dx > t; dx--) {
+                        if (getColor(dx) != null) {
+                            return false;
+                        }
+                    }
+                return true;
+            }
+            if (steps % 8 == 0) {
+                if (t > o) {
+                    for (dx = o + 8; dx < t; dx += 8) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                } else {
+                    for (dx = o - 8; dx > t; dx -= 8) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                }
+                if (steps == 8 && rows == 1)
+                    return true;
+                if (steps == 16 && rows == 2)
+                    return true;
+                if (steps == 24 && rows == 3)
+                    return true;
+                if (steps == 32 && rows == 4)
+                    return true;
+                if (steps == 40 && rows == 5)
+                    return true;
+                if (steps == 48 && rows == 6)
+                    return true;
+                if (steps == 56 && rows == 7)
+                    return true;
+            }
+            break;
+        case KNIGHT:
+            /* works fine */
+            if (steps == 6 && rows == 1)
+                return true;
+            if (steps == 10 && rows == 1)
+                return true;
+            if (steps == 15 && rows == 2)
+                return true;
+            if (steps == 17 && rows == 2)
+                return true;
+            break;
+        case BISHOP:
+            if (steps % 7 == 0) {
+                if (t > o) {
+                    for (dx = o + 7; dx < t; dx += 7) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                } else {
+                    for (dx = o - 7; dx > t; dx -= 7) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                }
+                if (steps == 7 && rows == 1)
+                    return true;
+                if (steps == 14 && rows == 2)
+                    return true;
+                if (steps == 21 && rows == 3)
+                    return true;
+                if (steps == 28 && rows == 4)
+                    return true;
+                if (steps == 35 && rows == 5)
+                    return true;
+                if (steps == 42 && rows == 6)
+                    return true;
+                if (steps == 49 && rows == 7)
+                    return true;
+            }
+            if (steps % 9 == 0) {
+                if (t > o) {
+                    for (dx = o + 9; dx < t; dx += 9) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                } else {
+                    for (dx = o - 9; dx > t; dx -= 9) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                }
+                if (steps == 9 && rows == 1)
+                    return true;
+                if (steps == 18 && rows == 2)
+                    return true;
+                if (steps == 27 && rows == 3)
+                    return true;
+                if (steps == 36 && rows == 4)
+                    return true;
+                if (steps == 45 && rows == 5)
+                    return true;
+                if (steps == 54 && rows == 6)
+                    return true;
+                if (steps == 63 && rows == 7)
+                    return true;
+            }
+            break;
 
-		case QUEEN:
-			if (steps < 8 && rows == 0 ) {
-				if(t>o)
-					for ( dx = o+1; dx < t; dx++ ) {
-						if ( getColor(dx) != null )
-							return false;
-					}
-				else
-					for ( dx = o-1; dx > t; dx-- ) {
-						if ( getColor(dx) != null )
-							return false;
-					}
-				return true;
-			}
+        case QUEEN:
+            if (steps < 8 && rows == 0) {
+                if (t > o)
+                    for (dx = o + 1; dx < t; dx++) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                else
+                    for (dx = o - 1; dx > t; dx--) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                return true;
+            }
 
-			if (steps % 8 == 0 ) {
-				if ( t>o ) {
-					for ( dx = o+8;  dx < t; dx+=8 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				} else {
-					for ( dx = o-8;  dx > t; dx-=8 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				}
+            if (steps % 8 == 0) {
+                if (t > o) {
+                    for (dx = o + 8; dx < t; dx += 8) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                } else {
+                    for (dx = o - 8; dx > t; dx -= 8) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                }
 
-				if (steps == 8 && rows == 1)
-					return true;
-				if (steps == 16 && rows == 2)
-					return true;
-				if (steps == 24 && rows == 3)
-					return true;
-				if (steps == 32 && rows == 4)
-					return true;
-				if (steps == 40 && rows == 5)
-					return true;
-				if (steps == 48 && rows == 6)
-					return true;
-				if (steps == 56 && rows == 7)
-					return true;
-			}
-			if (steps % 7 == 0 ) {
-				if ( t>o ) {
-					for ( dx = o+7;  dx < t; dx+=7 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				} else {
-					for ( dx = o-7;  dx > t; dx-=7 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				}
-				if (steps == 7 && rows == 1)
-					return true;
-				if (steps == 14 && rows == 2)
-					return true;
-				if (steps == 21 && rows == 3)
-					return true;
-				if (steps == 28 && rows == 4)
-					return true;
-				if (steps == 35 && rows == 5)
-					return true;
-				if (steps == 42 && rows == 6)
-					return true;
-				if (steps == 49 && rows == 7)
-					return true;
-			}
+                if (steps == 8 && rows == 1)
+                    return true;
+                if (steps == 16 && rows == 2)
+                    return true;
+                if (steps == 24 && rows == 3)
+                    return true;
+                if (steps == 32 && rows == 4)
+                    return true;
+                if (steps == 40 && rows == 5)
+                    return true;
+                if (steps == 48 && rows == 6)
+                    return true;
+                if (steps == 56 && rows == 7)
+                    return true;
+            }
+            if (steps % 7 == 0) {
+                if (t > o) {
+                    for (dx = o + 7; dx < t; dx += 7) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                } else {
+                    for (dx = o - 7; dx > t; dx -= 7) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                }
+                if (steps == 7 && rows == 1)
+                    return true;
+                if (steps == 14 && rows == 2)
+                    return true;
+                if (steps == 21 && rows == 3)
+                    return true;
+                if (steps == 28 && rows == 4)
+                    return true;
+                if (steps == 35 && rows == 5)
+                    return true;
+                if (steps == 42 && rows == 6)
+                    return true;
+                if (steps == 49 && rows == 7)
+                    return true;
+            }
 
-			if (steps % 9 == 0 ) {
-				if ( t>o ) {
-					for ( dx = o+9;  dx < t; dx+=9 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				} else {
-					for ( dx = o-9;  dx > t; dx -=9 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				}
-				if (steps == 9 && rows == 1)
-					return true;
-				if (steps == 18 && rows == 2)
-					return true;
-				if (steps == 27 && rows == 3)
-					return true;
-				if (steps == 36 && rows == 4)
-					return true;
-				if (steps == 45 && rows == 5)
-					return true;
-				if (steps == 54 && rows == 6)
-					return true;
-				if (steps == 63 && rows == 7)
-					return true;
-			}
-			break;
+            if (steps % 9 == 0) {
+                if (t > o) {
+                    for (dx = o + 9; dx < t; dx += 9) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                } else {
+                    for (dx = o - 9; dx > t; dx -= 9) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                }
+                if (steps == 9 && rows == 1)
+                    return true;
+                if (steps == 18 && rows == 2)
+                    return true;
+                if (steps == 27 && rows == 3)
+                    return true;
+                if (steps == 36 && rows == 4)
+                    return true;
+                if (steps == 45 && rows == 5)
+                    return true;
+                if (steps == 54 && rows == 6)
+                    return true;
+                if (steps == 63 && rows == 7)
+                    return true;
+            }
+            break;
 
-		case KING:
-			if ( (steps == 1) && (rows == 0) )
-				return true;
+        case KING:
+            if ((steps == 1) && (rows == 0))
+                return true;
 
-			if ( (steps == 8) && (rows == 1) )
-				return true;
+            if ((steps == 8) && (rows == 1))
+                return true;
 
-			if ( (steps == 7) && (rows == 1) )
-				return true;
+            if ((steps == 7) && (rows == 1))
+                return true;
 
-			if ( (steps == 9) && (rows == 1) )
-				return true;
+            if ((steps == 9) && (rows == 1))
+                return true;
 
-			if ( (steps == 2) && (rows == 0) ) {
-				if ( isWhiteKing(o) ) {		/* White: Rochade */
-					if ( isWhiteKing(60) && isEmpty(61) && isEmpty(62) && (t==62) ) {
-						if ( (getType(63) == ROOK) && isWhite(63) ) {
-							white_rochades_small = true;
-							return true;
-						}
-					}
+            if ((steps == 2) && (rows == 0)) {
+                if (isWhiteKing(o)) { /* White: Rochade */
+                    if (isWhiteKing(60) && isEmpty(61) && isEmpty(62) && (t == 62)) {
+                        if ((getType(63) == ROOK) && isWhite(63)) {
+                            white_rochades_small = true;
+                            return true;
+                        }
+                    }
 
-					if ( isWhiteKing(60) && isEmpty(59) && isEmpty(58) && isEmpty(57) && (t==58) ) {
-						if ( (getType(56) == ROOK) && isWhite(56) ) {
-							white_rochades_big = true;
-							return true;
-						}
-					}
-				}
+                    if (isWhiteKing(60) && isEmpty(59) && isEmpty(58) && isEmpty(57) && (t == 58)) {
+                        if ((getType(56) == ROOK) && isWhite(56)) {
+                            white_rochades_big = true;
+                            return true;
+                        }
+                    }
+                }
 
-				if ( isBlackKing(o) ) {		/* Black: Rochade */
-					if ( isBlackKing(4) && isEmpty(5) && isEmpty(6) && (t==6) ) {
-						if ( (getType(7) == ROOK) && isBlack(7) ) {
-							black_rochades_small = true;
-							return true;
-						}
-					}
+                if (isBlackKing(o)) { /* Black: Rochade */
+                    if (isBlackKing(4) && isEmpty(5) && isEmpty(6) && (t == 6)) {
+                        if ((getType(7) == ROOK) && isBlack(7)) {
+                            black_rochades_small = true;
+                            return true;
+                        }
+                    }
 
-					if ( isBlackKing(4) && isEmpty(3) && isEmpty(2) && isEmpty(1) && (t==2) ) {
-						if ( (getType(0) == ROOK) && isBlack(0) ) {
-							black_rochades_big = true;
-							return true;
-						}
-					}
-				}
-			}
-			break;
+                    if (isBlackKing(4) && isEmpty(3) && isEmpty(2) && isEmpty(1) && (t == 2)) {
+                        if ((getType(0) == ROOK) && isBlack(0)) {
+                            black_rochades_big = true;
+                            return true;
+                        }
+                    }
+                }
+            }
+            break;
 
-		case PAWN:
-			if (getColor(o).equals("white")) {
-				if (steps == 7 && rows == 1 && isEnemy(t, o) && t<o)
-					return true;
+        case PAWN:
+            if (getColor(o).equals("white")) {
+                if (steps == 7 && rows == 1 && isEnemy(t, o) && t < o)
+                    return true;
 
-				if (steps == 9 && rows == 1 && isEnemy(t, o) && t<o)
-					return true;
-			} else {
-				if (steps == 7 && rows == 1 && isEnemy(t, o) && t>o)
-					return true;
+                if (steps == 9 && rows == 1 && isEnemy(t, o) && t < o)
+                    return true;
+            } else {
+                if (steps == 7 && rows == 1 && isEnemy(t, o) && t > o)
+                    return true;
 
-				if (steps == 9 && rows == 1 && isEnemy(t, o) && t>o)
-					return true;
-			}
+                if (steps == 9 && rows == 1 && isEnemy(t, o) && t > o)
+                    return true;
+            }
 
-			if (steps % 8 == 0 ) {
-				if ( t>o ) {
-					for ( dx = o+8;  dx <= t; dx+=8 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				} else {
-					for ( dx = o-8; dx >= t; dx-=8 ) {
-						if (getColor(dx) != null)
-							return false;
-					}
-				}
+            if (steps % 8 == 0) {
+                if (t > o) {
+                    for (dx = o + 8; dx <= t; dx += 8) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                } else {
+                    for (dx = o - 8; dx >= t; dx -= 8) {
+                        if (getColor(dx) != null)
+                            return false;
+                    }
+                }
 
-				if (steps == 8 && rows == 1) {
-					if ( getColor(o).equals("white") && t < o )
-						return true;
-					if ( getColor(o).equals("black") && t > o )
-						return true;
-				}
+                if (steps == 8 && rows == 1) {
+                    if (getColor(o).equals("white") && t < o)
+                        return true;
+                    if (getColor(o).equals("black") && t > o)
+                        return true;
+                }
 
-				if (steps == 16 && rows == 2 && (o>= 8 && o <=15) ) {
-					if ( getColor(o).equals("white") && t < o )
-						return true;
-					if ( getColor(o).equals("black") && t > o )
-						return true;
-				}
+                if (steps == 16 && rows == 2 && (o >= 8 && o <= 15)) {
+                    if (getColor(o).equals("white") && t < o)
+                        return true;
+                    if (getColor(o).equals("black") && t > o)
+                        return true;
+                }
 
-				if (steps == 16 && rows == 2 && (o>=48 && o <=55) ) {
-					if ( getColor(o).equals("white") && t < o )
-						return true;
-					if ( getColor(o).equals("black") && t > o )
-						return true;
-				}
-			}
-			break;
-		}
-		return false;
-	}
+                if (steps == 16 && rows == 2 && (o >= 48 && o <= 55)) {
+                    if (getColor(o).equals("white") && t < o)
+                        return true;
+                    if (getColor(o).equals("black") && t > o)
+                        return true;
+                }
+            }
+            break;
+        }
+        return false;
+    }
 
-	/**
-	 * This method must be called immediately after isValidMove(t, o)
-	 */
-	boolean rochade() {
-		if (white_rochades_small) {
-			setPiece(61, getPiece(63));
-			setPiece(63, new Piece(null, null, EMPTY, 0));
-			return true;
-		}
+    /**
+     * This method must be called immediately after isValidMove(t, o)
+     */
+    boolean rochade() {
+        if (white_rochades_small) {
+            setPiece(61, getPiece(63));
+            setPiece(63, new Piece(null, null, EMPTY, 0));
+            return true;
+        }
 
-		if (white_rochades_big) {
-			setPiece(59, getPiece(56));
-			setPiece(56, new Piece(null, null, EMPTY, 0));
-			return true;
-		}
+        if (white_rochades_big) {
+            setPiece(59, getPiece(56));
+            setPiece(56, new Piece(null, null, EMPTY, 0));
+            return true;
+        }
 
-		if (black_rochades_small) {
-			setPiece(5, getPiece(7));
-			setPiece(7, new Piece(null, null, EMPTY, 0));
-			return true;
-		}
+        if (black_rochades_small) {
+            setPiece(5, getPiece(7));
+            setPiece(7, new Piece(null, null, EMPTY, 0));
+            return true;
+        }
 
-		if (black_rochades_big) {
-			setPiece(3, getPiece(0));
-			setPiece(0, new Piece(null, null, EMPTY, 0));
-			return true;
-		}
+        if (black_rochades_big) {
+            setPiece(3, getPiece(0));
+            setPiece(0, new Piece(null, null, EMPTY, 0));
+            return true;
+        }
 
-		return false;
-	}
+        return false;
+    }
 
-	/**
-	 * checks, whether color is in check or not.
-	 */
-	public boolean isCheck(String color) {
-		int i;
-		int wking;
-		int bking;
+    /**
+     * checks, whether color is in check or not.
+     */
+    public boolean isCheck(String color) {
+        int i;
+        int wking;
+        int bking;
 
-		wking = bking = -1;
+        wking = bking = -1;
 
-		for (i=0;i<64;i++) {
-			if (isWhiteKing(i)) {
-				wking = i;
-			}
-			if (isBlackKing(i)) {
-				bking = i;
-			}
-		}
+        for (i = 0; i < 64; i++) {
+            if (isWhiteKing(i)) {
+                wking = i;
+            }
+            if (isBlackKing(i)) {
+                bking = i;
+            }
+        }
 
-		// returns 64 false positives
-		if (wking == -1 || bking == -1)
-			return true;
+        // returns 64 false positives
+        if (wking == -1 || bking == -1)
+            return true;
 
-		if (color.equals("white")) {
-			for (i=0;i<64;i++)
-				if (validMove(wking, i)) {
-					return true;
-				}
+        if (color.equals("white")) {
+            for (i = 0; i < 64; i++)
+                if (validMove(wking, i)) {
+                    return true;
+                }
 
-			return false;
-		}
+            return false;
+        }
 
-		if (color.equals("black")) {
-			for (i=0;i<64;i++)
-				if (validMove(bking, i)) {
-					return true;
-				}
+        if (color.equals("black")) {
+            for (i = 0; i < 64; i++)
+                if (validMove(bking, i)) {
+                    return true;
+                }
 
-			return false;
-		}
-		return false;
-	}
+            return false;
+        }
+        return false;
+    }
 
-	/**
-	 * simulates a "valid" move or returns false.
-	 * all changes are relative to pieces and will not be painted.
-	 * This method sets internal variables for the rochade() method, which will be overwritten.
-	 */
-	public boolean simulateMove(int t, int o) {
-		if ( !validMove(t, o) ) {
-			return false;
-		}
+    /**
+     * simulates a "valid" move or returns false. all changes are relative to
+     * pieces and will not be painted. This method sets internal variables for
+     * the rochade() method, which will be overwritten.
+     */
+    public boolean simulateMove(int t, int o) {
+        if (!validMove(t, o)) {
+            return false;
+        }
 
-		push(getPiece(t), t, getPiece(o), o);
+        push(getPiece(t), t, getPiece(o), o);
 
-		if ( getType(o) == PAWN ) {
-			if(isBlack(o) && t >=56)
-				setPiece(o, new Piece(black_queen));
+        if (getType(o) == PAWN) {
+            if (isBlack(o) && t >= 56)
+                setPiece(o, new Piece(black_queen));
 
-			if(isWhite(o) && t <=7)
-				setPiece(o, new Piece(white_queen));
-		}
+            if (isWhite(o) && t <= 7)
+                setPiece(o, new Piece(white_queen));
+        }
 
-		setPiece(t, new Piece(getPiece(o)));
-		setPiece(o, new Piece(null, null, EMPTY, 0));
+        setPiece(t, new Piece(getPiece(o)));
+        setPiece(o, new Piece(null, null, EMPTY, 0));
 
-		if (isCheck(getColor(t))) {
-			/* restore current position */
-			if(UNDO_DEBUG)
-				print("UNDO", t, o, 0);
-			undo();
-			return false;
-		}
+        if (isCheck(getColor(t))) {
+            /* restore current position */
+            if (UNDO_DEBUG)
+                print("UNDO", t, o, 0);
+            undo();
+            return false;
+        }
 
-		return true;
-	}
+        return true;
+    }
 
-	/**
-	 * performs a "valid" move or returns false.
-	 * all changes are relative to board_pieces and will be painted.
-	 */
-	public boolean doMove(int t, int o) {
-		if ( !validMove(t, o) ) {
-			return false;
-		}
+    /**
+     * performs a "valid" move or returns false. all changes are relative to
+     * board_pieces and will be painted.
+     */
+    public boolean doMove(int t, int o) {
+        if (!validMove(t, o)) {
+            return false;
+        }
 
-		push(getPiece(t), t, getPiece(o), o);
+        push(getPiece(t), t, getPiece(o), o);
 
-		if ( getType(o) == PAWN ) {
-			if(isBlack(o) && t >=56)
-				setPiece(o, new Piece(black_queen));
+        if (getType(o) == PAWN) {
+            if (isBlack(o) && t >= 56)
+                setPiece(o, new Piece(black_queen));
 
-			if(isWhite(o) && t <=7)
-				setPiece(o, new Piece(white_queen));
-		}
+            if (isWhite(o) && t <= 7)
+                setPiece(o, new Piece(white_queen));
+        }
 
-		setPiece(t, new Piece(getPiece(o)));
-		setPiece(o, new Piece(null, null, EMPTY, 0));
+        setPiece(t, new Piece(getPiece(o)));
+        setPiece(o, new Piece(null, null, EMPTY, 0));
 
-		if (rochade())
-			System.out.println("Rochade");
+        if (rochade())
+            System.out.println("Rochade");
 
-		if (isCheck(getColor(t))) {
-			// restore current positions
-			if(UNDO_DEBUG)
-				print("UNDO", t, o, 0);
-			undo();
-			return false;
-		}
+        if (isCheck(getColor(t))) {
+            // restore current positions
+            if (UNDO_DEBUG)
+                print("UNDO", t, o, 0);
+            undo();
+            return false;
+        }
 
-		board_pieces = getPieces();
-		repaint();
+        board_pieces = getPieces();
+        repaint();
 
-		moveNr = stack.size();
+        moveNr = stack.size();
 
-		return true;
-	}
+        return true;
+    }
 
-	/**
-	 * converts the internal representation into normal chess notation and writes it to stdout
-	 */
-	public void print(String s, int t, int o, int value) {
-		int row1, col1, row2, col2;
-
-		row1 = o/8;
-		col1 = o-(8*row1);
+    /**
+     * converts the internal representation into normal chess notation and
+     * writes it to stdout
+     */
+    public void print(String s, int t, int o, int value) {
+        int row1, col1, row2, col2;
 
-		row2 = t/8;
-		col2 = t-(8*row2);
+        row1 = o / 8;
+        col1 = o - (8 * row1);
 
-		System.out.printf("%s: %C%d-%c%d = %3d%n", s,
-				('A')+col1, 8-row1,
-				('A')+col2, 8-row2, value);
-	}
+        row2 = t / 8;
+        col2 = t - (8 * row2);
+
+        System.out.printf("%s: %C%d-%c%d = %3d%n", s, ('A') + col1, 8 - row1, ('A') + col2, 8 - row2, value);
+    }
 }
--- a/org/homelinux/largo/schach/KIBoard.java
+++ b/org/homelinux/largo/schach/KIBoard.java
@@ -9,203 +9,205 @@
 import org.homelinux.largo.games.board.chessboard.ChessBoard;
 
 public class KIBoard extends ChessBoard {
-	static final long serialVersionUID = 200208;
-	static final int game_const = 500;
+    static final long serialVersionUID = 200208;
+    static final int game_const = 500;
 
-	protected boolean SIMU_DEBUG  = false;
-	private boolean negate_estimation = false;
+    protected boolean SIMU_DEBUG = false;
+    private boolean negate_estimation = false;
 
-	private Move bestMove;
-	private int desired_depth;
+    private Move bestMove;
+    private int desired_depth;
 
-	public KIBoard(int w, int h) {
-		super(w, h);
-		desired_depth = -1;
-	}
+    public KIBoard(int w, int h) {
+        super(w, h);
+        desired_depth = -1;
+    }
 
-	/**
-	 * Set the current DEBUG-Level:
-	 * simu: print all valid, simulated moves
-	 * undo: print all undos
-	 */
-	public void setDebug(boolean simu, boolean undo) {
-		SIMU_DEBUG = simu;
-		UNDO_DEBUG = undo;
-	}
+    /**
+     * Set the current DEBUG-Level: simu: print all valid, simulated moves undo:
+     * print all undos
+     */
+    public void setDebug(boolean simu, boolean undo) {
+        SIMU_DEBUG = simu;
+        UNDO_DEBUG = undo;
+    }
 
-	public boolean simu_debug() {
-		return SIMU_DEBUG;
-	}
+    public boolean simu_debug() {
+        return SIMU_DEBUG;
+    }
 
-	public boolean undo_debug() {
-		return UNDO_DEBUG;
-	}
+    public boolean undo_debug() {
+        return UNDO_DEBUG;
+    }
 
-	/**
-	 * This function flips the sides: Player A maximizes and Player B minimizes
-	 */
-	public void negateEstimation(boolean b) {
-		negate_estimation = b;
-	}
+    /**
+     * This function flips the sides: Player A maximizes and Player B minimizes
+     */
+    public void negateEstimation(boolean b) {
+        negate_estimation = b;
+    }
 
-	/**
-	 * The Minimax-Algorithm works for TWO-PLAYER Games
-	 * Player A minimizes, Player B maximizes
-	 */
-	public int estimateFunction() {
-		int i;
-		int white = 0;
-		int black = 0;
+    /**
+     * The Minimax-Algorithm works for TWO-PLAYER Games Player A minimizes,
+     * Player B maximizes
+     */
+    public int estimateFunction() {
+        int i;
+        int white = 0;
+        int black = 0;
 
-		for(i=0;i<64;i++) {
-			if (isWhite(i))
-				white+=getValue(i);
-			else if (isBlack(i))
-				black+=getValue(i);
-		}
+        for (i = 0; i < 64; i++) {
+            if (isWhite(i))
+                white += getValue(i);
+            else if (isBlack(i))
+                black += getValue(i);
+        }
 
-		// Bewerte Entwicklung, Anzahl der Steine
-		// Das hier ist alles zu lahm...
-		white+=controls("white");
-		black+=controls("black");
+        // Bewerte Entwicklung, Anzahl der Steine
+        // Das hier ist alles zu lahm...
+        white += controls("white");
+        black += controls("black");
 
-		/**
-		 * solves ticket #3
-		 */
-		if ( negate_estimation )
-			return white-black;
+        /**
+         * solves ticket #3
+         */
+        if (negate_estimation)
+            return white - black;
 
-		return black-white;
-	}
+        return black - white;
+    }
 
-	/**
-	 * simulates and returns the next possible move for a Player or null, when no more moves are possible.
-	 * The Turn will flip automatically if "simulate(...)" finds a valid move.
-	 */
-	Move simulate(int t, int o) {
-		Move move;
-		int value;
+    /**
+     * simulates and returns the next possible move for a Player or null, when
+     * no more moves are possible. The Turn will flip automatically if
+     * "simulate(...)" finds a valid move.
+     */
+    Move simulate(int t, int o) {
+        Move move;
+        int value;
 
-		if ( validTurn(o) ) {
-			while ( t < 64 ) {
-				if (!simulateMove(t, o) ) {
-					t++;
-					continue;
-				}
+        if (validTurn(o)) {
+            while (t < 64) {
+                if (!simulateMove(t, o)) {
+                    t++;
+                    continue;
+                }
 
-				value = estimateFunction();
-				if(SIMU_DEBUG)
-					print("SIMU", t, o, value);
+                value = estimateFunction();
+                if (SIMU_DEBUG)
+                    print("SIMU", t, o, value);
 
-				move = new Move(value, t, o);
+                move = new Move(value, t, o);
 
-				/* Flip Sides */
-				setBlacksTurn(!isBlacksTurn());
-				return move;
-			}
-		}
-		return null;
-	}
+                /* Flip Sides */
+                setBlacksTurn(!isBlacksTurn());
+                return move;
+            }
+        }
+        return null;
+    }
 
-	/**
-	 * AlphaBeta-Algorithm: the Maximizer
-	 */
-	int max_alpha_beta (int depth, int alpha, int beta) {
-		int moveValue;
-		int o, t;
-		Move move;
+    /**
+     * AlphaBeta-Algorithm: the Maximizer
+     */
+    int max_alpha_beta(int depth, int alpha, int beta) {
+        int moveValue;
+        int o, t;
+        Move move;
 
-		if ( desired_depth == -1 )
-			desired_depth = depth;
+        if (desired_depth == -1)
+            desired_depth = depth;
 
-		for (o = 0; o < 64; o++) {
-			t=0;
-			while ( (move=simulate(t, o)) != null ) {
-				/* particular move from black */
-				t = move.target;
+        for (o = 0; o < 64; o++) {
+            t = 0;
+            while ((move = simulate(t, o)) != null) {
+                /* particular move from black */
+                t = move.target;
 
-				if ( depth == 0 || Math.abs(move.value) > game_const )
-					moveValue = move.value;
-				else /* best next move */
-					moveValue = min_alpha_beta(depth-1, alpha, beta);
+                if (depth == 0 || Math.abs(move.value) > game_const)
+                    moveValue = move.value;
+                else
+                    /* best next move */
+                    moveValue = min_alpha_beta(depth - 1, alpha, beta);
 
-				undo();
-				t++;
+                undo();
+                t++;
 
-				if ( moveValue >= beta )
-					return beta;
+                if (moveValue >= beta)
+                    return beta;
 
-				if ( moveValue > alpha ) {
-					alpha = moveValue;
-					if ( depth == desired_depth )
-						bestMove = move;
-				}
-			}
-		}
+                if (moveValue > alpha) {
+                    alpha = moveValue;
+                    if (depth == desired_depth)
+                        bestMove = move;
+                }
+            }
+        }
 
-		return alpha;
-	}
+        return alpha;
+    }
 
-	/**
-	 * AlphaBeta-Algorithm: the Minimizer
-	 */
-	int min_alpha_beta(int depth, int alpha, int beta) {
-		int moveValue;
-		int o, t;
-		Move move;
+    /**
+     * AlphaBeta-Algorithm: the Minimizer
+     */
+    int min_alpha_beta(int depth, int alpha, int beta) {
+        int moveValue;
+        int o, t;
+        Move move;
 
-		for (o = 0; o < 64; o++) {
-			t=0;
-			while ( (move=simulate(t, o)) != null ) {
-				/* particular move from white */
-				t = move.target;
+        for (o = 0; o < 64; o++) {
+            t = 0;
+            while ((move = simulate(t, o)) != null) {
+                /* particular move from white */
+                t = move.target;
 
-				if ( depth == 0 || Math.abs(move.value) > game_const )
-					moveValue = move.value;
-				else /* best next move */
-					moveValue = max_alpha_beta(depth-1, alpha, beta);
+                if (depth == 0 || Math.abs(move.value) > game_const)
+                    moveValue = move.value;
+                else
+                    /* best next move */
+                    moveValue = max_alpha_beta(depth - 1, alpha, beta);
 
-				undo();
-				t++;
+                undo();
+                t++;
 
-				if ( moveValue <= alpha )
-					return alpha;
+                if (moveValue <= alpha)
+                    return alpha;
 
-				if ( moveValue < beta )
-					beta = moveValue;
-			}
-		}
+                if (moveValue < beta)
+                    beta = moveValue;
+            }
+        }
 
-		return beta;
-	}
+        return beta;
+    }
 
-	/**
-	 * Evaluates the next, best Move after search_depth half-moves.
-	 * When the Machine has Black, set negateEstimation(false);
-	 * When the Machine has White, set negateEstimation(true);
-	 */
-	public boolean doBestMove(int search_depth) {
-		int value;
-		desired_depth = -1;
-		bestMove = null;
+    /**
+     * Evaluates the next, best Move after search_depth half-moves. When the
+     * Machine has Black, set negateEstimation(false); When the Machine has
+     * White, set negateEstimation(true);
+     */
+    public boolean doBestMove(int search_depth) {
+        int value;
+        desired_depth = -1;
+        bestMove = null;
 
-		value = max_alpha_beta(search_depth, Integer.MIN_VALUE, Integer.MAX_VALUE);
+        value = max_alpha_beta(search_depth, Integer.MIN_VALUE, Integer.MAX_VALUE);
 
-		if ( bestMove == null ) {
-			System.err.println("Computing once more...");
-			value = max_alpha_beta(--search_depth, Integer.MIN_VALUE, Integer.MAX_VALUE);
-			if (bestMove == null) {
-				System.out.println("Check Mate " + value);
-				return false;
-			}
-		}
+        if (bestMove == null) {
+            System.err.println("Computing once more...");
+            value = max_alpha_beta(--search_depth, Integer.MIN_VALUE, Integer.MAX_VALUE);
+            if (bestMove == null) {
+                System.out.println("Check Mate " + value);
+                return false;
+            }
+        }
 
-		if (doMove(bestMove.target, bestMove.origin)) {
-			print(getColor(bestMove.target), bestMove.target, bestMove.origin, bestMove.value);
-			return true;
-		}
+        if (doMove(bestMove.target, bestMove.origin)) {
+            print(getColor(bestMove.target), bestMove.target, bestMove.origin, bestMove.value);
+            return true;
+        }
 
-		print("Check Mate", bestMove.target, bestMove.origin, bestMove.value);
-		return false;
-	}
+        print("Check Mate", bestMove.target, bestMove.origin, bestMove.value);
+        return false;
+    }
 }
--- a/org/homelinux/largo/schach/Schach.java
+++ b/org/homelinux/largo/schach/Schach.java
@@ -22,214 +22,214 @@
 import org.homelinux.largo.utils.BrowserLaunch;
 
 public class Schach extends JFrame implements Runnable {
-	static final long serialVersionUID = 140208;
-	static final String helpURL = "http://largo.homelinux.org/cgi-bin/gitweb.cgi?p=games/Schach.git;a=summary";
+    static final long serialVersionUID = 140208;
+    static final String helpURL = "http://largo.homelinux.org/cgi-bin/gitweb.cgi?p=games/Schach.git;a=summary";
 
-	MouseListener listener;
-	KIBoard board;
-	Point p;
-	JLabel    human = new JLabel("<html><font size='5' color='#FFFFFF'>Human</font></html>");
-	JLabel computer = new JLabel("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-	JButton     neu = new JButton("Play");
-	JButton  pconly = new JButton("PC-PC");
-	JButton    back = new JButton("Back");
-	JButton forward = new JButton("For");
-	JButton    help = new JButton("Source");
+    MouseListener listener;
+    KIBoard board;
+    Point p;
+    JLabel human = new JLabel("<html><font size='5' color='#FFFFFF'>Human</font></html>");
+    JLabel computer = new JLabel("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+    JButton neu = new JButton("Play");
+    JButton pconly = new JButton("PC-PC");
+    JButton back = new JButton("Back");
+    JButton forward = new JButton("For");
+    JButton help = new JButton("Source");
 
-	SpinnerNumberModel model = new SpinnerNumberModel(4, 1, 8, 1);
-	JSpinner combo = new JSpinner(model);
+    SpinnerNumberModel model = new SpinnerNumberModel(4, 1, 8, 1);
+    JSpinner combo = new JSpinner(model);
 
-	JPanel panel;
-	JPanel fpanel;
+    JPanel panel;
+    JPanel fpanel;
 
-	int search_depth;
+    int search_depth;
 
-	boolean pc_only;
+    boolean pc_only;
 
-	public Schach (int w, int h) {
-		super("Chess by Largo Enterprises");
-		setDefaultCloseOperation (javax.swing.JFrame.EXIT_ON_CLOSE);
-		board = new KIBoard(w, h);
+    public Schach(int w, int h) {
+        super("Chess by Largo Enterprises");
+        setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
+        board = new KIBoard(w, h);
 
-		fpanel = new JPanel();
-		fpanel.add(back);
-		fpanel.add(neu);
-		fpanel.add(combo);
-		fpanel.add(pconly);
-		fpanel.add(help);
-		fpanel.add(forward);
+        fpanel = new JPanel();
+        fpanel.add(back);
+        fpanel.add(neu);
+        fpanel.add(combo);
+        fpanel.add(pconly);
+        fpanel.add(help);
+        fpanel.add(forward);
 
-		panel = new JPanel();
-		panel.setLayout(new BorderLayout());
-		panel.add(human, "West");
-		panel.add(fpanel, "Center");
-		panel.add(computer, "East");
+        panel = new JPanel();
+        panel.setLayout(new BorderLayout());
+        panel.add(human, "West");
+        panel.add(fpanel, "Center");
+        panel.add(computer, "East");
 
-		fpanel.setBackground(new Color(50, 100, 200));
-		panel.setBackground(new Color(50, 100, 200));
+        fpanel.setBackground(new Color(50, 100, 200));
+        panel.setBackground(new Color(50, 100, 200));
 
-		getContentPane().setLayout(new BorderLayout());
-		getContentPane().add(panel, "North");
-		getContentPane().add(board, "Center");
+        getContentPane().setLayout(new BorderLayout());
+        getContentPane().add(panel, "North");
+        getContentPane().add(board, "Center");
 
-		neu.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent actionevent) {
-				human.setText("<html><font size='5' color='#FFFFFF'>Human</font></html>");
-				computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				pc_only = false;
-				board.init();
-				board.negateEstimation(false);
-			}
-		});
+        neu.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionevent) {
+                human.setText("<html><font size='5' color='#FFFFFF'>Human</font></html>");
+                computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                pc_only = false;
+                board.init();
+                board.negateEstimation(false);
+            }
+        });
 
-		pconly.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent actionevent) {
-				human.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				pc_only = true;
-			}
-		});
+        pconly.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionevent) {
+                human.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                pc_only = true;
+            }
+        });
 
-		back.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent actionevent) {
-				board.backwards();
-			}
-		});
+        back.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionevent) {
+                board.backwards();
+            }
+        });
 
-		forward.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent actionevent) {
-				board.forward();
-			}
-		});
+        forward.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionevent) {
+                board.forward();
+            }
+        });
 
-		help.addActionListener(new ActionListener() {
-			public void actionPerformed(ActionEvent actionevent) {
-				BrowserLaunch browser = new BrowserLaunch();
-				browser.openURL(helpURL);
-			}
-		});
+        help.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent actionevent) {
+                BrowserLaunch browser = new BrowserLaunch();
+                browser.openURL(helpURL);
+            }
+        });
 
-		listener = board.getMouseListener();
+        listener = board.getMouseListener();
 
-		pc_only = false;
-		search_depth = 3;
-		pack();
-	}
+        pc_only = false;
+        search_depth = 3;
+        pack();
+    }
 
-	public void computer_play () {
-		while (pc_only) {
-			search_depth = model.getNumber().intValue()-1;
+    public void computer_play() {
+        while (pc_only) {
+            search_depth = model.getNumber().intValue() - 1;
 
-			if ( !board.isBlacksTurn() ) {
-				human.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
-				board.negateEstimation(true);
-				if (!board.doBestMove(search_depth) ) {
-					pc_only = false;
-					return;
-				}
-				board.negateEstimation(false);
-				human.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				board.setBlacksTurn(true);
-			} else {
-				computer.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
-				if (!board.doBestMove(search_depth) ) {
-					pc_only = false;
-					return;
-				}
-				computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				board.setBlacksTurn(false);
+            if (!board.isBlacksTurn()) {
+                human.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
+                board.negateEstimation(true);
+                if (!board.doBestMove(search_depth)) {
+                    pc_only = false;
+                    return;
+                }
+                board.negateEstimation(false);
+                human.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                board.setBlacksTurn(true);
+            } else {
+                computer.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
+                if (!board.doBestMove(search_depth)) {
+                    pc_only = false;
+                    return;
+                }
+                computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                board.setBlacksTurn(false);
 
-				if (board.simu_debug()) {
-					for (int i=0;i<64;i++) {
-						if((i+1)%8 == 0 )
-							System.err.printf("%2d=%d%n", i, board.getValue(i));
-						else
-							System.err.printf("%2d=%d ", i, board.getValue(i));
-					}
-				}
+                if (board.simu_debug()) {
+                    for (int i = 0; i < 64; i++) {
+                        if ((i + 1) % 8 == 0)
+                            System.err.printf("%2d=%d%n", i, board.getValue(i));
+                        else
+                            System.err.printf("%2d=%d ", i, board.getValue(i));
+                    }
+                }
 
-				try {
-					Thread.sleep (10);
-				} catch (InterruptedException e) {
-					System.err.println("computer_play: " + e.getLocalizedMessage());
-					System.err.println("========================================================================");
-					e.printStackTrace();
-					System.err.println("========================================================================");
-					return;
-				}
-			}
-		}
-	}
+                try {
+                    Thread.sleep(10);
+                } catch (InterruptedException e) {
+                    System.err.println("computer_play: " + e.getLocalizedMessage());
+                    System.err.println("========================================================================");
+                    e.printStackTrace();
+                    System.err.println("========================================================================");
+                    return;
+                }
+            }
+        }
+    }
 
-	public void run () {
-		for (;;) {
+    public void run() {
+        for (;;) {
 
-			/* is this thread safe */
-			search_depth = model.getNumber().intValue()-1;
+            /* is this thread safe */
+            search_depth = model.getNumber().intValue() - 1;
 
-			if (pc_only) {
-				computer_play ();
-			}
+            if (pc_only) {
+                computer_play();
+            }
 
-			if ( !board.isBlacksTurn() ) {
-				if (listener.isSelected ()) {
-					p = listener.getSelection ();
-					if (board.move (p))
-						board.setBlacksTurn(true);
-				}
-				try {
-					Thread.sleep (50);
-				}
-				catch (InterruptedException e) {
-					System.err.println("Schach::run: " + e.getLocalizedMessage());
-					System.err.println("========================================================================");
-					e.printStackTrace();
-					System.err.println("========================================================================");
-					return;
-				}
-			} else {
-				human.setText("<html><font size='5' color='#FFFFFF'>Human</font></html>");
-				computer.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
-				board.doBestMove(search_depth);
-				human.setText("<html><font size='5' color='#FF3333'>Human</font></html>");
-				computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
-				board.setBlacksTurn(false);
+            if (!board.isBlacksTurn()) {
+                if (listener.isSelected()) {
+                    p = listener.getSelection();
+                    if (board.move(p))
+                        board.setBlacksTurn(true);
+                }
+                try {
+                    Thread.sleep(50);
+                } catch (InterruptedException e) {
+                    System.err.println("Schach::run: " + e.getLocalizedMessage());
+                    System.err.println("========================================================================");
+                    e.printStackTrace();
+                    System.err.println("========================================================================");
+                    return;
+                }
+            } else {
+                human.setText("<html><font size='5' color='#FFFFFF'>Human</font></html>");
+                computer.setText("<html><font size='5' color='#FF3333'>Computer</font></html>");
+                board.doBestMove(search_depth);
+                human.setText("<html><font size='5' color='#FF3333'>Human</font></html>");
+                computer.setText("<html><font size='5' color='#FFFFFF'>Computer</font></html>");
+                board.setBlacksTurn(false);
 
-				if (board.simu_debug()) {
-					for (int i=0;i<64;i++) {
-						if((i+1)%8 == 0 )
-							System.out.printf("%2d=%d%n", i, board.getValue(i));
-						else
-							System.out.printf("%2d=%d ", i, board.getValue(i));
-					}
-				}
-			}
-		}
-	}
+                if (board.simu_debug()) {
+                    for (int i = 0; i < 64; i++) {
+                        if ((i + 1) % 8 == 0)
+                            System.out.printf("%2d=%d%n", i, board.getValue(i));
+                        else
+                            System.out.printf("%2d=%d ", i, board.getValue(i));
+                    }
+                }
+            }
+        }
+    }
 
-	public static void main (String args[]) {
-		Schach s = new Schach (74, 74);
+    public static void main(String args[]) {
+        Schach s = new Schach(74, 74);
 
-		s.setResizable(false);
-		s.setVisible (true);
+        s.setResizable(false);
+        s.setVisible(true);
 
-		if (args.length == 1 ) {
-			if ( args[0].equals("full") )
-				s.board.setDebug(true, true);
-			else if ( args[0].equals("simu") )
-				s.board.setDebug(true, false);
-			else if ( args[0].equals("undo") )
-				s.board.setDebug(false, true);
-			else if ( args[0].equals("none") )
-				s.board.setDebug(false, false);
-			else {
-				System.out.println("   Chess: java -jar games.jar [full|simu|undo|none]");
-				System.out.println("Checkers: java -cp games.jar org.homelinux.largo.checkers.Checkers [full|simu|undo|none]");
-			}
-		}
+        if (args.length == 1) {
+            if (args[0].equals("full"))
+                s.board.setDebug(true, true);
+            else if (args[0].equals("simu"))
+                s.board.setDebug(true, false);
+            else if (args[0].equals("undo"))
+                s.board.setDebug(false, true);
+            else if (args[0].equals("none"))
+                s.board.setDebug(false, false);
+            else {
+                System.out.println("   Chess: java -jar games.jar [full|simu|undo|none]");
+                System.out
+                        .println("Checkers: java -cp games.jar org.homelinux.largo.checkers.Checkers [full|simu|undo|none]");
+            }
+        }
 
-		Thread t = new Thread(s);
-		t.setPriority(Thread.NORM_PRIORITY-1);
-		t.start();
-	}
+        Thread t = new Thread(s);
+        t.setPriority(Thread.NORM_PRIORITY - 1);
+        t.start();
+    }
 }
--- a/org/homelinux/largo/utils/BrowserLaunch.java
+++ b/org/homelinux/largo/utils/BrowserLaunch.java
@@ -8,43 +8,48 @@
 import java.lang.reflect.Method;
 
 import javax.swing.JOptionPane;
+
 /**
  * Cross-Platform Browserlaunch
  */
 public class BrowserLaunch {
-	private static final String errMsg = "Error attempting to launch web browser";
+    private static final String errMsg = "Error attempting to launch web browser";
 
-	/**
-	 * This method opens the URL in a native platform browser
-	 */
-	public void openURL(String url) {
-		String osName = System.getProperty("os.name");
-		try {
-			if (osName.startsWith("Mac OS")) {
-				Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
-				Method openURL = fileMgr.getDeclaredMethod("openURL",
-						new Class[] { String.class });
-				openURL.invoke(null, new Object[] { url });
-			} else if (osName.startsWith("Windows"))
-				Runtime.getRuntime().exec(
-						"rundll32 url.dll,FileProtocolHandler " + url);
-			else {
-				String[] browsers = { "firefox", "opera", "konqueror",
-						"epiphany", "mozilla", "netscape" };
-				String browser = null;
-				for (int count = 0; count < browsers.length && browser == null; count++)
-					if (Runtime.getRuntime().exec(
-							new String[] { "which", browsers[count] })
-							.waitFor() == 0)
-						browser = browsers[count];
-				if (browser == null)
-					throw new Exception("Could not find web browser");
-				else
-					Runtime.getRuntime().exec(new String[] { browser, url });
-			}
-		} catch (Exception e) {
-			JOptionPane.showMessageDialog(null, errMsg + ":\n"
-					+ e.getLocalizedMessage());
-		}
-	}
+    /**
+     * This method opens the URL in a native platform browser
+     */
+    public void openURL(String url) {
+        String osName = System.getProperty("os.name");
+        try {
+            if (osName.startsWith("Mac OS")) {
+                Class<?> fileMgr = Class.forName("com.apple.eio.FileManager");
+                Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] {
+                    String.class
+                });
+                openURL.invoke(null, new Object[] {
+                    url
+                });
+            } else if (osName.startsWith("Windows"))
+                Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
+            else {
+                String[] browsers = {
+                        "firefox", "opera", "konqueror", "epiphany", "mozilla", "netscape"
+                };
+                String browser = null;
+                for (int count = 0; count < browsers.length && browser == null; count++)
+                    if (Runtime.getRuntime().exec(new String[] {
+                            "which", browsers[count]
+                    }).waitFor() == 0)
+                        browser = browsers[count];
+                if (browser == null)
+                    throw new Exception("Could not find web browser");
+                else
+                    Runtime.getRuntime().exec(new String[] {
+                            browser, url
+                    });
+            }
+        } catch (Exception e) {
+            JOptionPane.showMessageDialog(null, errMsg + ":\n" + e.getLocalizedMessage());
+        }
+    }
 };
--- a/org/homelinux/largo/utils/ImgComponent.java
+++ b/org/homelinux/largo/utils/ImgComponent.java
@@ -8,24 +8,24 @@
 import javax.swing.ImageIcon;
 
 public class ImgComponent extends Canvas {
-	static final long serialVersionUID = 140208;
-	private Image img;
+    static final long serialVersionUID = 140208;
+    private Image img;
 
-	public ImgComponent (String sFile) {
-		ClassLoader cl = getClass ().getClassLoader ();
-		URL url = cl.getResource (sFile);
-		img = new ImageIcon (url).getImage ();
-	}
+    public ImgComponent(String sFile) {
+        ClassLoader cl = getClass().getClassLoader();
+        URL url = cl.getResource(sFile);
+        img = new ImageIcon(url).getImage();
+    }
 
-	public Image getImage () {
-		return img;
-	}
+    public Image getImage() {
+        return img;
+    }
 
-	public Dimension getPreferredSize () {
-		return new Dimension (img.getWidth (this), img.getHeight (this));
-	}
+    public Dimension getPreferredSize() {
+        return new Dimension(img.getWidth(this), img.getHeight(this));
+    }
 
-	public Dimension getMinimumSize () {
-		return getPreferredSize ();
-	}
+    public Dimension getMinimumSize() {
+        return getPreferredSize();
+    }
 }