A OpenAI Gym Env for killerviruses
Project description
gym-killerviruses
killerviruses is a game simulator inspired by Covid19 pandemic where virus is a Sars-Cov II and killer are all doctors, nurses, researchers on public health, etc ...
Table of Contents
Game-presentation
https://en.wikipedia.org/wiki/Covid19_pandemic
Introduction
It was on March 11, 2020 that the World Health Organisation (WHO) declared the coronavirus pandemic. Killerviruses is a single-player simulator game where player start with 3 lifes in the environment dominated by Sars-Cov II.
Object of the game
By looking for the way to save its life, player must kill all Sars-Cov II viruses with plants. If he kills all viruses, player wins otherwise die.
Gameplay
During the game, player must be stratege by finding a plant and avoiding Sars-CovII in their way. If player touches viruse with a plant, he kills viruse. If player touches viruse without a plant, he looses one life and he contaminates environment.
Rule
Starting-positions
Player starts in bottom of screen with 8 viruses and 5 plants.
Moves
Players can move following theses directions:
-
Up, Left, Right, Down
-
LeftTop, RightTop, LeftBottom, RightBottom, NOOP
Environment
Observation
The observation is a numpy arrays of size (480, 520, 3). This arrays is a type=uint8 value in the [0, 255] range. You can see image below.
Actions
The moves is the 8 directions mentioned before. Player can go everywhere in the screen to reach his objective.
Reward
Player have three rewards:
-
If boy hits a plant: reward = 1 + 0.01 during an episode. 0.01 is a decay life.
-
If boy hits Sars-Cov II with a plant: reward = 2,
-
If boy hits Sars-Cov II without having a plant: reward = - 3 - 0.01.
-
If timeout is over and score is null then reward = - number of viruses otherwise reward = +score.
In beginning of game, player have 3 lifes by hitting the viruse without a plant, life = life - 0.01
Do not forget that player can contaminate environment by creating two viruses each time after infection.
Episode termination
The episode is terminated if agent looses all its life or kills all viruses and timeout is over.
Requirement
- python 3.7+
- OpenAI gym
- Numpy
- Pygame
- PIL
- Keras or Tensorflow or Pytorch
Dependencies can be installed with pip
or conda
Using pip
$ pip install gym-killerviruses
Usage
import gym
import gym_killerviruses
env = gym.make('sarscov2-v0')
MAX_EPISODE = 10
for i in range(MAX_EPISODE):
env.reset()
done = False
total_reward = 0
while not done:
action = env.action_space.sample()
obs, reward, done, info = env.step(action)
total_reward += reward
env.render()
print(f'Episode: {i+1}/{MAX_EPISODE}', f'reward: {total_reward}', f'done: {done}')
env.close()
Citation
Bibtex if you want to cite this repository in your publications:
@misc{gym_killerviruses,
author = {Massock Batalong M.B.},
title = {Killerviruses Environments for OpenAI Gym},
year = {2022},
publisher = {GitHub},
journal = {GitHub repository},
howpublished = {\url{https://github.com/batalong123/gym-killerviruses}},
}
Contribute
Feel free to contribute to this project. You can fork this repository and implement whatever you want. Alternatively, open a new issue in case you need help or want to have a feature added.
contact: lumierebatalong@gmail.com
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
File details
Details for the file gym-killerviruses-0.0.2.tar.gz
.
File metadata
- Download URL: gym-killerviruses-0.0.2.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.3 tqdm/4.56.0 importlib-metadata/4.8.1 keyring/22.0.1 rfc3986/1.4.0 colorama/0.4.4 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e56450f400ec89ca4c57cd0276d090632d4f8112ccc4a65aa96770081602489 |
|
MD5 | f9c8d772a1f2720dea7726f2d816c40a |
|
BLAKE2b-256 | 3da26e0630133157a1aca7804b88b658af678696baf6a6a8a56b4a320723da2d |
File details
Details for the file gym_killerviruses-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: gym_killerviruses-0.0.2-py3-none-any.whl
- Upload date:
- Size: 20.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.3 tqdm/4.56.0 importlib-metadata/4.8.1 keyring/22.0.1 rfc3986/1.4.0 colorama/0.4.4 CPython/3.7.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f05c184ffa6e2015df8a500abaf6d1eed5137f8ae0e7675627495a277362c211 |
|
MD5 | ed2a88ced8587ab6b3b800d747049acb |
|
BLAKE2b-256 | a52fe33cd819dcb38104c6909ab59aaad8daf77f386092de291c52de5ee736ee |