src/main/java/ru/alphatech/icfpc/cards/Copy.java
author akhmetovlz
Sun, 19 Jun 2011 13:36:05 +0400
changeset 52 eea6fcf60b73
parent 35 743564afa994
child 68 a84a3c755d93
permissions -rw-r--r--
(no commit message)
     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 Copy implements ICard
     9 {
    10 	@Override
    11 	public IValue returnValue(IValue i, Player proponent, Player opponent)
    12 	{
    13 		if (i.getClass().equals(Value.class))
    14 		{
    15 			int iVal = ((Value)i).getValue();
    16 			if (iVal >= 0 && iVal < 256)
    17 			{
    18 				return opponent.getSlot(((Value)i).getValue()).getValue();
    19 			}
    20 			else
    21 			{
    22 				throw new ICFPCException();
    23 			}
    24 		}
    25 		else
    26 		{
    27 			throw new ICFPCException();
    28 		}
    29 
    30 	}
    31 }