This file contains hidden or 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
| package org.geepawhill.yz | |
| import tornadofx.* | |
| class YzView : View() { | |
| val model = YzModel(YzGame()) | |
| override val root = pane { | |
| hbox { | |
| button("Start") { |
This file contains hidden or 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
| package org.geepawhill.dungeon | |
| import java.lang.Integer.max | |
| import java.lang.Integer.min | |
| data class Area(val west: Int, val north: Int, val east: Int, val south: Int) { | |
| val longest: Int get() = max(east - west, south - north) | |
| val size = (east - west) * (south - north) | |
This file contains hidden or 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
| package org.geepawhill.rws | |
| import java.io.* | |
| import java.net.Socket | |
| class SocketWrapper(val input: InputStream, val output: OutputStream, val machine: String) { | |
| constructor(socket: Socket) : this(socket.getInputStream(), socket.getOutputStream(), socket.inetAddress.toString()) | |
| } | |
| class Channel(socket: SocketWrapper, private val listener: Listener) : Talker, Runnable { |
This file contains hidden or 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
| The relationality of all experience contains challenges to our understanding of organizations that we have | |
| barely begun to come to terms with. I can illustrate this by extending the metaphor of the blind men and | |
| the elephant. In its conventional telling, each blind man had a grip on a different part of the beast, and | |
| they were unable to agree on what it was really, really like, that is, as one of Kuhn's "fixed and neutral | |
| experiences." But there is more, for the elephant isn't just standing there but instead ambles through the | |
| forest and the veldt. The blind men are trying to understand the system as it evolves and as their experience | |
| of it unfolds. The blind man clinging to a leg experiences an elliptical forward motion. He who has the | |
| misfortune to have hold of the tail is jerked and whipped about in a random fashion. A few feet forward, his | |
| colleague, in the crotch, is periodically flooded and/or pasted with output that seems to have nothing to do | |
| with the beast's motion or with the feel of the sur |
This file contains hidden or 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
| I want to use a single gradle+intellij project to build, run, and test multiple arbitrary binaries created from a single repo and source tree. Some notes: | |
| 1) A typical example is the robot world project I'm doing for We Think Code. I want one tree, and I want to use it to build/run/test two clients, a service, and a making app. | |
| 2) By "one source tree" I mean one .../src/... hierarchy, with main/test/resources below it. Intellij handles this well. Multiple trees are harder to both organize and navigate. | |
| 3) I know how to use sub-projects with source dependencies. I don't care for them. Intellij's gradle runs are already slower than their native ones, and when you throw in multiple sub-projects for each run, they get even slower. |
This file contains hidden or 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
| A classic "switch on type" in Java. The draw method interrogates its parameter's class, and decides what to do as a resuilt. | |
| interfact Thing { } | |
| class Wall implemnts Thing { } | |
| class Door implements Thing { } | |
| class Chest implements Thing { } |
This file contains hidden or 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
| // Snippet one: This code creates an ImageView control inside of a Pane. | |
| val root = pane { | |
| imageview { | |
| image = Image("/bucket.png") | |
| isPreserveRatio = true | |
| } | |
| } | |
| // Snippet two: This is the signature of the function imageview that's being called in the above snippet |
This file contains hidden or 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
| class GildedRoseTest { | |
| @Test | |
| fun `sulfuras never changes`() { | |
| val items = arrayOf(Item(SULFURUS_NAME, Int.MAX_VALUE, 80)) | |
| val app = GildedRose(items) | |
| app.updateQuality() | |
| assertThat(items[0].name).isEqualTo(SULFURUS_NAME) | |
| assertThat(items[0].sellIn).isEqualTo(Int.MAX_VALUE) | |
| assertThat(items[0].quality).isEqualTo(80) |
This file contains hidden or 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
| @Test | |
| fun `sulfuras never changes`() { | |
| val item = updateQuality(Item(SULFURUS_NAME, Int.MAX_VALUE, 80)) | |
| with(item) { | |
| assertThat(name).isEqualTo(SULFURUS_NAME) | |
| assertThat(sellIn).isEqualTo(Int.MAX_VALUE) | |
| assertThat(quality).isEqualTo(80) | |
| } | |
| } |
This file contains hidden or 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
| @Test | |
| fun `sulfuras never changes`() { | |
| assertBeforeAndAfter(SULFURUS_NAME, Int.MAX_VALUE, 80, Int.MAX_VALUE,80) | |
| } | |
| @Test | |
| fun `sulfuras never changes even with weird values`() { | |
| // NOTE: Gilded rose does not enforce quality or sellin for sulfuras | |
| assertBeforeAndAfter(SULFURUS_NAME,-1,-3,-1,-3) | |
| } |