| author | Azamat S. Kalimoulline <turtle@bazon.ru> |
| Sun, 19 Jun 2011 19:14:45 +0400 | |
| changeset 105 | 57368a3d0b15 |
| parent 99 | 60187fe9405d |
| child 106 | 643b85a8a16b |
| permissions | -rw-r--r-- |
| turtle@12 | 1 |
package ru.alphatech.icfpc.game; |
| 0-range@4 | 2 |
|
| indvdum@99 | 3 |
import ru.alphatech.icfpc.cards.I; |
| indvdum@99 | 4 |
|
| akhmetovlz@17 | 5 |
|
| 0-range@4 | 6 |
|
| turtle@11 | 7 |
public class Player |
| 0-range@4 | 8 |
{
|
| turtle@28 | 9 |
private Slot[] slots = new Slot[256]; |
| indvdum@99 | 10 |
private Player myOpponent = null; |
| indvdum@99 | 11 |
|
| turtle@28 | 12 |
public Player() |
| turtle@28 | 13 |
{
|
| turtle@28 | 14 |
for(int i = 0; i < 255; i++) |
| turtle@28 | 15 |
{
|
| indvdum@80 | 16 |
slots[i] = new Slot(i); |
| turtle@28 | 17 |
} |
| turtle@28 | 18 |
} |
| turtle@28 | 19 |
|
| indvdum@99 | 20 |
public Player getMyOpponent() {
|
| indvdum@99 | 21 |
return myOpponent; |
| indvdum@99 | 22 |
} |
| indvdum@99 | 23 |
|
| indvdum@99 | 24 |
public void setMyOpponent(Player myOpponent) {
|
| indvdum@99 | 25 |
this.myOpponent = myOpponent; |
| indvdum@99 | 26 |
} |
| indvdum@99 | 27 |
|
| turtle@11 | 28 |
public Slot getSlot(int i) |
| turtle@11 | 29 |
{
|
| turtle@28 | 30 |
return slots[i]; |
| turtle@11 | 31 |
} |
| akhmetovlz@17 | 32 |
|
| akhmetovlz@19 | 33 |
public PlayerStatistic getStatistic(){
|
| akhmetovlz@19 | 34 |
throw new RuntimeException("Not impilemented yet.");
|
| akhmetovlz@19 | 35 |
} |
| akhmetovlz@30 | 36 |
|
| indvdum@90 | 37 |
public void applyBatch(Batch batch){
|
| indvdum@99 | 38 |
switch(batch.operationType){
|
| indvdum@99 | 39 |
case CARD_TO_SLOT: |
| indvdum@99 | 40 |
batch.card.returnValue(getSlot(batch.slot.getId()).getValue(), this, myOpponent); |
| indvdum@99 | 41 |
break; |
| indvdum@99 | 42 |
case SLOT_TO_CARD: |
| indvdum@99 | 43 |
getSlot(batch.slot.getId()).getValue().returnValue(batch.card, this, myOpponent); |
| indvdum@99 | 44 |
break; |
| indvdum@99 | 45 |
} |
| indvdum@90 | 46 |
} |
| akhmetovlz@30 | 47 |
|
| 0-range@4 | 48 |
} |