Merge remote-tracking branch 'origin/main'
This commit is contained in:
		
						commit
						0e5a4c6254
					
				| 
						 | 
				
			
			@ -21,7 +21,5 @@ public class Siedler {
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -5,8 +5,8 @@ import ch.zhaw.hexboard.HexBoard;
 | 
			
		|||
import ch.zhaw.hexboard.Label;
 | 
			
		||||
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
 | 
			
		||||
public class SiedlerBoard extends HexBoard<Land, Structure, Road, String> {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -58,7 +58,6 @@ public class SiedlerBoard extends HexBoard<Land, Structure, Road, String> {
 | 
			
		|||
     * @return the fields associated with the dice value
 | 
			
		||||
     */
 | 
			
		||||
    public List<Point> getFieldsForDiceValue(int dice) {
 | 
			
		||||
        //TODO: Implement.
 | 
			
		||||
        ArrayList<Point> fields = new ArrayList<>();
 | 
			
		||||
        for(Point field : lowerFieldLabel.keySet()){
 | 
			
		||||
            if(getDiceNumber(field) == dice){
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2,12 +2,12 @@ package ch.zhaw.catan;
 | 
			
		|||
 | 
			
		||||
import ch.zhaw.catan.Config.Faction;
 | 
			
		||||
import ch.zhaw.catan.Config.Resource;
 | 
			
		||||
import org.beryx.textio.TextIO;
 | 
			
		||||
import org.beryx.textio.TextIoFactory;
 | 
			
		||||
import org.beryx.textio.TextTerminal;
 | 
			
		||||
 | 
			
		||||
import java.awt.Point;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
| 
						 | 
				
			
			@ -58,7 +58,6 @@ public class SiedlerGame {
 | 
			
		|||
     * Switches to the next player in the defined sequence of players.
 | 
			
		||||
     */
 | 
			
		||||
    public void switchToNextPlayer() {
 | 
			
		||||
        // TODO: Implement
 | 
			
		||||
        if (activePlayer < allPlayers.size()){
 | 
			
		||||
            activePlayer++;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -71,7 +70,6 @@ public class SiedlerGame {
 | 
			
		|||
     * Switches to the previous player in the defined sequence of players.
 | 
			
		||||
     */
 | 
			
		||||
    public void switchToPreviousPlayer() {
 | 
			
		||||
        // TODO: Implement
 | 
			
		||||
        if (activePlayer > 0){
 | 
			
		||||
            activePlayer--;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			@ -94,7 +92,6 @@ public class SiedlerGame {
 | 
			
		|||
     * @return the list with player's factions
 | 
			
		||||
     */
 | 
			
		||||
    public List<Faction> getPlayerFactions() {
 | 
			
		||||
        // TODO: Implement
 | 
			
		||||
        List<Faction> factions = new ArrayList<>();
 | 
			
		||||
        for (Player player: allPlayers ) {
 | 
			
		||||
            factions.add(player.getFaction());
 | 
			
		||||
| 
						 | 
				
			
			@ -130,8 +127,7 @@ public class SiedlerGame {
 | 
			
		|||
     * @return the number of resource cards of this type
 | 
			
		||||
     */
 | 
			
		||||
    public int getCurrentPlayerResourceStock(Resource resource) {
 | 
			
		||||
        int ressourceInStock = allPlayers.get(activePlayer).getSpecificResource(resource);
 | 
			
		||||
        return ressourceInStock;
 | 
			
		||||
        return allPlayers.get(activePlayer).getSpecificResource(resource);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
| 
						 | 
				
			
			@ -204,19 +200,17 @@ public class SiedlerGame {
 | 
			
		|||
     * @return true, if the placement was successful
 | 
			
		||||
     */
 | 
			
		||||
    public boolean buildSettlement(Point position) {
 | 
			
		||||
        //TODO Errors should be caught after this method is executed and returns false
 | 
			
		||||
        //1. Check if Corner
 | 
			
		||||
        if (!board.hasCorner(position)) {
 | 
			
		||||
            // TODO: Error message
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        //2. Check if Corner is empty
 | 
			
		||||
        if (board.getCorner(position) != null) {
 | 
			
		||||
            // TODO: Error message
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        //3. Can Player build Settlement
 | 
			
		||||
        if (!allPlayers.get(activePlayer).buildSettlement()) {
 | 
			
		||||
            // TODO: Error message
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        //4. Insert Road to map
 | 
			
		||||
| 
						 | 
				
			
			@ -294,7 +288,6 @@ public class SiedlerGame {
 | 
			
		|||
     * @return true, if the trade was successful
 | 
			
		||||
     */
 | 
			
		||||
    public boolean tradeWithBankFourToOne(Resource offer, Resource want) {
 | 
			
		||||
        // TODO: Implement
 | 
			
		||||
        return bank.tradeWithBank(want, offer, FOUR_TO_ONE_TRADE_WANT, FOUR_TO_ONE_TRADE_OFFER);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -304,7 +297,6 @@ public class SiedlerGame {
 | 
			
		|||
     * @return the winner of the game or null, if there is no winner (yet)
 | 
			
		||||
     */
 | 
			
		||||
    public Faction getWinner() {
 | 
			
		||||
        // TODO: Implement
 | 
			
		||||
        HashMap<Faction, Integer> winPoints = getWinPoints();
 | 
			
		||||
        for(Faction faction : winPoints.keySet()){
 | 
			
		||||
            if(winPoints.get(faction) >= winPointsForWin){
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue