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
panel { | |
val square = square { | |
lines = 8 | |
char = 'd' | |
} | |
addShape(Space) | |
val triangle = triangle { | |
lines = 8 | |
char = 'd' | |
} |
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
fun Panel.rhombus(init: RhombusBuilder.() -> Unit): Rhombus { | |
return RhombusBuilder().apply { init() }.build().also { this.addShape(it) } | |
} |
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
class RhombusBuilder { | |
var lines = 0 | |
var char = '*' | |
fun build() = Rhombus(lines, char) | |
} |
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
panel { | |
val square = square { | |
lines = 8 | |
char = 'd' | |
} | |
addShape(Space) | |
val triangle = triangle { | |
lines = 8 | |
char = 'd' | |
} |
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
panel { | |
val square = square { | |
lines = 8 | |
char = 'd' | |
} | |
addShape(Space) | |
val triangle = triangle { | |
lines = 8 | |
char = 'd' | |
} |
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
panel { | |
val square = square { | |
lines = 8 | |
char = 'd' | |
} | |
addShape(Space) | |
val triangle = triangle { | |
lines = 7 | |
char = 's' | |
} |
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
fun Panel.triangle(init: TriangleBuilder.() -> Unit): Triangle { | |
return TriangleBuilder().apply { init() }.build().also { this.addShape(it) } | |
} |
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
class TriangleBuilder { | |
var lines = 0 | |
var char = '*' | |
fun build() = Triangle(lines, char) | |
} |
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
panel { | |
val square = square { | |
lines = 8 | |
char = 'd' | |
} | |
addShape(Space) | |
val triangle = triangle { | |
lines = 7 | |
char = 's' | |
} |
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
panel { | |
val square = square { | |
lines = 8 | |
char = 'd' | |
} | |
val triangle = Triangle(7, 's') | |
... | |
addShape(Space) | |
addShape(triangle) | |
... |