-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #289 from lrozenblyum/ThinkFor2Plies-235
Think for 2 plies #235
- Loading branch information
Showing
50 changed files
with
1,131 additions
and
280 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
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
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
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
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
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
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,19 @@ | ||
package com.leokom.chess.engine; | ||
|
||
import java.util.Set; | ||
|
||
/** | ||
* The notion of game state is very generic and can be extracted to something chess-independent | ||
* @param <T> type of transitions | ||
* @param <S> current type (state) | ||
*/ | ||
/* | ||
Rather complex recursive generic to S class is introduced in order to support return of exactly | ||
our class in the move method. | ||
Inspired by https://www.sitepoint.com/self-types-with-javas-generics/ | ||
*/ | ||
public interface GameState< T extends GameTransition, S extends GameState<T, S> > { | ||
S move(T move); | ||
|
||
Set<T> getMoves(); | ||
} |
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,9 @@ | ||
package com.leokom.chess.engine; | ||
|
||
/** | ||
* The notion of game transition is an attempt to represent the game | ||
* as a state automate. | ||
* This notion is so generic that can be extracted to something chess-independent | ||
*/ | ||
public interface GameTransition { | ||
} |
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
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
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
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
25 changes: 25 additions & 0 deletions
25
src/main/java/com/leokom/chess/player/legal/LegalPlayerSupplier.java
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,25 @@ | ||
package com.leokom.chess.player.legal; | ||
|
||
import com.leokom.chess.player.Player; | ||
import com.leokom.chess.player.legal.brain.normalized.MasterEvaluator; | ||
import com.leokom.chess.player.legal.brain.normalized.NormalizedBrain; | ||
|
||
import java.util.function.Supplier; | ||
|
||
public class LegalPlayerSupplier implements Supplier<Player> { | ||
//this depth has been used for years | ||
private static final int DEFAULT_DEPTH = 1; | ||
private final int depth; | ||
|
||
public LegalPlayerSupplier() { | ||
this(DEFAULT_DEPTH); | ||
} | ||
|
||
public LegalPlayerSupplier( int depth ) { | ||
this.depth = depth; | ||
} | ||
|
||
public Player get() { | ||
return new LegalPlayer( new NormalizedBrain<>( new MasterEvaluator(), depth ) ); | ||
} | ||
} |
Oops, something went wrong.