A simple implement for MCTS algorithm.
Project description
Akatosh
This is a light weighted disceret event simulation library. The name is from the Dragon God of Time in Elder Scroll. :)
Install
pip install --upgrade Akatosh
Example
Import modules:
from Akatosh import Mundus, Actor
create actors:
the mom actor will pick up a child every second, and the child will play at home for 8 second
class mom(Actor):
def __init__(self, at, step, till, priority, name) -> None:
super().__init__(at=at, step=step, till=till, priority=priority)
self._name = name
self._num_children = 0
def action(self):
c = child(at=self.timeline.now, step=1, till=8, priority=-self._num_children, name=f"Child-{self._num_children}")
self._num_children += 1
print(f"Time: {Mundus.now}\tEvent Priority: {self.priority}:\t{self._name} picks up a child {c._name}.")
m = mom(at=0, step=1, till=5, priority=0, name="Mom")
the child actor will prevent uncle to come to visit after 7 second
class child(Actor):
def __init__(self, at, step, till, priority, name) -> None:
super().__init__(at=at, step=step, till=till, priority=priority)
self._name = name
def action(self):
if self.timeline.now >= 7:
uncle.deactivate()
print(f"Time: {Mundus.now}\tEvent Priority: {self.priority}:\t{self._name}\tis playing at home.")
The father actor will come to home after mother pick up all child
father = Actor(after=m, priority=-1, action=lambda: print(f"Time: {Mundus.now}\tEvent Priority: {father.priority}:\tFather comes back home."))
The uncle will come to visit once father has got home for some reason...
uncle = Actor(after=father, step=1, till=10, priority=0, action=lambda: print(f"Time: {Mundus.now}\tEvent Priority: {uncle.priority}:\tUncle comes to vist."))
Start the simulation for 10 second:
Mundus.simulate(10)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Akatosh-1.1.1.tar.gz.
File metadata
- Download URL: Akatosh-1.1.1.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3baae4f23e3fc4b0b7e8b0fdeb348d94fbe8f68a657059f528e8462aa13a0ce1
|
|
| MD5 |
07d289f9d567138949ed5daa3bfdeaad
|
|
| BLAKE2b-256 |
964914cfebe572968155f1016ee4f2ccdcf4e4dc73175a15db44815098be0639
|
File details
Details for the file Akatosh-1.1.1-py3-none-any.whl.
File metadata
- Download URL: Akatosh-1.1.1-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
931906c8a352eeb046d67dd5d9105e19740c01ab4462230858a8366239c35a16
|
|
| MD5 |
0c6a5ea0fc7f9b41763d651b57351566
|
|
| BLAKE2b-256 |
f6ea02c434b4cb4d7b919ede7cb57aff2af86180937f2b8a5d85e0c62a1616c1
|