CluedIn Algorithm
Since there are no duplicate cards and the ordering of cards and turns does not matter, the data structure used in this algorithm utilizes eight sets. With players A, B, C (the user being player C), three sets contain the cards the user knows players have (sets A, B, C), three sets contain the cards the users know players do not have (sets A', B', C'), and two sets contain subsets of cards that the user knows players might have (sets Ã, B̃). The user knows that other players have at least one card in each subset of three in their "might-set" from the circumstances mentioned before.
In the second attempt of the project, the Python algorithm was exactly the same as the first attempt, except additional code was added to create a user interface via the built-in Tkinter GUI library. While this addition improved upon the flaws of the first phase, new flaws surfaced. Specifically, it became clear that Tkinter was too rudimentary for a multi-step program. Additionally, a Python program was too difficult to utilize while playing because of its lack of portability, needing a computer to use to run.
This project started because my siblings and I were playing the board game Clue and we ran out of the note sheets that help us keep track of our cards and questions. Instead of printing new paper sheets, I programmed an algorithm and dataset to keep track of the questions and card of every player in the game and make the most out of this information. What started out as a terminal-input Python program escalated into a full iOS app that gives the user the upper-hand when playing a game of Clue.
There are 21 cards in the game of Clue, each belonging to one of three categories: 6 suspects, 6 weapons, and 9 rooms. The goal is to determine the three cards that are hidden in an envelope at the beginning of the game, noting that every card belongs to a different category. With 3 players everyone starts with 6 cards, meaning there are 15 possible cards in the envelope. Over the course of the game, questions are asked and cards are shown, leading players to figure out the three cards that nobody has. A nuance of the game of Clue is that there are situations where players only have to inform others if they have at least one card within a set of three. Additionally, the user might not be the person being shown a card by another player, but they at least know the player has one of the three cards in question.
The first attempt of this project was to use the previously discussed data structures and analyses to make a Python program that takes keyboard input from the user and outputs text results for the user to read. However, this initial program was ineffective for two reasons: because any typos in the input from the user requires the re-typing of a lot of information, and because slowly reading the massive amount of text output from the program defeated the purpose of using a fast computer. Nevertheless, the output was accurate and the program accomplished all of the goals for this project.
In the final version of the project, the data structures and algorithm was translated into Swift, and integrated with widgets in the Xcode to make an iOS app. The app has 3 separate pages: one for setting up player opponent names and the users’ cards in hand, the second for inputting questions that various players make, the third for visualizing the results of the algorithm to see which cards were shown and which questions to ask.