https://github.com/caleb531/three-of-a-crime

Simulator programs for the card game Three of a Crime

https://github.com/caleb531/three-of-a-crime

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (12.7%) to scientific vocabulary

Keywords

card-game game python
Last synced: 5 months ago · JSON representation

Repository

Simulator programs for the card game Three of a Crime

Basic Info
  • Host: GitHub
  • Owner: caleb531
  • License: mit
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 81.1 KB
Statistics
  • Stars: 1
  • Watchers: 2
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Topics
card-game game python
Created over 10 years ago · Last pushed 8 months ago
Metadata Files
Readme License

README.md

Three of a Crime Solver

Copyright 2015-2022 Caleb Evans
Released under the MIT license

tests Coverage Status

This project was created and named for the Gameright game, Three of a Crime. To understand the purpose of this project, one must first understand how the game works.

Gameplay

Three of a Crime

Seven suspects for an unmentioned crime are distributed among 35 cards representing all possible 3-suspect combinations. One player is designated as the eyewitness, and as such draws the first card in the deck. The three suspects on this card are the suspects responsible for the crime.

The other players (who are, implicitly, the game's detectives) take turns drawing cards from the deck. For every card that is drawn, the eyewitness player places a number tile next to the card indicating how many suspects on said card match the suspects on the eyewitness card (this number can be 0, 1, or 2).

As cards are drawn and number tiles are placed, players must use deductive reasoning to determine which three suspects are on the eyewitness card. The first player to guess correctly wins the game.

Purpose of the project

The purpose of this project was to design a program which, given some input representing the state of the game, could accurately guess the correct suspects on the eyewitness card (assuming a player could only guess on his/her turn). A Python implementation of such a player program can be found at toac/player.py.

However, in order to truly test the intelligence of the player program, a dealer program (found at toac/dealer.py) was designed to simulate actual gameplay. To run the dealer program, simply invoke the program executable with the number of games to play, followed by the paths to two or more player programs.

Note that running the dealer program requires Python 3. Why? Because Python 3 is awesome.

./toac/dealer.py 10 ./toac/player.py ./toac/player.py

The dealer program will output statistics for each game as they finish, including winner and rounds elapsed. Once all games have finished, the program will output the total number of wins for each player, sorted by most wins.

Creating your own player

To create your own player program, you must write a program which follows a few simple rules:

Accepting input

The program must accept a string of JSON data via stdin; this data represents the current state of the game. See the provided example JSON (found at toac/example.json) for the structure/semantics of this data.

Returning output

After receiving game data as input, the program must write to stdout a JSON array containing the three suspects it thinks are on the eyewitness card. The order of this array does not matter, and any superfluous whitespace is simply ignored by the dealer program.

An example of such output might be ["hbu", "lel", "pto"], where each item represents one of the seven suspects in the game. Naturally, the value of each item must exist within the base_suspects array apart of the input JSON.

Incorrect guesses

Please also note that while you should strive for your program to produce an accurate guess, the dealer program will not penalize player programs for incorrect guesses.

Executing the program

Every player program must be marked as executable, and the dealer program will expect this to be so. To mark your program as executable, use the chmod utility:

chmod +x ./toac/myplayer.py

Changing game constants

If you should so desire, you may change the game constants defined in dealer.py, thereby changing the parameters which govern gameplay. The BASE_DECK constant should not be modified, though you may modify the MATCH_LENGTH and BASE_SUSPECTS constants to your liking. However, keep in mind that modifying either or both of these constants may considerably affect the performance of the dealer program for better or for worse.

Owner

  • Name: Caleb Evans
  • Login: caleb531
  • Kind: user
  • Location: Carlsbad, CA

Hi, I'm Caleb, a web developer who lives for Christ by building enjoyable apps and useful tools. I hope you are blessed by what I've made!

GitHub Events

Total
  • Push event: 3
Last Year
  • Push event: 3

Dependencies

requirements.txt pypi
  • colorama ==0.3.9
  • coverage ==5.3
  • flake8 ==3.6.0
  • flake8-polyfill ==1.0.2
  • mando ==0.6.4
  • mccabe ==0.6.1
  • mock ==2.0.0
  • nose ==1.3.7
  • pbr ==3.1.1
  • pycodestyle ==2.4.0
  • pyflakes ==2.0.0
  • radon ==2.2.0
  • rednose ==1.3.0
  • six ==1.11.0
  • termstyle ==0.1.11
.github/workflows/tests.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
  • coverallsapp/github-action master composite
pyproject.toml pypi