From 86388292cb517cf1200a2ff913a4c2930e04b9cf Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Fri, 3 May 2024 16:22:19 +0200 Subject: [PATCH] detect tactical motifs in games Similar to what the puzzle tagger does https://github.com/ornicar/lichess-puzzler/blob/master/tagger/cook.py --- build.sbt | 8 ++++++++ motif/README.md | 2 ++ motif/src/main/scala/Motif.scala | 14 ++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 motif/README.md create mode 100644 motif/src/main/scala/Motif.scala diff --git a/build.sbt b/build.sbt index 999f52d6..48c8bc2c 100644 --- a/build.sbt +++ b/build.sbt @@ -54,6 +54,14 @@ lazy val playJson: Project = Project("playJson", file("playJson")) ) .dependsOn(scalachess) +lazy val motif: Project = Project("motif", file("motif")) + .settings( + commonSettings, + name := "scalachess-motif", + libraryDependencies + ) + .dependsOn(scalachess) + lazy val bench = project .enablePlugins(JmhPlugin) .settings(commonSettings, scalacOptions -= "-Wunused:all", name := "bench") diff --git a/motif/README.md b/motif/README.md new file mode 100644 index 00000000..3001b127 --- /dev/null +++ b/motif/README.md @@ -0,0 +1,2 @@ +Detect tactical motifs in games. +Similar to what [the puzzle tagger](https://github.com/ornicar/lichess-puzzler/blob/master/tagger/cook.py) does. diff --git a/motif/src/main/scala/Motif.scala b/motif/src/main/scala/Motif.scala new file mode 100644 index 00000000..363dfa25 --- /dev/null +++ b/motif/src/main/scala/Motif.scala @@ -0,0 +1,14 @@ +package chess +package motif + +enum Motif: + case fork + case doubleCheck + case xRay + +case class MotifAt(motif: Motif, at: Ply) + +object MotifAt: + + def findAll(replay: Replay): List[MotifAt] = + Nil