Help language development. Donate to The Perl Foundation

Game::Covid19 cpan:ELIZABETH last updated on 2020-07-12

Game::Covid19 - Play the COVID-19 game


use Game::Covid19;

play(age => 64);  # must specify age

play(age => 34, :mask, :distancing);

death-rate(age => 64);


Game::Covid19 is an implementation of a DND-type game that is based on CDC data and was posted by Stephen Richard Watson at:

It exports two subroutines: `play` and `death-rate`.



    play(age => 64);

The `play` subroutine will play the game. You need to at least specify the `age` named parameter. It will return your final constitution, with `0` indicating death. The following named parameters are optional:

  * constitution

    constitution => 80,

A value of 1..100 indicating the state of your constitution, with `100` indicating fully healthy. Defaults to `100`.

  * mask


A Boolean indicating whether or not you're wearing a mask. Defaults to `False`.

  * distancing


A Boolean indicating whether or not you're socially distancing. Defaults to `False`.

  * verbose


A Boolean indicating whether verbose play output is wanted. Defaults to `True`.


    death-rate(age => 64);

The `death-rate` sub will run the game many times and record how many times the game resulted in death, and use that to calculate a death-rate as a percentage.

It takes the same named parameters as the `play` subroutine. Additional named parameters are:

  * times

    times => 10000

The number of times the game should be played. Defaults to 10000.


Elizabeth Mattijsen <[email protected]>

Source can be located at: . Comments and Pull Requests are welcome.


Copyright 2020 Elizabeth Mattijsen

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.