This repository has been archived by the owner on Jun 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit, finally porting the project to GitHub
- Loading branch information
0 parents
commit 5552af5
Showing
20 changed files
with
1,577 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
/out/ | ||
/lib/ | ||
/.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_15"> | ||
<output url="file://$MODULE_DIR$/target/classes" /> | ||
<output-test url="file://$MODULE_DIR$/target/test-classes" /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" /> | ||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" /> | ||
<excludeFolder url="file://$MODULE_DIR$/.idea" /> | ||
<excludeFolder url="file://$MODULE_DIR$/target" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="org.processing:core:3.3.7" level="project" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Domineering AI | ||
|
||
The game [domineering](https://en.wikipedia.org/wiki/Domineering) has very few rules and is therefore easy to learn. | ||
However, the strategies which evolve can be more complex than one might think at first glance. | ||
|
||
Domineering can be played on a chess board in any rectangular shape, increasing the complexity with the overall size of | ||
the board. Two players, here called "V" for vertical and "H" for horizontal, each place a domino pieces onto the board. | ||
The pieces may not overlap each other and can only be placed fully on the board. | ||
|
||
The first player who is unable to legally place another piece has lost the game. | ||
|
||
To compute the winning strategy for the game, one has to compute a score for the possible board configurations which | ||
result in the currently possible moves, the player could make. Because the number of possible moves and board | ||
configurations eventually rises exponentially with bigger boards, we need a good strategy to sort out bad moves quickly. | ||
|
||
For this AI, I chose to use a combination of a min-max-algorithm with alpha-beta-pruning. For move ordering, I based my | ||
board scoring and move evaluation algorithm on methods for move counting and scanning from Nathan Bullocks master thesis. | ||
|
||
Depending on how long the AI is allowed to "think" about the next move, the "depthForBoardState" function should be | ||
altered. It is responsible for evaluating the search depth, aka. the number of next moves, the ai should take into | ||
consideration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>groupId</groupId> | ||
<artifactId>DomineeringAI</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
|
||
<properties> | ||
<maven.compiler.source>15</maven.compiler.source> | ||
<maven.compiler.target>15</maven.compiler.target> | ||
</properties> | ||
|
||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package ai; | ||
|
||
public abstract class AI { | ||
public abstract Coordinate playMove(char[][] board, Player player); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package ai; | ||
|
||
public abstract class Area { | ||
protected final Coordinate cornerUL; // "upper-left"-corner | ||
protected final Coordinate cornerLR; // "lower-right"-corner | ||
|
||
public Area(int startX, int startY, int endX, int endY) { | ||
cornerUL = new Coordinate(startX, startY); | ||
cornerLR = new Coordinate(endX, endY); | ||
} | ||
|
||
public Coordinate getCornerUL() { | ||
return cornerUL; | ||
} | ||
|
||
public Coordinate getCornerLR() { | ||
return cornerLR; | ||
} | ||
|
||
// return true if the given point is not contained in the area | ||
public boolean contains(int x, int y) { | ||
return x >= cornerLR.getX() && x <= cornerLR.getX() && y >= cornerUL.getY() && y <= cornerLR.getY(); | ||
} | ||
} |
Oops, something went wrong.