Pick'n Del
A HackableGame based on tiled-land.
Install
In your directory we advise to clone side by side hackagames and tiled-land.
git clone https://github.com/iktorz-net/hackagames
git clone https://github.com/imt-mobisyst/tiled-land
Make sure you have the last version, and install them with python3 pip:
git -C hackagames pull
pip install ./hackagames
git -C tiled-land pull
pip install ./tiled-land
get-started:
Everything starts with a launch file.
It will define a world and test a bot.
As a first try, we recommend playing directly with the human interface (the player.ShellPlayer).
import tiledland.game.pickndel as pnd
world= pnd.World().initializeGrid([
[00, 00, 00, 00], # 1 2 3 4
[-1, 00, -1, -1], # 5
[00, 00, 00, 00], # 6 7 8 9
[00, -1, -1, 00] #10 13
])
master= pnd.GameMaster( world, tic=12 )
bot= pnd.player.ShellPlayer()
master.testPlayer( bot, 1 )
The goal is to realize a maximum of pick and delivery missions (cf. market place area).
then you can replace the ShellPlayer with your own Bot:
import tiledland.game.pickndel as pnd
class FirstBot():
# Constructor:
def __init__(self):
super().__init__()
self._model= pnd.World()
self._id= 0
self._tic= 0
# Player interface :
def wakeUp(self, playerId, numberOfPlayers, gamePod):
self._id= playerId
self._model.fromPod(gamePod)
def perceive(self, podState):
self._tic= self._model.setOnPodState(podState)
def decide(self):
return "pass"
def sleep(self, result):
print( f"End on: {result}" )
We recommend using a _model attributes to model the Pick'n Del world (the map, the robot and the missions).
Somme useful methods:
carrierTile()returning the current tile position of the carrier.carrierMission()returning the current mission identifier.carrierGoal()returning the next tile to reach.
More Complexity:
The first increase in complexity consists of growing the size of the world. To this effect, it is possible to download a complete launch file that will start a game with different game configuration, each recorded in a json format.
- Archives to download: .zip
The pickndel.py launch script will start a game accordingly to the configuration given as command argument:
For instance
python3 pickndel.py conf-pnd-medium-02.json
As a first exercise, the goal is to learn, using reinforcement learning how to move in a world knowing that some of the tiles are encumbered. There is a probability to be stuck inside a tile when the carrier try a move from that tile. The encumbered tile and the associated probabilities are not known, and the smallest path is not necessarily the faster.