mirror of
https://github.com/correl/mage.git
synced 2024-12-24 03:00:14 +00:00
[refactor] removed generic parameter from Player
This commit is contained in:
parent
99854be1fb
commit
1867a150c1
12 changed files with 15 additions and 23 deletions
|
@ -38,7 +38,7 @@ import mage.players.Player;
|
|||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class ComputerDraftPlayer extends ComputerPlayer<ComputerDraftPlayer> implements Player {
|
||||
public class ComputerDraftPlayer extends ComputerPlayer implements Player {
|
||||
|
||||
public ComputerDraftPlayer(String name, RangeOfInfluence range) {
|
||||
super(name, range);
|
||||
|
|
|
@ -68,7 +68,7 @@ import mage.player.ai.ma.optimizers.impl.OutcomeOptimizer;
|
|||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class ComputerPlayer6 extends ComputerPlayer<ComputerPlayer6> implements Player {
|
||||
public class ComputerPlayer6 extends ComputerPlayer implements Player {
|
||||
|
||||
private static final transient org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(ComputerPlayer6.class);
|
||||
private static final ExecutorService pool = Executors.newFixedThreadPool(1);
|
||||
|
|
|
@ -59,7 +59,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class SimulatedPlayer2 extends ComputerPlayer<SimulatedPlayer2> {
|
||||
public class SimulatedPlayer2 extends ComputerPlayer {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(SimulatedPlayer2.class);
|
||||
private final boolean isSimulatedPlayer;
|
||||
|
|
|
@ -91,9 +91,8 @@ import mage.cards.repository.ExpansionRepository;
|
|||
* suitable for two player games and some multiplayer games
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
* @param <T>
|
||||
*/
|
||||
public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> implements Player {
|
||||
public class ComputerPlayer extends PlayerImpl implements Player {
|
||||
|
||||
private transient final static Logger log = Logger.getLogger(ComputerPlayer.class);
|
||||
private transient Map<Mana, Card> unplayable = new TreeMap<>();
|
||||
|
@ -1962,8 +1961,8 @@ public class ComputerPlayer<T extends ComputerPlayer<T>> extends PlayerImpl<T> i
|
|||
|
||||
|
||||
@Override
|
||||
public T copy() {
|
||||
return (T)new ComputerPlayer(this);
|
||||
public ComputerPlayer copy() {
|
||||
return new ComputerPlayer(this);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ import java.util.concurrent.Executors;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class ComputerPlayerMCTS extends ComputerPlayer<ComputerPlayerMCTS> implements Player {
|
||||
public class ComputerPlayerMCTS extends ComputerPlayer implements Player {
|
||||
|
||||
private static final int THINK_MIN_RATIO = 40;
|
||||
private static final int THINK_MAX_RATIO = 100;
|
||||
|
|
|
@ -43,7 +43,7 @@ import java.util.UUID;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class MCTSPlayer extends ComputerPlayer<MCTSPlayer> {
|
||||
public class MCTSPlayer extends ComputerPlayer {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(MCTSPlayer.class);
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ import java.util.concurrent.*;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class ComputerPlayer2 extends ComputerPlayer<ComputerPlayer2> implements Player {
|
||||
public class ComputerPlayer2 extends ComputerPlayer implements Player {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(ComputerPlayer2.class);
|
||||
private static final transient ExecutorService pool = Executors.newFixedThreadPool(1);
|
||||
|
|
|
@ -49,7 +49,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class SimulatedPlayer extends ComputerPlayer<SimulatedPlayer> {
|
||||
public class SimulatedPlayer extends ComputerPlayer {
|
||||
|
||||
private static final transient Logger logger = Logger.getLogger(SimulatedPlayer.class);
|
||||
private boolean isSimulatedPlayer;
|
||||
|
|
|
@ -94,7 +94,7 @@ import org.apache.log4j.Logger;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class HumanPlayer extends PlayerImpl<HumanPlayer> {
|
||||
public class HumanPlayer extends PlayerImpl {
|
||||
|
||||
private final transient PlayerResponse response = new PlayerResponse();
|
||||
|
||||
|
|
|
@ -54,7 +54,7 @@ import java.util.*;
|
|||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class RandomPlayer extends ComputerPlayer<RandomPlayer> {
|
||||
public class RandomPlayer extends ComputerPlayer {
|
||||
|
||||
private boolean isSimulatedPlayer;
|
||||
private static Random rnd = new Random();
|
||||
|
|
|
@ -66,7 +66,7 @@ import mage.game.stack.StackObject;
|
|||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
@Ignore
|
||||
public class TestPlayer extends ComputerPlayer<TestPlayer> {
|
||||
public class TestPlayer extends ComputerPlayer {
|
||||
|
||||
private final List<PlayerAction> actions = new ArrayList<>();
|
||||
private final List<String> choices = new ArrayList<>();
|
||||
|
|
|
@ -116,11 +116,7 @@ import mage.target.common.TargetDiscard;
|
|||
import mage.watchers.common.BloodthirstWatcher;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param <T>
|
||||
*/
|
||||
public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Serializable {
|
||||
public abstract class PlayerImpl implements Player, Serializable {
|
||||
|
||||
private static final transient Logger log = Logger.getLogger(PlayerImpl.class);
|
||||
|
||||
|
@ -197,9 +193,6 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
|
||||
protected UserData userData;
|
||||
|
||||
@Override
|
||||
public abstract T copy();
|
||||
|
||||
public PlayerImpl(String name, RangeOfInfluence range) {
|
||||
this(UUID.randomUUID());
|
||||
this.name = name;
|
||||
|
@ -217,7 +210,7 @@ public abstract class PlayerImpl<T extends PlayerImpl<T>> implements Player, Ser
|
|||
this.playerId = id;
|
||||
}
|
||||
|
||||
public PlayerImpl(final PlayerImpl<T> player) {
|
||||
public PlayerImpl(final PlayerImpl player) {
|
||||
this.abort = player.abort;
|
||||
this.playerId = player.playerId;
|
||||
|
||||
|
|
Loading…
Reference in a new issue