src/main/java/ru/alphatech/icfpc/game/Player.java
changeset 99 60187fe9405d
parent 96 8c40512777a1
child 106 643b85a8a16b
equal deleted inserted replaced
96:8c40512777a1 99:60187fe9405d
     1 package ru.alphatech.icfpc.game;
     1 package ru.alphatech.icfpc.game;
       
     2 
       
     3 import ru.alphatech.icfpc.cards.I;
     2 
     4 
     3 
     5 
     4 
     6 
     5 public class Player
     7 public class Player
     6 {
     8 {
     7 	private Slot[] slots = new Slot[256];
     9 	private Slot[] slots = new Slot[256];
     8 	
    10 	private Player myOpponent = null;
       
    11 
     9 	public Player()
    12 	public Player()
    10     {
    13     {
    11 		for(int i = 0; i < 255; i++)
    14 		for(int i = 0; i < 255; i++)
    12 		{
    15 		{
    13 			slots[i] = new Slot(i);
    16 			slots[i] = new Slot(i);
    14 		}
    17 		}
    15     }
    18     }
       
    19 	
       
    20 	public Player getMyOpponent() {
       
    21 		return myOpponent;
       
    22 	}
       
    23 	
       
    24 	public void setMyOpponent(Player myOpponent) {
       
    25 		this.myOpponent = myOpponent;
       
    26 	}
    16 	
    27 	
    17 	public Slot getSlot(int i)
    28 	public Slot getSlot(int i)
    18 	{
    29 	{
    19 		return slots[i];
    30 		return slots[i];
    20 	}
    31 	}
    22 	public PlayerStatistic getStatistic(){
    33 	public PlayerStatistic getStatistic(){
    23 		throw new RuntimeException("Not impilemented yet.");
    34 		throw new RuntimeException("Not impilemented yet.");
    24 	}
    35 	}
    25 	
    36 	
    26 	public void applyBatch(Batch batch){
    37 	public void applyBatch(Batch batch){
    27 		
    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 		}
    28 	}
    46 	}
    29 	
    47 	
    30 }
    48 }