add missing files

This commit is contained in:
Mark Canlas 2020-08-24 16:27:02 -04:00
parent 92af2e7d8a
commit b0e40b3e36
2 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,36 @@
package com.htmlism.mos6502.dsl
package snake
import cats.data.NonEmptyList
object AsciiValue {
implicit val asciiValueMapping: Mapping[AsciiValue] =
new Mapping[AsciiValue] {
def comment: String =
"foo as a mapping"
def all: NonEmptyList[AsciiValue] =
NonEmptyList.of(AsciiW, AsciiA, AsciiS, AsciiD)
def value(x: AsciiValue): Int =
x match {
case AsciiW => 0x77
case AsciiA => 0x61
case AsciiS => 0x73
case AsciiD => 0x64
}
def label(x: AsciiValue): String =
x.toString.toLowerCase
def comment(x: AsciiValue): String =
x.toString
}
}
sealed trait AsciiValue
case object AsciiW extends AsciiValue
case object AsciiA extends AsciiValue
case object AsciiS extends AsciiValue
case object AsciiD extends AsciiValue

View File

@ -0,0 +1,28 @@
package com.htmlism.mos6502.dsl
package snake
import cats.data.NonEmptyList
object Direction {
implicit val directionBitField: BitField[Direction] =
new BitField[Direction] {
def comment: String =
"foo as bit field"
def all: NonEmptyList[Direction] =
NonEmptyList.of(Up, Down, Left, Right)
def label(x: Direction): String =
"moving" + x.toString
def comment(x: Direction): String =
x.toString
}
}
sealed trait Direction
case object Up extends Direction
case object Down extends Direction
case object Left extends Direction
case object Right extends Direction