dererXII.scalashogi_2.13.5.0.2.source-code.Hash.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalashogi_2.13 Show documentation
Show all versions of scalashogi_2.13 Show documentation
Shogi API written in scala. Immutable and free of side effects.
package shogi
import java.security.MessageDigest
object Hash {
val size = 3
private def apply(str: String): PositionHash =
MessageDigest getInstance "MD5" digest (str getBytes "UTF-8") take size
def apply(sit: Situation): PositionHash = apply(sit.toSfen.value)
def debug(hashes: PositionHash) = hashes.map(_.toInt).sum.toString
}