mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 02:30:08 -08:00
AI: removed outdated AIMinimax project (#7075), removed some useless player classes, code and config files, improved docs;
This commit is contained in:
parent
6ac2f44cc1
commit
08b99fcbf7
40 changed files with 103 additions and 2462 deletions
|
|
@ -1,7 +0,0 @@
|
|||
maxDepth=10
|
||||
maxNodes=5000
|
||||
evaluatorLifeFactor=2
|
||||
evaluatorPermanentFactor=1
|
||||
evaluatorCreatureFactor=1
|
||||
evaluatorHandFactor=1
|
||||
maxThinkSeconds=10
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
<artifactId>mage-player-ai-ma</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>Mage Player AI.MA</name>
|
||||
<name>Mage Player AI (mad bot)</name>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -41,12 +41,18 @@ import java.util.concurrent.*;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* AI: server side bot with game simulations (mad bot, part of implementation)
|
||||
*
|
||||
* @author nantuko
|
||||
*/
|
||||
public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
||||
public class ComputerPlayer6 extends ComputerPlayer {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(ComputerPlayer6.class);
|
||||
|
||||
// TODO: add and research maxNodes logs, is it good to increase to 50000 for better results?
|
||||
// TODO: increase maxNodes due AI skill level?
|
||||
private static final int MAX_SIMULATED_NODES_PER_CALC = 5000;
|
||||
|
||||
// same params as Executors.newFixedThreadPool
|
||||
// no needs erorrs check in afterExecute here cause that pool used for FutureTask with result check already
|
||||
private static final ExecutorService threadPoolSimulations = new ThreadPoolExecutor(
|
||||
|
|
@ -97,7 +103,7 @@ public class ComputerPlayer6 extends ComputerPlayer /*implements Player*/ {
|
|||
maxDepth = skill;
|
||||
}
|
||||
maxThink = skill * 3;
|
||||
maxNodes = Config2.maxNodes;
|
||||
maxNodes = MAX_SIMULATED_NODES_PER_CALC;
|
||||
getSuggestedActions();
|
||||
this.actionCache = new HashSet<>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,8 @@ import java.util.Date;
|
|||
import java.util.LinkedList;
|
||||
|
||||
/**
|
||||
* AI: server side bot with game simulations (mad bot, the latest version)
|
||||
*
|
||||
* @author ayratn
|
||||
*/
|
||||
public class ComputerPlayer7 extends ComputerPlayer6 {
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
|
||||
|
||||
package mage.player.ai;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public final class Config2 {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(Config2.class);
|
||||
|
||||
// public static final int maxDepth;
|
||||
public static final int maxNodes;
|
||||
public static final int evaluatorLifeFactor;
|
||||
public static final int evaluatorPermanentFactor;
|
||||
public static final int evaluatorCreatureFactor;
|
||||
public static final int evaluatorHandFactor;
|
||||
// public static final int maxThinkSeconds;
|
||||
|
||||
static {
|
||||
Properties p = new Properties();
|
||||
try {
|
||||
File file = new File(Config2.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath());
|
||||
File propertiesFile = new File(file.getParent() + File.separator + "AIMinimax.properties");
|
||||
if (propertiesFile.exists()) {
|
||||
p.load(new FileInputStream(propertiesFile));
|
||||
} else {
|
||||
// p.setProperty("maxDepth", "10");
|
||||
p.setProperty("maxNodes", "50000");
|
||||
p.setProperty("evaluatorLifeFactor", "2");
|
||||
p.setProperty("evaluatorPermanentFactor", "1");
|
||||
p.setProperty("evaluatorCreatureFactor", "1");
|
||||
p.setProperty("evaluatorHandFactor", "1");
|
||||
// p.setProperty("maxThinkSeconds", "30");
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
logger.error(null, ex);
|
||||
} catch (URISyntaxException ex) {
|
||||
logger.error(null, ex);
|
||||
}
|
||||
// maxDepth = Integer.parseInt(p.getProperty("maxDepth"));
|
||||
maxNodes = Integer.parseInt(p.getProperty("maxNodes"));
|
||||
evaluatorLifeFactor = Integer.parseInt(p.getProperty("evaluatorLifeFactor"));
|
||||
evaluatorPermanentFactor = Integer.parseInt(p.getProperty("evaluatorPermanentFactor"));
|
||||
evaluatorCreatureFactor = Integer.parseInt(p.getProperty("evaluatorCreatureFactor"));
|
||||
evaluatorHandFactor = Integer.parseInt(p.getProperty("evaluatorHandFactor"));
|
||||
// maxThinkSeconds = Integer.parseInt(p.getProperty("maxThinkSeconds"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -27,11 +27,11 @@ import java.util.*;
|
|||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
|
||||
/**
|
||||
* AI: mock player in simulated games (each player replaced by simulated)
|
||||
* AI: helper class to simulate games with computer bot (each player replaced by simulated)
|
||||
*
|
||||
* @author BetaSteward_at_googlemail.com
|
||||
*/
|
||||
public class SimulatedPlayer2 extends ComputerPlayer {
|
||||
public final class SimulatedPlayer2 extends ComputerPlayer {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(SimulatedPlayer2.class);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue