Skip to main content

A OpenAI Gym Env for covid19outbreak

Project description

gym-covid19outbreak


covid19outbreak pays tribute to all researchers in African pharmacopoeia, epidemiologists, doctors, nurses, etc. who have fought valiantly against Sars-Cov II

Table of Contents

  1. Game-presentation

    1. Introduction
    2. Object of the game
    3. Gameplay
  2. Rules

    1. Starting-positions
    2. moves
  3. Environments

    1. Episode termination
    2. Observations
    3. Actions
    4. Reward
  4. Installation

  5. Usage

    1. Citation
    2. Contribute

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. During this same period, Italy was the main focus and then the USA took the place. In March 17, 2020 many countries in Africa was closed borders and banning flights from elsewhere. Covid19outbreak is a single-player simulator strategy board game. Player start with 100% of life and priority is to save patient.

Object of the game

By looking for the way to save patient, player must avoid Sars-Cov II and keep its life. If he save all patients player wins otherwise the game begins very difficult.

Gameplay

During the game, player must be stratege by finding a plant and avoiding Sars-CovII in their way. If player touches viruse and have a plant, he kill viruse. If player touches viruse without a plant, he looses some percentage of life and he contaminates environment. Patient is unstable due to collision with viruses.

Rule

Starting-positions

Player starts in bottom of screen with 5 virus, 7 patients and 5 plants.

Moves

Players can move following theses directions:

  • Up, Left, Right, Down

  • LeftTop, RightTop, LeftBottom, RightBottom, NOORP

Environment

Observation

The observation is a numpy arrays of size (800, 700, 3). This arrays is a dtype=np.uint8 value in the [0, 255] range. You can see image below.


gym-covid19outbreak

Actions

The moves is the 8 directions mentioned before. Player can go everywhere in the screen to reach his objective.


agent can move Up, Left, Right, Down, LeftTop, RightTop, LeftBottom, RightBottom in the screen.

Reward

Player have four rewards:

  1. If boy hits a plant: reward = 1 + number of plant collected during an episode.

  2. If boy saves a patient: reward = 1 + number of patient saved during an episode.

  3. If boy hits Sars-Cov II with a plant: reward = 1 + 0.01, 0.01 is a decay life.

  4. If boy hits Sars-Cov II without having a plant: reward = - 3 - (1-life).

In beginning of game, player have 100% of life (i.e life = 1) by hitting the viruse without a plant, life = life - 0.01 (i.e %life = %life - 1)

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 saves all patients or kills all viruses.

Requirement

  • python 3.7+
  • OpenAI gym
  • Numpy
  • Pygame
  • PIL
  • Keras or Tensorflow or Pytorch

Dependencies can be installed with pip or conda

Using pip

$ git clone https://github.com/batalong123/gym-covid19outbreak.git
$ cd gym-covid19outbreak
$ pip install -e .

Usage

import gym
import gym_covid19outbreak

env = gym.make('covid19Attack-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_covid19outbreak,
  author = {Massock Batalong M.B.},
  title = {Covid19outbreak Environments for OpenAI Gym},
  year = {2022},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/batalong123/gym-covid19outbreak}},
}

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gym-covid19outbreak-0.0.1.tar.gz (343.7 kB view details)

Uploaded Source

Built Distribution

gym_covid19outbreak-0.0.1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file gym-covid19outbreak-0.0.1.tar.gz.

File metadata

  • Download URL: gym-covid19outbreak-0.0.1.tar.gz
  • Upload date:
  • Size: 343.7 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

Hashes for gym-covid19outbreak-0.0.1.tar.gz
Algorithm Hash digest
SHA256 ed62b1cdafdb95a31fcf67c994c2ad969ebd8b8e0a7bb09869872709baeae337
MD5 248c946ddfdb584ba9b5b19d47757e17
BLAKE2b-256 3d31477417261e2f92c3635c359a12f51ec343e903226c1877312f47c86b1023

See more details on using hashes here.

File details

Details for the file gym_covid19outbreak-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: gym_covid19outbreak-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.0 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

Hashes for gym_covid19outbreak-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 26098b48cbba597cef8ec24a3c0734ad431987bbdff28c6c39d0d761fe9b4862
MD5 b4327a1b4e85b136385b24f72d404a18
BLAKE2b-256 d0a204851f564e4f38a0701e1e2f8c3485a596e562f5c9482ece729dc24cbadf

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page