All Downloads are FREE. Search and download functionalities are using the official Maven repository.

format.usi.UciToUsi.scala Maven / Gradle / Ivy

There is a newer version: 12.1.1
Show newest version
package shogi
package format.usi

import cats.implicits._

// Coordinates adjusted for 9x9 board (a1 == 9i) - works for standard shogi, perhaps for minishogi, depending on the coordinate system
object UciToUsi {

  def apply(uciStr: String): Option[Usi] =
    Usi(uciStr.map(Pos.fromUciMap))

  def readList(moves: String): Option[List[Usi]] =
    readList(moves.split(' ').toList)

  def readList(moves: Seq[String]): Option[List[Usi]] =
    moves.toList.map(apply).sequence

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy