src/main/java/ru/alphatech/icfpc/cards/Dbl.java
author Azamat S. Kalimoulline <turtle@bazon.ru>
Sun, 19 Jun 2011 13:41:13 +0400
changeset 57 4a82118416bd
parent 45 f8281a814079
child 64 8ce8964b584f
permissions -rw-r--r--
cards K and S.
     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 Dbl 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 n = ((Value)value).getValue();
    16 			
    17 			if(n < 32768)
    18 			{
    19 				return new Value(n * 2);
    20 			}
    21 			else
    22 			{
    23 				return new Value(65535);
    24 			}
    25 		}
    26 		else
    27 		{
    28 			throw new ICFPCException();
    29 		}
    30 	}
    31 }