# HG changeset patch # User akhmetovlz # Date 1308411617 -14400 # Node ID 624552552ae77fc836ac18b597b839a695445e60 # Parent 37d36410db782fae6071edbcfbd7c2f343d9f5a2 by akhmetovlz diff -r 37d36410db78 -r 624552552ae7 src/main/java/ru/alphatech/icfpc/game/Player.java --- a/src/main/java/ru/alphatech/icfpc/game/Player.java Sat Jun 18 15:31:12 2011 +0400 +++ b/src/main/java/ru/alphatech/icfpc/game/Player.java Sat Jun 18 19:40:17 2011 +0400 @@ -17,4 +17,8 @@ public void applySlotToCard(Slot slot, ICard card){ throw new RuntimeException("Not impilemented yet."); } + + public PlayerStatistic getStatistic(){ + throw new RuntimeException("Not impilemented yet."); + } } diff -r 37d36410db78 -r 624552552ae7 src/main/java/ru/alphatech/icfpc/policy/AbstractPolicy.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/ru/alphatech/icfpc/policy/AbstractPolicy.java Sat Jun 18 19:40:17 2011 +0400 @@ -0,0 +1,35 @@ +package ru.alphatech.icfpc.policy; + +import ru.alphatech.icfpc.game.Player; + +public abstract class AbstractPolicy { + + protected Player player = null; + + private int turnCount = 0; + private int turnCurrent = 0; + + public AbstractPolicy(int turnCount, Player player){ + this.player = player; + this.turnCount = turnCount; + this.turnCurrent = 0; + } + + public int getCurrentTurns() { + return turnCurrent; + } + + public int getTurnsCount(){ + return turnCount; + } + + public boolean next(){ + if( turnCurrent < turnCount ){ + turnCurrent++; + return true; + } + return false; + } + + +} diff -r 37d36410db78 -r 624552552ae7 src/main/java/ru/alphatech/icfpc/policy/VitalityBoostPolicy.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/ru/alphatech/icfpc/policy/VitalityBoostPolicy.java Sat Jun 18 19:40:17 2011 +0400 @@ -0,0 +1,55 @@ +package ru.alphatech.icfpc.policy; + +import ru.alphatech.icfpc.cards.Dbl; +import ru.alphatech.icfpc.cards.Succ; +import ru.alphatech.icfpc.cards.Zero; +import ru.alphatech.icfpc.game.Player; + +public class VitalityBoostPolicy extends AbstractPolicy { + + public static final int turnsCount = 100; + + public VitalityBoostPolicy(int targetSlot, Player player) { + super(turnsCount, player); + this.targetSlot = targetSlot; + + maxValueSlotNum = player.getStatistic().maxValueSlotNum; + maxValue = player.getStatistic().maxValue; + firstIdentitySlot = -1; + } + + protected int targetSlot = -1; + protected int maxValueSlotNum = -1; + protected int maxValue = -1; + protected int firstIdentitySlot = -1; + + public boolean next() { + if ( super.next() ){ + + switch (getCurrentTurns()) { + case 0: + player.applySlotToCard(player.getSlot(firstIdentitySlot), ); + break; + case 1: + case 2: + player.applyCardToSlot(new Succ(), player.getSlot(incValueSlotNum)); + break; + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + player.applyCardToSlot(new Dbl(), player.getSlot(incValueSlotNum)); + break; + case 11: + break; + } + + } + return false; + } + +}