-
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
Showing
9 changed files
with
118 additions
and
0 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
back/src/main/kotlin/io/github/badgersOfKotlinForest/kotlinForest/actors/Actor.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,11 @@ | ||
package io.github.badgersOfKotlinForest.kotlinForest.actors | ||
|
||
/** | ||
* Interface for actors | ||
*/ | ||
interface Actor { | ||
/** | ||
* Interacts with other actor | ||
*/ | ||
fun interact(other: Actor) | ||
} |
19 changes: 19 additions & 0 deletions
19
back/src/main/kotlin/io/github/badgersOfKotlinForest/kotlinForest/actors/MoveableActor.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,19 @@ | ||
package io.github.badgersOfKotlinForest.kotlinForest.actors | ||
|
||
import io.github.badgersOfKotlinForest.kotlinForest.map.MapCellIndex | ||
import io.github.badgersOfKotlinForest.kotlinForest.map.MapField | ||
|
||
/** | ||
* Actor, which can move | ||
*/ | ||
interface MoveableActor : Actor { | ||
/** | ||
* Duration of actor movement | ||
*/ | ||
val movementPeriod: Int | ||
|
||
/** | ||
* Moves the actor | ||
*/ | ||
fun move(map: MapField, pos: MapCellIndex) | ||
} |
24 changes: 24 additions & 0 deletions
24
back/src/main/kotlin/io/github/badgersOfKotlinForest/kotlinForest/animals/Animal.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,24 @@ | ||
package io.github.badgersOfKotlinForest.kotlinForest.animals | ||
|
||
import io.github.badgersOfKotlinForest.kotlinForest.actors.MoveableActor | ||
|
||
/** | ||
* Representation for animal | ||
*/ | ||
interface Animal : MoveableActor { | ||
|
||
/** | ||
* Animal dies | ||
*/ | ||
fun die() | ||
|
||
/** | ||
* Animal eats smth | ||
*/ | ||
fun eat(food: Food) | ||
|
||
/** | ||
* Animal breeds with optional other Animal and creates new Animals | ||
*/ | ||
fun breed(other: Animal?): List<Animal> | ||
} |
9 changes: 9 additions & 0 deletions
9
back/src/main/kotlin/io/github/badgersOfKotlinForest/kotlinForest/animals/Food.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,9 @@ | ||
package io.github.badgersOfKotlinForest.kotlinForest.animals | ||
|
||
import io.github.badgersOfKotlinForest.kotlinForest.actors.Actor | ||
|
||
/** | ||
* Representation for food | ||
*/ | ||
interface Food : Actor { | ||
} |
9 changes: 9 additions & 0 deletions
9
back/src/main/kotlin/io/github/badgersOfKotlinForest/kotlinForest/map/Map.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,9 @@ | ||
package io.github.badgersOfKotlinForest.kotlinForest.map | ||
|
||
|
||
typealias MapField = Array<Array<Array<MapItem>>> | ||
|
||
/** | ||
* Coordinates representation | ||
*/ | ||
data class MapCellIndex(val x: Int, val y: Int, val z: Int) |
10 changes: 10 additions & 0 deletions
10
back/src/main/kotlin/io/github/badgersOfKotlinForest/kotlinForest/map/MapItem.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,10 @@ | ||
package io.github.badgersOfKotlinForest.kotlinForest.map | ||
|
||
import io.github.badgersOfKotlinForest.kotlinForest.actors.Actor | ||
|
||
/** | ||
* Cell of map | ||
*/ | ||
class MapItem(val actors: MutableList<Actor>) { | ||
constructor(): this(mutableListOf()) | ||
} |
8 changes: 8 additions & 0 deletions
8
back/src/main/kotlin/io/github/badgersOfKotlinForest/kotlinForest/tree/Tree.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,8 @@ | ||
package io.github.badgersOfKotlinForest.kotlinForest.tree | ||
|
||
/** | ||
* Tree representation | ||
*/ | ||
interface Tree { | ||
val elements : List<TreeElement> | ||
} |
18 changes: 18 additions & 0 deletions
18
back/src/main/kotlin/io/github/badgersOfKotlinForest/kotlinForest/tree/TreeElement.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,18 @@ | ||
package io.github.badgersOfKotlinForest.kotlinForest.tree | ||
|
||
import io.github.badgersOfKotlinForest.kotlinForest.actors.Actor | ||
|
||
/** | ||
* Element of tree | ||
*/ | ||
interface TreeElement : Actor { | ||
/** | ||
* Is this dwelling of someone? | ||
*/ | ||
val isDwelling: Boolean | ||
|
||
/** | ||
* Type of this tree element | ||
*/ | ||
val type: TreeElementType | ||
} |
10 changes: 10 additions & 0 deletions
10
back/src/main/kotlin/io/github/badgersOfKotlinForest/kotlinForest/tree/TreeElementType.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,10 @@ | ||
package io.github.badgersOfKotlinForest.kotlinForest.tree | ||
|
||
/** | ||
* Type of tree element | ||
*/ | ||
enum class TreeElementType { | ||
CROWN, | ||
TRUNK, | ||
ROOT | ||
} |