-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc58fe2
commit e4c527e
Showing
15 changed files
with
98 additions
and
12 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
= Playground-Game-of-Life | ||
Dmitrij Drandarov <https://github.com/dmitrij-drandarov> | ||
:imagesdir: img | ||
|
||
== Authors | ||
|
||
* Dmitrij Drandarov | link:https://github.com/dmitrij-drandarov[image:github.png[20px, 20px]] | link:https://twitter.com/drandarov_io[image:twitter.png[20px, 20px]] | link:https://www.xing.com/profile/Dmitrij_Drandarov[image:xing.png[20px, 20px]] | link:https://www.linkedin.com/in/dmitrij-drandarov/[image:linkedin.png[20px, 20px]] | ||
|
||
== Demo | ||
=== Kotlin-Functional-Processing-3D | ||
image:gol_3D.png[3D Visualization (above), seperate layers (below)] | ||
|
||
== Variants | ||
|
||
=== link:/java-functional/src/main/java/io/drandarov/gol[Java-Functional] | ||
|
||
=== link:/java-functional-3d/src/main/java/io/drandarov/gol[Java-Functional-3D (no GUI)] | ||
|
||
=== link:/kotlin-converted-from-java-functional/src/main/java/io/drandarov/gol[Kotlin converted-from-Java-Functional] | ||
|
||
=== link:/kotlin-functional/src/main/java/io/drandarov/gol[Kotlin-Functional] | ||
|
||
=== link:/kotlin-functional-processing/src/main/java/io/drandarov/gol[Kotlin-Functional-Processing (GUI)] | ||
|
||
- Right Arrow: Step | ||
|
||
=== link:/kotlin-functional-processing-3d/src/main/java/io/drandarov/gol[Kotlin-Functional-Processing-3D (GUI)] | ||
|
||
- Right Arrow: Step | ||
- W, S: Zoom | ||
- A, D: Rotate | ||
- Q, E: Change cube gaps | ||
- C : Show/Hide coordinate lines |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
...kotlin/io/drandarov/gol/functional/GoL.kt → ...d/src/main/kotlin/io/drandarov/gol/GoL.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package io.drandarov.gol.functional | ||
package io.drandarov.gol | ||
|
||
typealias World = List<List<List<Boolean>>> | ||
|
||
|
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
47 changes: 47 additions & 0 deletions
47
kotlin-functional-processing-3d/src/test/kotlin/io/drandarov/gol/GoLTest.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package io.drandarov.gol | ||
|
||
import org.junit.jupiter.api.Assertions.* | ||
import org.junit.jupiter.api.Test | ||
|
||
class GoLTest { | ||
|
||
companion object { | ||
private val testWorld: World = createWorld(10, 12, 5) | ||
.flipAt(1, 0, 0) | ||
.flipAt(2, 1, 0) | ||
.flipAt(0, 2, 0) | ||
.flipAt(1, 2, 0) | ||
.flipAt(2, 2, 0) | ||
.flipAt(9, 14, 0) | ||
} | ||
|
||
@Test | ||
fun neighborCountTest() { | ||
assertEquals(1, testWorld.neighbourCount(1, 0, 0)) | ||
assertEquals(3, testWorld.neighbourCount(2, 1, 0)) | ||
assertEquals(1, testWorld.neighbourCount(0, 2, 0)) | ||
assertEquals(3, testWorld.neighbourCount(1, 2, 0)) | ||
assertEquals(2, testWorld.neighbourCount(2, 2, 0)) | ||
assertEquals(0, testWorld.neighbourCount(9, 11, 0)) | ||
} | ||
|
||
@Test | ||
fun isAliveTest() { | ||
assertTrue(testWorld.isAliveNeighbor(0, 0, 0, 1, 0, 0)) | ||
assertTrue(testWorld.isAliveNeighbor(1, 1, 0, 2, 1, 0)) | ||
assertTrue(testWorld.isAliveNeighbor(1, 1, 0, 1, 2, 0)) | ||
|
||
assertFalse(testWorld.isAliveNeighbor(1, 0, 0, 0, -1, 0)) | ||
assertFalse(testWorld.isAliveNeighbor(-100, 5, 0, -101, 6, 0)) | ||
} | ||
|
||
@Test | ||
fun flipAtTest() { | ||
assertTrue(testWorld.flipAt(8, 8, 0).isAlive(8, 8, 0)) | ||
|
||
assertFalse(testWorld.flipAt(2, 2, 0).isAlive(2, 2, 0)) | ||
assertFalse(testWorld.flipAt(1, 80, 0).isAlive(1, 80, 0)) | ||
} | ||
|
||
} | ||
|
2 changes: 1 addition & 1 deletion
2
...kotlin/io/drandarov/gol/functional/GoL.kt → ...g/src/main/kotlin/io/drandarov/gol/GoL.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package io.drandarov.gol.functional | ||
package io.drandarov.gol | ||
|
||
typealias World = List<List<Boolean>> | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...in/io/drandarov/gol/functional/GoLDemo.kt → ...c/main/kotlin/io/drandarov/gol/GoLDemo.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package io.drandarov.gol.functional | ||
package io.drandarov.gol | ||
|
||
import processing.core.PApplet | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...in/io/drandarov/gol/functional/GoLTest.kt → ...c/test/kotlin/io/drandarov/gol/GoLTest.kt
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
2 changes: 1 addition & 1 deletion
2
...kotlin/io/drandarov/gol/functional/GoL.kt → ...l/src/main/kotlin/io/drandarov/gol/GoL.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package io.drandarov.gol.functional | ||
package io.drandarov.gol | ||
|
||
typealias World = List<List<Boolean>> | ||
|
||
|
2 changes: 1 addition & 1 deletion
2
...in/io/drandarov/gol/functional/GoLDemo.kt → ...c/main/kotlin/io/drandarov/gol/GoLDemo.kt
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
2 changes: 1 addition & 1 deletion
2
...in/io/drandarov/gol/functional/GoLTest.kt → ...c/test/kotlin/io/drandarov/gol/GoLTest.kt
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