equal
deleted
inserted
replaced
1 package ru.alphatech.icfpc.cards; |
1 package ru.alphatech.icfpc.cards; |
2 |
2 |
|
3 import ru.alphatech.icfpc.game.ICFPCException; |
3 import ru.alphatech.icfpc.game.IValue; |
4 import ru.alphatech.icfpc.game.IValue; |
4 import ru.alphatech.icfpc.game.Player; |
5 import ru.alphatech.icfpc.game.Player; |
5 import ru.alphatech.icfpc.game.Value; |
6 import ru.alphatech.icfpc.game.Value; |
6 |
7 |
7 public class Dbl implements ICard |
8 public class Dbl implements ICard |
9 @Override |
10 @Override |
10 public IValue returnValue(IValue value, Player proponent, Player opponent) |
11 public IValue returnValue(IValue value, Player proponent, Player opponent) |
11 { |
12 { |
12 if(value.getClass().equals(Value.class)) |
13 if(value.getClass().equals(Value.class)) |
13 { |
14 { |
14 if (((Value)value).getValue() * 2 >= 65535) |
15 int n = ((Value)value).getValue(); |
|
16 |
|
17 if(n < 32768) |
|
18 { |
|
19 return new Value(n * 2); |
|
20 } |
|
21 else |
15 { |
22 { |
16 return new Value(65535); |
23 return new Value(65535); |
17 } |
24 } |
18 return new Value(((Value)value).getValue() * 2); |
|
19 } |
25 } |
20 |
26 else |
21 return new Value(-100); |
27 { |
|
28 throw new ICFPCException(); |
|
29 } |
22 } |
30 } |
23 } |
31 } |