From 0db8db22419a669ac76b80852c44bd20b5a2bf22 Mon Sep 17 00:00:00 2001 From: Matz Radloff Date: Sat, 13 Oct 2012 15:36:27 +0200 Subject: [PATCH] First version of WinnerLogic. Just for syncing purpose. Its not working atm. --- server-gui/game_gui.conf | Bin 872 -> 891 bytes server-gui/sync.error | 10 +++++ .../src/sc/player2013/Starter.java | 2 +- .../src/sc/player2013/WinnerLogic.java | 41 +++++++++++++----- 4 files changed, 40 insertions(+), 13 deletions(-) diff --git a/server-gui/game_gui.conf b/server-gui/game_gui.conf index 8e6a6e6d98408af8f124c9a0f428d78468aaeeb6..eb19d3432173652bca384a79a191d08fd196a94b 100644 GIT binary patch delta 38 ucmaFC_M2_PR3<4&=ltA)(vsAo;)2Z7oYW!(joie%($t(B&B=3^&Hw-&d-_*R~ possibleMoves = (LinkedList) gameState - .getPossibleMoves(); + LinkedList possibleMoves = (LinkedList) gameState.getPossibleMoves(); System.out.println("*** Anzahl der möglichen Züge:" + possibleMoves.size()); - Move move; + + Move move = null; // Wenn es mögliche Züge gibt: if (possibleMoves.size() > 0) { - - if (field.numPirates(gameState.getCurrentPlayerColor()) > 0) { - - - } - // Create move - - + if (currentPlayer.getCards().size() <= 1) { + for (int k = gameState.getBoard().size(); k > 0; k--) { + Field pirate_field = gameState.getBoard().getField(k); + if (pirate_field.numPirates(gameState.getCurrentPlayerColor()) > 0) { + move = new BackwardMove(k); + } + } + + + } else { + + int biggest_index = 0; + + for (Move m: possibleMoves) { + if (m.fieldIndex > biggest_index) { + biggest_index = m.fieldIndex; + } + } + for (Move m: possibleMoves) { + if (m.fieldIndex == biggest_index) { + move = (ForwardMove) m; + } + } + } + } else { move = null; }