Code Monkey home page Code Monkey logo

clue's People

Contributors

jjhale avatar

Watchers

 avatar

clue's Issues

โœจ Compute valid moves

When it is your go you throw the die:

  • can move up, down, left and right
  • can't go diagonal
  • can't go though or enter a square which someone else is on.
  • can't use the same square more than once.
  • multiple people can be in a room
  • if you enter a room then you are done (e.g. i you throw 6 but the door is only 2 away you can just go in the room, but can't go thru it
  • you have to move
  • there is an edge case where you could get trapped inside a room - need to decide how to handle that

Want to create the action mask for which positions you can go to given:

  • your location
  • location of other players
  • die roll

The set of places you can go is defined by the end points of the set of simple paths (where each node in path is only visited once).

If the board is a graph represented as an adjacency list then we can find legal positions by doing a depth first search. We want to know if we have visited a vertex so we don't break the rule about reusing a square. Also want to not use square containing someone else.

Want to go down a path until we have used up the number of steps given by our roll of the die, or until we enter a room (door).

Board representation

  • each yellow square or doorway needs to be a node.
  • each node should have
    • a integer index
    • whether it is a door or not (could just be a room identifier?)
    • its i,j position on the board

We could use a graph library, but don't really need it i think.

Maintain card state

State API:

  • reset(players : List[Players])
    • starts a new game
    • let the players define the number and order of players.
    • sets up a new envelope and distributes the remaining cards between the players.
    • initializes the board.
  • step(action)
    • perform the action against the environment
    • needs to return all the things:
      • observations, rewards, terminations, truncations, infos

We need to represent the cards and figure out who knows what about them

There are three types of cards: 6 people, 6 rooms and 9 weapons. Each card is either in a player's hand or in the "Case File" envelope. Each player only knows what is in their hand initially, but player get shown cards in other peoples hands as the game progresses.

We can consider the state of the cards by who holds each card. Each player's certain knowledge of the cards can just be a mask over that list.

So we have:

  • card_data : Card - metadata about a card (name, type)
  • card_location : Player | Envelope - who holds the card
  • player_knowledge : Dict[Player, List[bool]] - what cards a player has seen.

The other knowledge a player has is

  • what Suggestions they and other players have made
  • players who don't have any of those in their hand.
  • the first player to have one of those cards in their hand.

So for each player we can have a suggestion vector of length 6*6*9=324. Each time a player makes a suggestion it would be flagged here. And then you have a corresponding proving false round, where we learn if the someone has none of the accused cards or one. To record the having none we can have list of cards not held by the other players.

So for each player:

  • card_not_held_by_player : Dict[Player, List[bool]]
    • updated if player can't disprove a suggestion
    • have full information for self - include or not?
  • card_held_by_player: Dict[Player, List[bool]]
    • can include self so we have similar shapes?

To handle having different number of players we can just allow some players out of the game and having zero cards in their hands.

People:

  • Miss Scarlet
  • Colonel Mustard
  • Professor Plum
  • Mr Green
  • Mrs White
  • Mrs Peacock

Weapons:

  • Rope
  • Lead Pipe
  • Knife
  • Wrench
  • Candlestick
  • Pistol

Rooms:

  • hall
  • lounge
  • dinning room
  • kitchen
  • ball room
  • conservatory
  • billiard room
  • library
  • study

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.