Skip to main content

"This town is not big enough for both of our bots"

Project description

Showdown
========

This town is not big enough for both of our bots

What is this?
-------------

Showdown is a game for two bots (and for the people to write those bots)

The rules
---------

.. image:: https://nerdist.com/wp-content/uploads/2016/08/Good-Bad-Ugly-Trio.jpg
:alt: Showdown (mexican standoff) from The Good, the Bad and the Ugly. (image from https://nerdist.com/)

Basics
^^^^^^

This game is played by 2 bots (a.k.a players), implemented as 2 different command line programs.

Each bot represents an opponent in a western movie style showdown. They both have a 6-bullet Colt, and start with one loaded bullet. The aim is to kill the opponent by shooting them while they are vulnerable.

Player play at the same time by issuing one of the 3 allowed commands : ``shoot``, ``dodge``, ``reload``. Then, if both player survive, they see what their opponent did, and start over, etc.

Who dies ?
^^^^^^^^^^

(A and B can be any of the 2 players)

- If A shoots while B reloads, B dies
- If A and B both shoot but B has no more bullets, B dies
- If A shoots while B issues an invalid command or their program has exited, B dies
- If B has not issued a command within one second (but their program is still running), B dies. This rule is to avoid bots that will slow the game at each and every turn.

In all other cases, the game continues.

Ammunition
^^^^^^^^^^

Each player start with 1 bullet in their gun. Shooting always removes a bullet from your gun (except if it's already empty). Reloading always adds a bullet to your gun (except if it already has 6 bullets and is full)

Turns & victory
^^^^^^^^^^^^^^^

The game stops when an opponent is dead, or when at least one opponent takes more than one second to give its intructions, or after 100 turns.

If there is no winner, the winner will be selected as the one who dodged the least frequently. If both opponent dodged the same amount of time, a winner is randomly selected.

Inputs, outputs, timings
^^^^^^^^^^^^^^^^^^^^^^^^

Here, ``print`` means write in stdout, followed by a newline (`\n`), and ``read``means read from stdin until newline.

The program should print its name (within 10 seconds after the start of the process)

Then, as long as the game is on, the program should loop over the two following action.

The program should print its action for the current turn among ``shoot``, ``dodge`` and ``reload``.
Then, the program may read the action the opponent did. The action may be ``shoot``, ``dodge``, ``reload``, ``shoot_no_bullet`` if the opponent shot bu had no bullet left, ``stand`` if the opponent sent an invalid command.

A program has one second after it receives the opponent's action to print its own action, otherwise the game will be terminated.

The program
-----------

.. code::bash

showdown first command with args -vs- second command with args

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

showdown-0.1.0.dev0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

showdown-0.1.0.dev0-py2.py3-none-any.whl (13.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file showdown-0.1.0.dev0.tar.gz.

File metadata

File hashes

Hashes for showdown-0.1.0.dev0.tar.gz
Algorithm Hash digest
SHA256 ce3629452204583f08d3e9b029a74c9d52f5c19506adb5890c5abe89971d3ba2
MD5 ea8da0a8941006351c0049ece98c0667
BLAKE2b-256 2d56e19e8015a051d4b779ec2a54253a319bc1e1a6e534c9ed10bb34ce2b42e4

See more details on using hashes here.

File details

Details for the file showdown-0.1.0.dev0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for showdown-0.1.0.dev0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 8509f371a3b61b36a4f7777b376555ce4b4de2797ae6091684cba842521c338b
MD5 a51e6bf9820cfa5fd10e978f53e34d84
BLAKE2b-256 93f68039814988a3f2c06bd293da8602c74b7e681cb2894b2e29307ad7f2039c

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