Skip to content

Instantly share code, notes, and snippets.

View cjohnson318's full-sized avatar

Connor Johnson cjohnson318

View GitHub Profile
@cjohnson318
cjohnson318 / AStar15Puzzle.kt
Created June 13, 2019 14:10
This is a Kotlin implementation of a 15 Puzzle solver using A*. As an example, I've listed all possible positions for a 2x2 puzzle.
enum class Direction {
NORTH,
SOUTH,
EAST,
WEST,
}
/**
* A "move" is a starting position and a direction in which to move.
*/
@cjohnson318
cjohnson318 / DeterministicPushDownAutomata.kt
Created May 29, 2019 13:54
Simple Deterministic Push Down Automata in Kotlin
val pass: Unit = Unit
data class State(val state: String)
data class Event(val event: String)
data class StackSymbol(val symbol: String)
enum class StackActionType {
PUSH,
@cjohnson318
cjohnson318 / FiniteStateMachine.kt
Last active June 27, 2022 17:47
Simple Finite State Machine in Kotlin
import kotlin.test.assertEquals
data class State(val state: String)
data class Event(val event: String)
data class CurrentStateEvent(val state: State, val event: Event)
class TransitionTable {
private var stateTable = mutableMapOf<CurrentStateEvent, State>()
@cjohnson318
cjohnson318 / keybase.md
Created May 28, 2019 22:17
Keybase Proof

Keybase proof

I hereby claim:

  • I am cjohnson318 on github.
  • I am cjohnson318 (https://keybase.io/cjohnson318) on keybase.
  • I have a public key ASBnwk2tQ3ncPZGFdmvQX7qpXlgGdB4SlnZbvtvzZ01bhAo

To claim this, I am signing this object: