Search in sources :

Example 1 with ShogiPosition

use of com.playshogi.library.shogi.models.position.ShogiPosition in project playshogi by Tellmarch.

the class KifFormatTest method readOnlyPositionDokoro.

@Test
public void readOnlyPositionDokoro() {
    ShogiPosition pos = KifFormat.INSTANCE.readPosition(KIF_ONLY_POSITION_DOKORO);
    assertEquals("lnsgkgsnl/1r5+B1/pppppp1pp/6p2/9/2P6/PP1PPPPPP/7R1/LNSGKGSNL w B", SfenConverter.toSFEN(pos));
}
Also used : ShogiPosition(com.playshogi.library.shogi.models.position.ShogiPosition) Test(org.junit.Test)

Example 2 with ShogiPosition

use of com.playshogi.library.shogi.models.position.ShogiPosition in project playshogi by Tellmarch.

the class SfenConverterTest method testFromSFENAndToSFENWithMoveCount.

@Test
public void testFromSFENAndToSFENWithMoveCount() {
    ShogiPosition position = SfenConverter.fromSFEN(sfen);
    assertEquals(sfenWithMoveCount, SfenConverter.toSFENWithMoveCount(position));
}
Also used : ShogiPosition(com.playshogi.library.shogi.models.position.ShogiPosition) Test(org.junit.Test)

Example 3 with ShogiPosition

use of com.playshogi.library.shogi.models.position.ShogiPosition in project playshogi by Tellmarch.

the class SfenConverterTest method testFromSFENAndToSFEN.

@Test
public void testFromSFENAndToSFEN() {
    ShogiPosition position = SfenConverter.fromSFEN(sfen);
    assertEquals(sfen, SfenConverter.toSFEN(position));
}
Also used : ShogiPosition(com.playshogi.library.shogi.models.position.ShogiPosition) Test(org.junit.Test)

Example 4 with ShogiPosition

use of com.playshogi.library.shogi.models.position.ShogiPosition in project playshogi by Tellmarch.

the class ShogiRulesEngineTest method getAllPossibleDropMovesForSente.

@Test
public void getAllPossibleDropMovesForSente() {
    String sfen = "lnsg3nl/2k2gr2/ppbp1p1pp/2p1P4/4s1S2/5B3/PPPP1P1PP/2S1GGR2/LN4KNL b 2Pp";
    ShogiPosition position = SfenConverter.fromSFEN(sfen);
    List<ShogiMove> allPossibleDropMoves = engine.getAllPossibleDropMoves(position, Player.BLACK);
    assertEquals(4, allPossibleDropMoves.size());
}
Also used : ShogiMove(com.playshogi.library.shogi.models.moves.ShogiMove) ShogiPosition(com.playshogi.library.shogi.models.position.ShogiPosition) Test(org.junit.Test)

Example 5 with ShogiPosition

use of com.playshogi.library.shogi.models.position.ShogiPosition in project playshogi by Tellmarch.

the class BishopMovementTest method setUp.

@Before
public void setUp() {
    position = new ShogiPosition();
    bishopMovement = new BishopMovement();
    for (int r = 1; r <= 4; r++) expected[4 - r][4 - r] = expected[4 - r][4 + r] = expected[4 + r][4 - r] = expected[4 + r][4 + r] = true;
}
Also used : ShogiPosition(com.playshogi.library.shogi.models.position.ShogiPosition) Before(org.junit.Before)

Aggregations

ShogiPosition (com.playshogi.library.shogi.models.position.ShogiPosition)45 Test (org.junit.Test)20 ChangeTutorialTextEvent (com.playshogi.website.gwt.client.events.tutorial.ChangeTutorialTextEvent)8 ShogiMove (com.playshogi.library.shogi.models.moves.ShogiMove)6 EventHandler (com.google.web.bindery.event.shared.binder.EventHandler)4 PositionDetails (com.playshogi.website.gwt.shared.models.PositionDetails)4 Before (org.junit.Before)4 DropMove (com.playshogi.library.shogi.models.moves.DropMove)2 ReadOnlyShogiPosition (com.playshogi.library.shogi.models.position.ReadOnlyShogiPosition)2 Square (com.playshogi.library.shogi.models.position.Square)2 PositionChangedEvent (com.playshogi.website.gwt.client.events.gametree.PositionChangedEvent)2 PositionStatisticsEvent (com.playshogi.website.gwt.client.events.kifu.PositionStatisticsEvent)2 CaptureMove (com.playshogi.library.shogi.models.moves.CaptureMove)1 NormalMove (com.playshogi.library.shogi.models.moves.NormalMove)1 MutableShogiBoardState (com.playshogi.library.shogi.models.position.MutableShogiBoardState)1 ShogiBoardState (com.playshogi.library.shogi.models.position.ShogiBoardState)1 GameNavigation (com.playshogi.library.shogi.models.record.GameNavigation)1 ShogiRulesEngine (com.playshogi.library.shogi.rules.ShogiRulesEngine)1 ViewKifuPlace (com.playshogi.website.gwt.client.place.ViewKifuPlace)1 ViewLessonPlace (com.playshogi.website.gwt.client.place.ViewLessonPlace)1