This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader | |
import java.io.File | |
import java.io.InputStream | |
import java.io.InputStreamReader | |
import java.time.Instant | |
import kotlin.system.exitProcess | |
private val WHITESPACE = Regex("\\s+") | |
class StreamProcessor(val stream: InputStream, val lineCb: (String) -> Unit) : Thread() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Generates 32x32 tiles that can be connected with conduits on one or | |
* more sides. The basic process is: | |
* | |
* 1. Draw a bunch of random boxes with color X, none of which touch the outer perimeter. | |
* 2. draw some conduits from the edges -- each conduit is two color-X lines going toward | |
* the center until they hit a color-X pixel | |
* 3. flood fill from the four corners of the perimeter with color Y. | |
* 4. erase all X-color pixels that don't have an adjacent Y-color pixel in the four | |
* cardinal directions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.* | |
object Birthday { | |
class BirthdayDependencyInjector { | |
fun injectDependencyIntoTheFactory(dataProvider: GreetingCardDataProvider<Date>) : BirthdayCardProvider { | |
return BirthdayCardProvider(dataProvider) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigDecimal | |
import java.math.RoundingMode | |
class Crosstab2d(val colLabel: String, val rowLabel: String) { | |
var tot: Int = 0 | |
val grid = arrayOf( | |
intArrayOf(0, 0), | |
intArrayOf(0, 0) | |
) |