Coder Social home page Coder Social logo

cluedo's Introduction

ClueDo

A bot that plays ClueDo. This bot controls a single player in the game and controls its own movements on the board.

Dependencies

To run the ClueDo bot, the following python packages are required:

  • networkx~=2.4
  • numpy~=1.18.1
  • PyInquirer~=1.0.3

Table of contents

BoardGraph.py -- contains the graph used to represent the ClueDo board

ClueDo.py -- contains the class used to track game information

PlayGame.py -- script for starting the game; run from the command line to play

Overview and demo

The bot uses PyInquirer to interact with the user. When you start the game by running:

python PlayGame.py

You will receive the following prompt, asking for participating characters to be selected:

? Which characters are playing?  (<up>, <down> to move, <space> to select, <a> to toggle, <i> to invert)
 ❯○ Rev Green
  ○ Dr Orchid
  ○ Colonel Mustard
  ○ Mrs Peacock
  ○ Miss Scarlett
  ○ Prof Plum

Then you will be asked to specify which of the characters the bot is to play:

? Which character will I be playing?  (Use arrow keys)
 ❯ Rev Green
   Colonel Mustard
   Miss Scarlett

And finally which cards the bot has been dealt.

? What are my cards?  (<up>, <down> to move, <space> to select, <a> to toggle, <i> to invert)
 ❯○ Rev Green
  ○ Dr Orchid
  ○ Revolver
  ○ Dagger
  ○ Candlestick
  ○ Ballroom
  ○ Hall
  ○ Miss Scarlett
  ○ Library
  ○ Conservatory
  ○ Wrench
  ○ Rope
  ○ Dining Room
  ○ Colonel Mustard
  ○ Lounge
  ○ Kitchen
  ○ Mrs Peacock
  ○ Lead Pipe
  ○ Prof Plum
  ○ Billiard Room
  ○ Study     

After selecting which player will go first, the game begins. On the bot's turn, the user will be prompted for a dice roll and asked whether any clue cards have been shown. Finally, at the end of the turn, if the bot has moved to a room, it will make a suggestion:

I have moved to the Library
Hm... what should I suggest...
I suggest Dr Orchid did it with the Rope in the Library
? If a player showed a card, please enter which one. If not, select None.  (Use arrow keys)
 ❯ Colonel Mustard
   Miss Scarlett
   None

On another player's turn, the bot will ask if the character has made a suggestion:

? Would Miss Scarlett like to make a suggestion?  (Use arrow keys)
 ❯ Yes
   No

And if so, will store information about the suggestion, e.g.:

? Please enter the character that was suggested.  (Use arrow keys)
 ❯ Colonel Mustard
   Prof Plum
   Mrs Peacock
   Dr Orchid
   Rev Green
   Miss Scarlett

and the outcome:

? Did Colonel Mustard show a card?  (Use arrow keys)
 ❯ Yes
   No

When the bot has enough information, it will make an accusation!

I have an accusation to make!

I accuse Mrs Peacock of doing the crime, with the Wrench in the Billiard Room

If you get to this point, it means the bot has won!

cluedo's People

Contributors

mgreenig avatar andrewmelville avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.