Commit f4cc2df5 authored by Fabian Jakob Sauer's avatar Fabian Jakob Sauer

Fixed Optimized turn player.

parent fa23c4ca
......@@ -34,7 +34,11 @@
<property name="project.structure.side.proportion" value="0.2" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Dev\java\thegame_ai\src" />
</key>
<key name="CopyClassDialog.RECENTS_KEY">
<recent name="util.Extensions" />
<recent name="players" />
<recent name="" />
</key>
......@@ -104,53 +108,95 @@
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="587" y="0" key="#com.intellij.refactoring.rename.AutomaticRenamingDialog/0.0.1920.1040@0.0.1920.1040" timestamp="1590663254804" />
<state width="468" height="466" key="DebuggerActiveHint" timestamp="1590674275588">
<state width="477" height="466" key="DebuggerActiveHint" timestamp="1591264300086">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="468" height="466" key="DebuggerActiveHint/0.0.1920.1040@0.0.1920.1040" timestamp="1590674275588" />
<state width="477" height="466" key="DebuggerActiveHint/0.0.1920.1040@0.0.1920.1040" timestamp="1591264300086" />
<state x="622" y="273" key="FileChooserDialogImpl" timestamp="1589471605471">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="622" y="273" key="FileChooserDialogImpl/0.0.1920.1040@0.0.1920.1040" timestamp="1589471605471" />
<state width="1877" height="394" key="GridCell.Tab.0.bottom" timestamp="1590681615975">
<state width="1877" height="394" key="GridCell.Tab.-1.bottom" timestamp="1590745335105">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.-1.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1590745335105" />
<state width="1877" height="394" key="GridCell.Tab.-1.center" timestamp="1590745335105">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.-1.center/0.0.1920.1040@0.0.1920.1040" timestamp="1590745335105" />
<state width="1877" height="394" key="GridCell.Tab.-1.left" timestamp="1590745335105">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.-1.left/0.0.1920.1040@0.0.1920.1040" timestamp="1590745335105" />
<state width="1877" height="394" key="GridCell.Tab.-1.right" timestamp="1590745335105">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.-1.right/0.0.1920.1040@0.0.1920.1040" timestamp="1590745335105" />
<state width="1877" height="331" key="GridCell.Tab.0.bottom" timestamp="1591275350868">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1590681615975" />
<state width="1877" height="394" key="GridCell.Tab.0.center" timestamp="1590681615975">
<state width="1877" height="331" key="GridCell.Tab.0.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1591275350868" />
<state width="1877" height="331" key="GridCell.Tab.0.center" timestamp="1591275350868">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1590681615975" />
<state width="1877" height="394" key="GridCell.Tab.0.left" timestamp="1590681615975">
<state width="1877" height="331" key="GridCell.Tab.0.center/0.0.1920.1040@0.0.1920.1040" timestamp="1591275350868" />
<state width="1877" height="331" key="GridCell.Tab.0.left" timestamp="1591275350868">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1590681615975" />
<state width="1877" height="394" key="GridCell.Tab.0.right" timestamp="1590681615975">
<state width="1877" height="331" key="GridCell.Tab.0.left/0.0.1920.1040@0.0.1920.1040" timestamp="1591275350868" />
<state width="1877" height="331" key="GridCell.Tab.0.right" timestamp="1591275350868">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1590681615975" />
<state width="1877" height="394" key="GridCell.Tab.1.bottom" timestamp="1590681615975">
<state width="1877" height="331" key="GridCell.Tab.0.right/0.0.1920.1040@0.0.1920.1040" timestamp="1591275350868" />
<state width="1877" height="394" key="GridCell.Tab.1.bottom" timestamp="1590745318973">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.1.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1590681615975" />
<state width="1877" height="394" key="GridCell.Tab.1.center" timestamp="1590681615975">
<state width="1877" height="394" key="GridCell.Tab.1.bottom/0.0.1920.1040@0.0.1920.1040" timestamp="1590745318973" />
<state width="1877" height="394" key="GridCell.Tab.1.center" timestamp="1590745318973">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.1.center/0.0.1920.1040@0.0.1920.1040" timestamp="1590681615975" />
<state width="1877" height="394" key="GridCell.Tab.1.left" timestamp="1590681615975">
<state width="1877" height="394" key="GridCell.Tab.1.center/0.0.1920.1040@0.0.1920.1040" timestamp="1590745318973" />
<state width="1877" height="394" key="GridCell.Tab.1.left" timestamp="1590745318973">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.1.left/0.0.1920.1040@0.0.1920.1040" timestamp="1590681615975" />
<state width="1877" height="394" key="GridCell.Tab.1.right" timestamp="1590681615975">
<state width="1877" height="394" key="GridCell.Tab.1.left/0.0.1920.1040@0.0.1920.1040" timestamp="1590745318973" />
<state width="1877" height="394" key="GridCell.Tab.1.right" timestamp="1590745318973">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="394" key="GridCell.Tab.1.right/0.0.1920.1040@0.0.1920.1040" timestamp="1590681615975" />
<state width="1877" height="394" key="GridCell.Tab.1.right/0.0.1920.1040@0.0.1920.1040" timestamp="1590745318973" />
<state x="690" y="98" key="SettingsEditor" timestamp="1589472912985">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="690" y="98" key="SettingsEditor/0.0.1920.1040@0.0.1920.1040" timestamp="1589472912985" />
<state x="529" y="249" key="com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsDialogFactory$2" timestamp="1590746242481">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="529" y="249" key="com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsDialogFactory$2/0.0.1920.1040@0.0.1920.1040" timestamp="1590746242481" />
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup" timestamp="1590672526563">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup/0.0.1920.1040@0.0.1920.1040" timestamp="1590672526563" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/util/Extensions/BackupStackValue.java</url>
<line>136</line>
<option name="timeStamp" value="2" />
</line-breakpoint>
</breakpoints>
</breakpoint-manager>
<pin-to-top-manager>
<pinned-members>
<PinnedItemInfo typeName="util.Extensions.CardTracker" fieldName="cardsPlacedByOp" />
</pinned-members>
</pin-to-top-manager>
<watches-manager>
<configuration name="Application">
<watch expression="cardTracker" language="JAVA" />
<watch expression="tmpCardTracker" language="JAVA" />
</configuration>
</watches-manager>
</component>
</project>
\ No newline at end of file
WinRate, Threshold, WeightOwn, WeightOpp
0.9419, 52, 1.0, 1.0
0.9463, 52, 1.0, 0.9
0.9421, 52, 1.0, 0.8
0.9396, 52, 1.0, 0.7
0.943, 52, 1.0, 0.6
0.9391, 52, 1.0, 0.5
0.942, 52, 1.0, 0.4
0.9417, 52, 1.0, 0.3
0.94, 52, 1.0, 0.2
0.9406, 52, 1.0, 0.1
0.9402, 52, 1.0, 0.0
......@@ -2,17 +2,26 @@ import de.upb.isml.thegamef2f.engine.GameHistory;
import de.upb.isml.thegamef2f.engine.board.Game;
import de.upb.isml.thegamef2f.engine.player.Player;
import players.*;
import util.Extensions.LoggingSystem;
import util.Extensions.OptimizeWeights;
import util.Extensions.Statistics;
import java.io.IOException;
import java.util.Random;
public class MainClass {
public static void main(String[] args) {
public static void main(String[] args) throws IOException {
OptimizeWeights optimizer = new OptimizeWeights();
optimizer.Compute();
}
public void RunSimulation()
{
// USER INPUT
var numGames = 1;
Player p1 = new OptimizeTurnPlayer();
Player p2 = new BasicPlayer();
int numGames = 5000;
Player p1 = new BasicPlayer();
Player p2 = new OptimizeTurnPlayer(false);
Statistics stats = new Statistics(p1, p2);
Random rand = new Random();
......@@ -26,13 +35,25 @@ public class MainClass {
Game game;
if (i % 2 == 0) // switch starting player after every game
{
//game = new Game(p1, p2, rand.nextLong());
game = new Game(p1, p2, 69420);
if (numGames == 1)
{
game = new Game(p1, p2, 69420);
}
else
{
game = new Game(p1, p2, rand.nextLong());
}
}
else
{
//game = new Game(p2, p1, rand.nextLong());
game = new Game(p2, p1, 69420);
if (numGames == 1)
{
game = new Game(p2, p1, 69420);
}
else
{
game = new Game(p2, p1, rand.nextLong());
}
}
Player winner = game.simulate(); // run games simulation
......
......@@ -192,7 +192,7 @@ public class BasicPlayer implements Player {
List<Card> cardsOnOpponentsDescendingDiscardPile = new ArrayList<>(
gameStatePriorToPlacement.getCardsOnOpponentsDescendingDiscardPile());
if (placement.getPosition() == CardPosition.OPPONENTS_ASCENDING_DISCARD_PILE) {
if (placement.getPosition() == CardPosition.OPPONENTS_DESCENDING_DISCARD_PILE) {
cardsOnOpponentsDescendingDiscardPile.add(placement.getCard());
}
......
......@@ -5,11 +5,9 @@ import de.upb.isml.thegamef2f.engine.GameState;
import de.upb.isml.thegamef2f.engine.Move;
import de.upb.isml.thegamef2f.engine.Placement;
import de.upb.isml.thegamef2f.engine.board.Card;
import de.upb.isml.thegamef2f.engine.board.Game;
import de.upb.isml.thegamef2f.engine.player.Player;
import util.Extensions.CardTracker;
import util.Extensions.ExtendedPlacement;
import util.Extensions.RatedPlacement;
import util.Extensions.GameValue;
import util.Extensions.*;
import java.util.ArrayList;
import java.util.List;
......@@ -30,15 +28,43 @@ import java.util.Random;
public class OptimizeTurnPlayer implements Player {
private LoggingSystem logger;
private int countTurn = 0;
private Random random;
private int badPlacementTheshold = 10;
private int badPlacementTheshold = 20;
private float lastGameValue;
private GameValue gameValue = new GameValue();
private CardTracker cardTracker = new CardTracker();
private GameValue gameValue;
private CardTracker cardTracker;
private GameState latestGameState;
public OptimizeTurnPlayer()
{
logger = new LoggingSystem(false);
gameValue = new GameValue(logger);
cardTracker = new CardTracker();
}
public OptimizeTurnPlayer(boolean debug)
{
logger = new LoggingSystem(debug);
gameValue = new GameValue(logger);
cardTracker = new CardTracker();
}
public OptimizeTurnPlayer(int badPlacementTheshold, float weightOwn, float weightOpp)
{
logger = new LoggingSystem(false);
gameValue = new GameValue(logger);
cardTracker = new CardTracker();
this.badPlacementTheshold = badPlacementTheshold;
this.gameValue.SetWeights(weightOwn, weightOpp);
}
@Override
public void initialize(long randomSeed) {
this.countTurn = 0;
this.gameValue = new GameValue(logger);
this.random = new Random(randomSeed);
this.cardTracker = new CardTracker();
}
......@@ -134,6 +160,7 @@ public class OptimizeTurnPlayer implements Player {
@Override
public Move computeMove(GameState newGameState) {
countTurn++;
// Reconstruct enemies last move
List<ExtendedPlacement> reconstructedPlacements = ReconstructPlacements(newGameState);
cardTracker.TrackPlacedCardsByOp(reconstructedPlacements);
......@@ -172,9 +199,12 @@ public class OptimizeTurnPlayer implements Player {
List<RatedPlacement> ratedPlacements = new ArrayList<RatedPlacement>();
for (Placement potentialPlacement : validPlacements)
{
CardTracker tmpCardTracker = new CardTracker(cardTracker);
List<Placement> tmpPlacementsOfMove = new ArrayList<Placement>(placementsOfMove);
tmpPlacementsOfMove.add(potentialPlacement);
tmpCardTracker.TrackPlacedCardsByMe(tmpPlacementsOfMove);
GameState potentialGameState = computeNewGameStateAfterPlacement(latestGameState, potentialPlacement);
ratedPlacements.add(new RatedPlacement(potentialPlacement, gameValue.calcGameValue(potentialGameState, cardTracker)));
ratedPlacements.add(new RatedPlacement(potentialPlacement, gameValue.calcGameValue(potentialGameState, tmpCardTracker)));
}
// find best rated placement
RatedPlacement bestRatedPlacement = ratedPlacements.get(0);
......@@ -186,14 +216,15 @@ public class OptimizeTurnPlayer implements Player {
}
}
Placement nextPlacement = bestRatedPlacement.placement;
//Placement nextPlacement = validPlacements.get(random.nextInt(validPlacements.size()); // pick random move if no special rule applied
logger.Log("_______________________End of turn No. " + countTurn + "_________________________");
// return if
//two or more placements are selected
if (placementsOfMove.size() >= 2)
{
// no placement was on opponents pile OR the next best rated placement is too bad)
if (!placedOnOpponentsPiles || bestRatedPlacement.resultingGameValue - lastGameValue > badPlacementTheshold)
if (!placedOnOpponentsPiles || bestRatedPlacement.resultingGameValue - lastGameValue < badPlacementTheshold)
{
cardTracker.TrackPlacedCardsByMe(placementsOfMove);
return new Move(placementsOfMove);
......@@ -207,20 +238,9 @@ public class OptimizeTurnPlayer implements Player {
// add this random placement to the placements for our move
placementsOfMove.add(nextPlacement);
/*
// return current move if number of placements >= 2
if (placementsOfMove.size() >= 2)
{
cardTracker.TrackPlacedCardsByMe(placementsOfMove);
return new Move(placementsOfMove);
}
*/
// update the view we have on the game to make sure that the next set of valid
// placements is indeed valid
latestGameState = computeNewGameStateAfterPlacement(latestGameState, nextPlacement);
}
cardTracker.TrackPlacedCardsByMe(placementsOfMove);
......@@ -251,7 +271,7 @@ public class OptimizeTurnPlayer implements Player {
List<Card> cardsOnOpponentsDescendingDiscardPile = new ArrayList<>(
gameStatePriorToPlacement.getCardsOnOpponentsDescendingDiscardPile());
if (placement.getPosition() == CardPosition.OPPONENTS_ASCENDING_DISCARD_PILE) {
if (placement.getPosition() == CardPosition.OPPONENTS_DESCENDING_DISCARD_PILE) {
cardsOnOpponentsDescendingDiscardPile.add(placement.getCard());
}
......@@ -300,4 +320,10 @@ public class OptimizeTurnPlayer implements Player {
return getName();
}
public void SetWeights(int badPlacementTheshold, float weightOwn, float weightOpp)
{
gameValue.SetWeights(weightOwn, weightOpp);
this.badPlacementTheshold = badPlacementTheshold;
}
}
\ No newline at end of file
......@@ -108,7 +108,7 @@ public class RandomPlayer implements Player {
List<Card> cardsOnOpponentsDescendingDiscardPile = new ArrayList<>(
gameStatePriorToPlacement.getCardsOnOpponentsDescendingDiscardPile());
if (placement.getPosition() == CardPosition.OPPONENTS_ASCENDING_DISCARD_PILE) {
if (placement.getPosition() == CardPosition.OPPONENTS_DESCENDING_DISCARD_PILE) {
cardsOnOpponentsDescendingDiscardPile.add(placement.getCard());
}
......
package util.Extensions;
import de.upb.isml.thegamef2f.engine.GameState;
import de.upb.isml.thegamef2f.engine.board.Card;
import java.util.List;
public class BackupStackValue {
public float value;
private boolean isMine;
private boolean isAscending;
public int ownTheo;
public int ownPrac;
public int oppTheo;
public int oppPrac;
public BackupStackValue(boolean isMine, boolean isAscending) {
this.isMine = isMine;
this.isAscending = isAscending;
}
public float GetValue() {
return value;
}
private int GetNotSkippedCards(boolean isSmallerThanTopCard, List<Card> playedCards, Card topCard)
{
int notSkippedCards = 0;
for (Card card : playedCards) {
if (isSmallerThanTopCard)
{
if (card.getNumber() <= topCard.getNumber()) {
notSkippedCards++;
}
}
else
{
if (card.getNumber() >= topCard.getNumber()) {
notSkippedCards++;
}
}
}
return notSkippedCards;
}
public void calcValues(GameState potentialGameState, CardTracker cardTracker, float weightOwn, float weightOpp) {
Card topCard;
int maybeSkippedCards;
if (isMine)
{
ownTheo = 58 - cardTracker.cardsPlacedByMe.size();
oppTheo = 58 - cardTracker.cardsPlacedByOp.size();
if (isAscending)
{
topCard = potentialGameState.getTopCardOnOwnAscendingDiscardPile();
if (topCard.getNumber() == 1)
{
ownPrac = ownTheo;
oppPrac = oppTheo;
}
else
{
maybeSkippedCards = topCard.getNumber() - 1;
ownPrac = ownTheo - (maybeSkippedCards - GetNotSkippedCards(true, cardTracker.cardsPlacedByMe, topCard));
//maybeSkippedCards = 60 - topCard.getNumber() - 1;
oppPrac = GetNotSkippedCards(false, cardTracker.cardsPlacedByOp, topCard); // to be continued
}
}
else // isDescending
{
topCard = potentialGameState.getTopCardOnOwnDescendingDiscardPile();
if (topCard.getNumber() == 60)
{
ownPrac = ownTheo;
oppPrac = oppTheo;
}
else
{
maybeSkippedCards = 60 - topCard.getNumber();
ownPrac = ownTheo - (maybeSkippedCards + GetNotSkippedCards(false, cardTracker.cardsPlacedByMe, topCard));
maybeSkippedCards = 58 - (60 - topCard.getNumber());
oppPrac = oppTheo - (maybeSkippedCards + GetNotSkippedCards(true, cardTracker.cardsPlacedByOp, topCard));
}
}
}
else // isOpponent
{
ownTheo = 58 - cardTracker.cardsPlacedByOp.size();
oppTheo = 58 - cardTracker.cardsPlacedByMe.size();
if (isAscending)
{
topCard = potentialGameState.getTopCardOnOpponentsAscendingDiscardPile();
if (topCard.getNumber() == 1)
{
ownPrac = ownTheo;
oppPrac = oppTheo;
}
else
{
maybeSkippedCards = topCard.getNumber() - 1;
ownPrac = ownTheo - (maybeSkippedCards + GetNotSkippedCards(true, cardTracker.cardsPlacedByOp, topCard));
maybeSkippedCards = 60 - topCard.getNumber();
oppPrac = oppTheo - (maybeSkippedCards + GetNotSkippedCards(false, cardTracker.cardsPlacedByMe, topCard));
}
}
else // isDescending
{
topCard = potentialGameState.getTopCardOnOpponentsDescendingDiscardPile();
if (topCard.getNumber() == 60)
{
ownPrac = ownTheo;
oppPrac = oppTheo;
}
else
{
ownPrac = ownTheo - (60 - topCard.getNumber()) + GetNotSkippedCards(false, cardTracker.cardsPlacedByOp, topCard);
oppPrac = oppTheo - (topCard.getNumber() - 60) + GetNotSkippedCards(true, cardTracker.cardsPlacedByMe, topCard);
}
}
}
value = weightOwn * (ownTheo - ownPrac) + weightOpp * (oppPrac - oppTheo);
//PrintStackValueCalc(potentialGameState, weightOwn, weightOpp);
}
private void PrintStackValueCalc(GameState potentialGameState, float weightOwn, float weightOpp)
{
System.out.println("\nHand cards: " + potentialGameState.getHandCards());
System.out.println("IsMine: " + isMine + " | IsAscending: " + isAscending);
System.out.println("Stack value calc: " + weightOwn + " * (" + ownTheo + "-" + ownPrac + ") + " + weightOpp + " * ( " + oppPrac + " - " + oppTheo + " ) " + " = " + value);
}
}
......@@ -10,12 +10,24 @@ public class CardTracker {
public List<Card> cardsPlacedByMe = new ArrayList<Card>();
public List<Card> cardsPlacedByOp = new ArrayList<Card>();
public CardTracker()
{
}
public CardTracker(CardTracker cardTracker)
{
this.cardsPlacedByMe = new ArrayList<Card>(cardTracker.cardsPlacedByMe);
this.cardsPlacedByOp = new ArrayList<Card>(cardTracker.cardsPlacedByOp);
}
public void TrackPlacedCardsByMe(List<Placement> placementsOfMove)
{
for (Placement placement : placementsOfMove)
{
cardsPlacedByMe.add(placement.getCard());
}
int i = 3;
}
public void TrackPlacedCardsByOp(List<ExtendedPlacement> placementsOfMove)
......@@ -24,6 +36,7 @@ public class CardTracker {
{
cardsPlacedByOp.add(placement.getCard());
}
int i = 3;
}
public void PrintTrackedCards()
......
package util.Extensions;
import de.upb.isml.thegamef2f.engine.GameState;
import de.upb.isml.thegamef2f.engine.board.Card;
public class GameValue {
private StackValue ownAsc = new StackValue(true, true);
private StackValue ownDes = new StackValue(true, false);
private StackValue oppAsc = new StackValue(false, true);
private StackValue oppDes = new StackValue(false, false);
private LoggingSystem logger;
private StackValue ownAsc;
private StackValue ownDes;
private StackValue oppAsc;
private StackValue oppDes;
private float gameValue = 0.0f;
private float weightOwn = 1.0f;
private float weightOpp = 0.2f;
public void SetWeights(float weightOwn, float weightOpp)
{
this.weightOwn = weightOwn;
this.weightOpp = weightOpp;
}
public GameValue(LoggingSystem logger)
{
this.logger = logger;
ownAsc = new StackValue(true, true, logger);
ownDes = new StackValue(true, false, logger);
oppAsc = new StackValue(false, true, logger);
oppDes = new StackValue(false, false, logger);
}
public float calcGameValue(GameState potentialGameState, CardTracker cardTracker)
{
logger.Log("\nHand cards: " + potentialGameState.getHandCards());
logger.Log("OwnAsc: " + potentialGameState.getTopCardOnOwnAscendingDiscardPile());
logger.Log("OwnDes: " + potentialGameState.getTopCardOnOwnDescendingDiscardPile());
logger.Log("OppAsc: " + potentialGameState.getTopCardOnOpponentsAscendingDiscardPile());
logger.Log("OppDes: " + potentialGameState.getTopCardOnOpponentsDescendingDiscardPile() + "\n");
ownAsc.calcValues(potentialGameState, cardTracker, weightOwn, weightOpp);
ownDes.calcValues(potentialGameState, cardTracker, weightOwn, weightOpp);
oppAsc.calcValues(potentialGameState, cardTracker, weightOwn, weightOpp);
oppDes.calcValues(potentialGameState, cardTracker, weightOwn, weightOpp);
System.out.println("\nOwnAsc: " + potentialGameState.getTopCardOnOwnAscendingDiscardPile());
System.out.println("OwnDes: " + potentialGameState.getTopCardOnOwnDescendingDiscardPile());
System.out.println("OppAsc: " + potentialGameState.getTopCardOnOpponentsAscendingDiscardPile());
System.out.println("OppDes: " + potentialGameState.getTopCardOnOpponentsDescendingDiscardPile());
System.out.println("___________________________________________________");
gameValue = ownAsc.GetValue() + ownDes.GetValue() - oppAsc.GetValue() - oppDes.GetValue();
return gameValue;
}
public void updateStackValue(CardTracker cardTracker, Card topCardOwnAsc, Card topCardOwnDes, Card topCardOppAsc, Card topCardOppDes)
{
logger.Log("GameValue: " + gameValue);
logger.Log("___________________________________________________");
return gameValue;
}
public void setWeightOwn(float weight)
......
package util.Extensions;
public class LoggingSystem {
boolean isDebug = true;
public LoggingSystem(boolean mode)
{
isDebug = mode;
}
public void SetDebugMode(boolean mode)
{
isDebug = mode;
}