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