Skip to content

Instantly share code, notes, and snippets.

Gaetan Zoritchak gzoritchak

Block or report user

Report or block gzoritchak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ThomasApp
package io.data2viz.examples.thomas
import io.data2viz.color.Colors
import io.data2viz.geom.Size
import io.data2viz.scale.Scales
import io.data2viz.viz.JFxVizRenderer
import io.data2viz.viz.Viz
import io.data2viz.viz.viz
import javafx.application.Application
@gzoritchak
gzoritchak / JavaFxAnimationTest.kt
Created Jul 5, 2017
Just a test of JavaFx animation.
View JavaFxAnimationTest.kt
package io.data2viz.svg
import javafx.animation.AnimationTimer
import javafx.application.Application
import javafx.scene.Group
import javafx.scene.Scene
import javafx.scene.paint.Color
import javafx.scene.shape.Circle
import javafx.scene.shape.Rectangle
import javafx.stage.Stage
@gzoritchak
gzoritchak / HTMLColors.kt
Created Jun 28, 2017
Html colors in a subpackage.
View HTMLColors.kt
package io.data2viz.color.htmlColors
import io.data2viz.color.colors.col
val aliceblue by lazy { 0xf0f8ff.col }
val aqua by lazy { 0x00ffff.col }
val aquamarine by lazy { 0x7fffd4.col }
val azure by lazy { 0xf0ffff.col }
val beige by lazy { 0xf5f5dc.col }
val bisque by lazy { 0xffe4c4.col }
View AsyncAwaitSample.kt
// runs the code in the background thread pool
fun asyncOverlay() = async(CommonPool) {
// start two async operations
val original = asyncLoadImage("original")
val overlay = asyncLoadImage("overlay")
// and then apply overlay to both results
applyOverlay(original.await(), overlay.await())
}
// launches new coroutine in UI context
View LyonDslLiveCoding.kt
package jug.dsl
val kotlinSurveyDef = createNewSurveyDef("Évaluation du kotlin user group") {
introduction = "Merci de prendre 20 secondes pour répondre à quelques questions."
val appreciation = intQuestion("Quelle est votre appréciation de la dernière session ?"){
min = 1
max = 5
}
View MarsLander1.kt
package org.gzk.marslander
import java.io.StringReader
import java.util.*
fun main(args: Array<String>) {
val bestChimp = findBestChimp(::createMarsLander1FromGenome, ::marsLander1Fitness)
println(
bestChimp.result.trajectory.drop(1).joinToString (transform = { state -> "${state.angle}, ${state.power}" })
)
View Genetic.kt
package org.gzk.marslander
import java.lang.Math.random
val log = true
val elitism = true
val generationsCount = 10
val populationSize = 20
val genomeSize = 1200
View Physics.kt
package org.gzk.marslander
data class Time(val sec:Double)
val Double.sec: Time
get() = Time(this)
/**
* Speed is internally using a vector, allowing to compose it. speed12 = speed1 + speed2
*/
View Cartesian.kt
package org.gzk.marslander
import java.lang.Math.*
/**
* A point in a 2 dimensions cartesian system.
* Point + Vector -> Point
* Point - Point -> Vector
*/
data class Point(val x:Double, val y: Double) {
@gzoritchak
gzoritchak / Lander.kt
Last active Jun 8, 2016
A Genetic Algorithm implementation of CodingGame MarsLander1 puzzle.
View Lander.kt
package org.gzk.marslander
val GRAVITY = acceleration(0.0, -3.711)
val maxX = 6999
val minX = 0
/**
* power : 0, 1, 2, 3, 4
* angle : -90, -75, ... , 0, +15, +30, ..., +75, +90
*/
You can’t perform that action at this time.