src/main/java/ru/alphatech/icfpc/cards/Get.java
author akhmetovlz
Sun, 19 Jun 2011 14:29:07 +0400
changeset 62 3252fb664a39
parent 49 2c94d860cd24
child 64 8ce8964b584f
permissions -rw-r--r--
Мего метод.
     1 package ru.alphatech.icfpc.cards;
     2 
     3 import ru.alphatech.icfpc.game.ICFPCException;
     4 import ru.alphatech.icfpc.game.IValue;
     5 import ru.alphatech.icfpc.game.Player;
     6 import ru.alphatech.icfpc.game.Value;
     7 
     8 public class Get implements ICard
     9 {
    10 	@Override
    11 	public IValue returnValue(IValue value, Player proponent, Player opponent)
    12 	{
    13 		if (value.getClass().equals(Value.class))
    14 		{
    15 			int i =  ((Value)value).getValue();
    16 			
    17 			if(i >= 0 && i <= 255)
    18 			{
    19 				return proponent.getSlot(i).getValue();
    20 			}
    21 			else
    22 			{
    23 				throw new ICFPCException();
    24 			}
    25 		}
    26 		else
    27 		{
    28 			throw new ICFPCException();
    29 		}
    30 	}
    31 
    32 }