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 Get implements ICard |
8 public class Get 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 return proponent.getSlot(((Value)value).getValue()).getValue(); |
15 int i = ((Value)value).getValue(); |
|
16 |
|
17 if(i >= 0 && i <= 255) |
|
18 { |
|
19 return proponent.getSlot(i).getValue(); |
|
20 } |
|
21 else |
|
22 { |
|
23 throw new ICFPCException(); |
|
24 } |
15 } |
25 } |
16 else |
26 else |
17 { |
27 { |
18 return new Value(-100); |
28 throw new ICFPCException(); |
19 } |
29 } |
20 } |
30 } |
21 |
31 |
22 } |
32 } |