src/main/java/ru/alphatech/icfpc/cards/Succ.java
author akhmetovlz
Sun, 19 Jun 2011 14:35:19 +0400
changeset 67 e2df2fbc6e8e
parent 64 8ce8964b584f
child 74 b277f6c31f5f
permissions -rw-r--r--
Merge with 2c8b98d4efb84d73c56c1e57196ba8598136aeeb
     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 Succ implements ICard
     9 {
    10 	@Override
    11 	public IValue returnValue(IValue nobj, Player proponent, Player opponent)
    12 	{
    13 		if(nobj instanceof Value)
    14 		{
    15 			int n = ((Value)nobj).getValue();
    16 
    17 			if (n == 65535)
    18 			{
    19 				return new Value(65535);
    20 			}
    21 			else
    22 			{
    23 				return new Value(n + 1);
    24 			}
    25 		}
    26 		else
    27 		{
    28 			throw new ICFPCException();
    29 		}
    30 	}
    31 }