src/main/java/ru/alphatech/icfpc/cards/Copy.java
changeset 72 51bfc33c0566
parent 68 a84a3c755d93
child 74 b277f6c31f5f
equal deleted inserted replaced
71:497185ce6691 72:51bfc33c0566
     6 import ru.alphatech.icfpc.game.Value;
     6 import ru.alphatech.icfpc.game.Value;
     7 
     7 
     8 public class Copy implements ICard
     8 public class Copy implements ICard
     9 {
     9 {
    10 	@Override
    10 	@Override
    11 	public IValue returnValue(IValue i, Player proponent, Player opponent)
    11 	public IValue returnValue(IValue iobj, Player proponent, Player opponent)
    12 	{
    12 	{
    13 		if (i.getClass().equals(Value.class))
    13 		if (iobj instanceof Value)
    14 		{
    14 		{
    15 			int iVal = ((Value)i).getValue();
    15 			int i = ((Value)iobj).getValue();
    16 			if (iVal >= 0 && iVal < 256)
    16 
       
    17 			if (i >= 0 && i <= 255)
    17 			{
    18 			{
    18 				return opponent.getSlot(((Value)i).getValue()).getValue();
    19 				return opponent.getSlot(i).getValue();
    19 			}
    20 			}
    20 			else
    21 			else
    21 			{
    22 			{
    22 				throw new ICFPCException();
    23 				throw new ICFPCException();
    23 			}
    24 			}