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 Copy implements ICard |
8 public class Copy implements ICard |
9 @Override |
10 @Override |
10 public IValue returnValue(IValue i, Player proponent, Player opponent) |
11 public IValue returnValue(IValue i, Player proponent, Player opponent) |
11 { |
12 { |
12 if (i.getClass().equals(Value.class)) |
13 if (i.getClass().equals(Value.class)) |
13 { |
14 { |
14 return opponent.getSlot(((Value)i).getValue()).getValue(); |
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(); |
15 } |
28 } |
16 |
29 |
17 return null; |
|
18 } |
30 } |
19 } |
31 } |