There is CellLogic
class which should be extended in order to write your custom logic to the Cell
#TODO
- improve documentation of the entities
- publish library and describe how user can integrate it
In order to integrate this library into you project you have to do the next:
- Create an empty project without any activity
- Create a new class and extend it from
AgarApp
- Override
cellImplementation
. This method have to return your implementation of theCellLogic
class
Sample:
class MyApp : AgarApp() {
override fun cellImplementation(): CellLogic {
return MyCustomCell()
}
}
- Register your app class in
AndroidManifest.xml
file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.epam.agar.hackathon.agar_epam">
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK"/>
<application
android:name=".app.MyApp"
android:usesCleartextTraffic="true">
</application>
</manifest>
- Run application
There is CellLogic
class which should be extended in order to write your custom logic to the Cell. You have to
override handleGameUpdate
in order to write your custom logic there:
class MyCellLogic : CellLogic() {
override fun handleGameUpdate(mapState: MapState): DesiredCellsState? {
return DesiredCellsState(emptyList())
}
}
Note:
Return type is optional and your cells will do nothing if
null
is returned
Cell
- one active entity(circle) on map that can move/split into several new cells/merge with your cells/eat alien
cells/eat food
Food
- small inert circles on map that can be eaten in order to gain new energy.
The representation of the current map state:
gameTick
- Current game tickmyCells
- Cells that you can work with in terms of developing/moving/updating themalienCells
- Alien cells that potentially can be harmful. You have to be careful and avoid them until you are sure that you can eat itfood
- All food that exists on map
The DesiredCellsState
is the representation of how you want to develop/update all your cells that you have on the map
and contains the list of CellActivity
which is the representation of your cell and the way how you want to
develop/move it.
This item represents the way how we want to update our item based on cellId
.
Velocity is a speed vector. The direction where we want to move our cell. Vector length will be ignored and will be calculated based on your speed
Represent in which way we want to develop our cell parameters
eatEfficiency
-maxSpeed
-power
-mass
- the mass of the cellvolatilization
- the speed in which your cell lose weight. So you have to eat(get new energy) all the time in order to keep your mass and grow
Note:
TurnAction
is an additional action that we can perform during the turn. Possible actions:
Split
- split the cell into 2 new equal cellsMerge
- merge cells together. Should containe theid
of the taget cell.
The properties of the Cell
:
mass
- current mass of your cellradius
- the radius of the cell's circlespeed
- maximum speed of the cellposition
velocity
eatEfficiency
power