Skip to content

Commit

Permalink
Add tests for B0 rules
Browse files Browse the repository at this point in the history
  • Loading branch information
jedlimlx committed Jun 22, 2024
1 parent 08c1233 commit 6f93400
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
25 changes: 25 additions & 0 deletions src/commonTest/kotlin/search/CFindTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import kotlin.test.Ignore
import kotlin.test.Test
import kotlin.test.assertEquals


@Ignore
class Test {
private val searchStrategies = listOf(SearchStrategy.HYBRID_BFS, SearchStrategy.PRIORITY_QUEUE)

Expand Down Expand Up @@ -158,6 +160,29 @@ class Test {
}
}

@Test
fun strobingTest() {
for (strategy in searchStrategies) {
// Checking it works for strobing rules for 2-states or n-states
val search = CFind(
HROT("R2,C2,S3-4,6,B0-7,N+"), 4, 1, 4, symmetry = ShipSymmetry.ODD,
verbosity = 1, searchStrategy = strategy, numShips = 1
)
search.search()

assertEquals(search.searchResults.size, 1)

val search2 = CFind(
HROTGenerations("01246/0134/3"), 3, 2, 6, symmetry = ShipSymmetry.EVEN,
verbosity = 1, searchStrategy = strategy
)
search2.search()

assertEquals(search2.searchResults.size, 1)
}

}

// Miscellaneous tests
@Test
fun dfsTest() {
Expand Down
18 changes: 15 additions & 3 deletions src/jvmMain/kotlin/Main.jvm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,21 @@ actual fun main() {
//INTGenerations("023456/0123456/3"), 3, 1, 7, ShipSymmetry.ODD,

val search = CFind(
HROT("B02/S2V"), 4, 1, 13, ShipSymmetry.ODD,
verbosity = 1, searchStrategy = SearchStrategy.PRIORITY_QUEUE,
transpositionTableSize = 1 shl 23, direction = Coordinate(1, 1)
HROT("R2,C2,S3-4,6,B0-7,N+"), 4, 1, 4, symmetry = ShipSymmetry.ODD,
verbosity = 1, searchStrategy = SearchStrategy.PRIORITY_QUEUE, numShips = 1
)
search.search()

val search2 = CFind(
HROTGenerations("01246/0134/3"), 3, 2, 6, symmetry = ShipSymmetry.EVEN,
verbosity = 1, searchStrategy = SearchStrategy.PRIORITY_QUEUE
)
search2.search()

// val search = CFind(
// HROT("B02/S2V"), 4, 1, 13, ShipSymmetry.ODD,
// verbosity = 1, searchStrategy = SearchStrategy.PRIORITY_QUEUE,
// transpositionTableSize = 1 shl 23, direction = Coordinate(1, 1)
// )
// search.search()
}

0 comments on commit 6f93400

Please sign in to comment.