Skip to content

Instantly share code, notes, and snippets.

View jeffxchu's full-sized avatar
📚

jeff hu jeffxchu

📚
View GitHub Profile
@jeffxchu
jeffxchu / list_parser.kt
Created December 10, 2023 21:59
lisp parser
fun parseLisp(input: String): Any? {
val tokens = tokenize(input).iterator()
return if (tokens.hasNext()) parse(tokens) else null
}
fun parse(tokens: Iterator<String>): Any? {
val token = tokens.next()
return when (token) {
"(" -> parseList(tokens)
")" -> null // This shouldn't happen if the input is well-formed
@jeffxchu
jeffxchu / Main.kt
Created November 29, 2023 02:22
Drop Bomb game
import kotlin.random.Random
fun main() {
val gridSize = 10
val numEnemies = 15
val maxBombs = 20
var bombsUsed = 0
var enemiesHit = 0
val board = Array(gridSize) {

Keybase proof

I hereby claim:

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

To claim this, I am signing this object: