Compare commits
2 commits
c7b279257f
...
33df0eb120
Author | SHA1 | Date | |
---|---|---|---|
33df0eb120 | |||
c95a30edd0 |
8 changed files with 26 additions and 22 deletions
18
build.sbt
18
build.sbt
|
@ -2,15 +2,15 @@ lazy val scodec = (project in file("scodec")).settings(
|
|||
organization := "tf.bug",
|
||||
name := "fancadescodec",
|
||||
version := "0.1.0",
|
||||
scalaVersion := "2.13.2",
|
||||
scalaVersion := "2.13.3",
|
||||
libraryDependencies ++= Seq(
|
||||
"org.scodec" %% "scodec-core" % "1.11.7",
|
||||
"org.scodec" %% "scodec-bits" % "1.1.14",
|
||||
"org.scodec" %% "scodec-bits" % "1.1.17",
|
||||
"org.scodec" %% "scodec-stream" % "2.0.0",
|
||||
"org.typelevel" %% "cats-effect" % "2.1.2",
|
||||
"org.typelevel" %% "cats-effect" % "2.1.3",
|
||||
"org.typelevel" %% "cats-core" % "2.1.1",
|
||||
"co.fs2" %% "fs2-core" % "2.3.0",
|
||||
"co.fs2" %% "fs2-io" % "2.3.0",
|
||||
"co.fs2" %% "fs2-core" % "2.4.2",
|
||||
"co.fs2" %% "fs2-io" % "2.4.2",
|
||||
),
|
||||
mainClass in assembly := Some("tf.bug.fancadescodec.Main"),
|
||||
)
|
||||
|
@ -19,7 +19,7 @@ lazy val graph = (project in file("graph")).settings(
|
|||
organization := "tf.bug",
|
||||
name := "fancadegraph",
|
||||
version := "0.1.0",
|
||||
scalaVersion := "2.13.2",
|
||||
scalaVersion := "2.13.3",
|
||||
libraryDependencies ++= Seq(
|
||||
"org.scala-graph" %% "graph-core" % "1.13.2",
|
||||
),
|
||||
|
@ -29,13 +29,13 @@ lazy val tagless = (project in file("tagless")).settings(
|
|||
organization := "tf.bug",
|
||||
name := "fancadetagless",
|
||||
version := "0.1.0",
|
||||
scalaVersion := "2.13.1",
|
||||
scalaVersion := "2.13.3",
|
||||
libraryDependencies ++= Seq(
|
||||
"org.scala-graph" %% "graph-core" % "1.13.2",
|
||||
"com.chuusai" %% "shapeless" % "2.3.3",
|
||||
"org.typelevel" %% "cats-core" % "2.1.1",
|
||||
"org.typelevel" %% "cats-effect" % "2.1.2",
|
||||
"io.chrisdavenport" %% "fuuid" % "0.3.0",
|
||||
"org.typelevel" %% "cats-effect" % "2.1.3",
|
||||
"io.chrisdavenport" %% "fuuid" % "0.4.0",
|
||||
"org.scalameta" %% "munit" % "0.7.9" % Test,
|
||||
),
|
||||
testFrameworks += new TestFramework("munit.Framework"),
|
||||
|
|
|
@ -20,9 +20,14 @@ object Argument {
|
|||
fansc.Metadata.Number(pos, value)
|
||||
)
|
||||
}
|
||||
implicit val booleanArg: Argument[Boolean] = new Argument[Boolean] {
|
||||
override def encode(value: Boolean)(pos: fansc.Position): Vector[fansc.Metadata] = Vector(
|
||||
fansc.Metadata.Bool(pos, value)
|
||||
)
|
||||
}
|
||||
implicit val soundOptionsArg: Argument[SoundOptions] = new Argument[SoundOptions] {
|
||||
override def encode(value: SoundOptions)(pos: fansc.Position): Vector[fansc.Metadata] = Vector(
|
||||
fansc.Metadata.PlaySoundLoop(pos, value.loop),
|
||||
fansc.Metadata.Bool(pos, value.loop),
|
||||
fansc.Metadata.PlaySoundSample(pos, value.sample)
|
||||
)
|
||||
}
|
||||
|
|
|
@ -389,7 +389,7 @@ object BlockDefinition {
|
|||
override val ids: Vector[Obj] = Vector(Obj.archLower, Obj.archHigher)
|
||||
}
|
||||
|
||||
case object Win extends BuiltIn[Unit] {
|
||||
case object Win extends BuiltIn[Boolean] {
|
||||
override val width: Int = 2
|
||||
override val height: Int = 1
|
||||
override val depth: Int = 2
|
||||
|
@ -415,7 +415,7 @@ object BlockDefinition {
|
|||
)
|
||||
}
|
||||
|
||||
case object Lose extends BuiltIn[Unit] {
|
||||
case object Lose extends BuiltIn[Boolean] {
|
||||
override val width: Int = 2
|
||||
override val height: Int = 1
|
||||
override val depth: Int = 2
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package tf.bug.fancadegraph
|
||||
|
||||
import cats.effect.{Blocker, ExitCode, IO, IOApp}
|
||||
import cats.implicits._
|
||||
import fs2._
|
||||
import java.nio.file.{Paths, StandardOpenOption}
|
||||
import scalax.collection.Graph
|
||||
|
@ -12,8 +11,8 @@ import tf.bug.fancadescodec.{Cartridge, Codecs, Position}
|
|||
object Main extends IOApp {
|
||||
|
||||
override def run(args: List[String]): IO[ExitCode] = {
|
||||
val winBlock = Block(Position(0, 0, 0), BlockDefinition.Win)
|
||||
val loseBlock = Block(Position(0, 0, 3), BlockDefinition.Lose)
|
||||
val winBlock = Block(Position(0, 0, 0), BlockDefinition.Win, true)
|
||||
val loseBlock = Block(Position(0, 0, 3), BlockDefinition.Lose, true)
|
||||
val loseAfter = Pin(loseBlock, BlockDefinition.Lose.after)
|
||||
val winBefore = Pin(winBlock, BlockDefinition.Win.before)
|
||||
val level = Level(
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.11")
|
||||
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.13")
|
||||
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.10")
|
||||
addSbtPlugin("org.jmotor.sbt" % "sbt-dependency-updates" % "1.2.2")
|
||||
|
|
|
@ -50,8 +50,8 @@ object Codecs {
|
|||
lazy val metadata: Codec[Metadata] =
|
||||
discriminated[Metadata].by(uint16L)
|
||||
.subcaseP(0x0100) {
|
||||
case psl: Metadata.PlaySoundLoop => psl
|
||||
} (metadataPlaySoundLoop)
|
||||
case bool: Metadata.Bool => bool
|
||||
} (metadataBool)
|
||||
.subcaseP(0x0201) {
|
||||
case pss: Metadata.PlaySoundSample => pss
|
||||
} (metadataPlaySoundSample)
|
||||
|
@ -68,8 +68,8 @@ object Codecs {
|
|||
case terminal: Metadata.Terminal => terminal
|
||||
} (metadataTerminal)
|
||||
|
||||
lazy val metadataPlaySoundLoop: Codec[Metadata.PlaySoundLoop] =
|
||||
(position :: bool(8).hlist).as[Metadata.PlaySoundLoop]
|
||||
lazy val metadataBool: Codec[Metadata.Bool] =
|
||||
(position :: bool(8).hlist).as[Metadata.Bool]
|
||||
lazy val metadataPlaySoundSample: Codec[Metadata.PlaySoundSample] =
|
||||
(position :: sample.hlist).as[Metadata.PlaySoundSample]
|
||||
lazy val metadataNumber: Codec[Metadata.Number] =
|
||||
|
|
|
@ -4,7 +4,7 @@ sealed trait Metadata
|
|||
|
||||
object Metadata {
|
||||
|
||||
case class PlaySoundLoop(
|
||||
case class Bool(
|
||||
block: Position,
|
||||
doLoop: Boolean
|
||||
) extends Metadata
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package tf.bug.fancadetagless
|
||||
|
||||
import tf.bug.fancadetagless.Fanscript.{Position, ScreenSize}
|
||||
import tf.bug.fancadegraph.BlockDefinition
|
||||
|
||||
trait Fanscript[F[_]] {
|
||||
|
||||
|
|
Loading…
Reference in a new issue