Course:CPSC312-2016-Shiritori

From UBC Wiki

Shiritori

Authors: Edward Lee, (looking for partners)
Appointment: Friday, October 28, 2016: 10:45am (Rui)

What is the problem?

Have you ever played Shirotori or Word Chain? Many people have played this game or a varying form, the name of the game is easily forgotten so names can vary. This game is a Japanese word game in which the players are required to say a word which begins with the final letter of the previous word. "Shiritori" literally means "taking the buttocks" or "taking the end". One player starts the game with any word of their choosing which follows the rules, and the next player must answer with a word that begins with the last letter of the previous player's word.

Rules of the Game

Rules of the game:

  • Take turns to play.
  • Only nouns, verbs, and adjectives are permitted.
  • Words may not be repeated.

What is the something extra?

What is the in-depth aspect you will do? If the problem is related to some other groups, tell us how they fit together. If in doubt, include it.

Players can also choose to play with words in specific genres, such as: animals, countries.

Additionally, this game will also attempt to check whether or not you are cheating. The game will return a false output if it detects you are cheating. Cheating:

  • starting with a word that does not start with the last letter of the previous word.
  • inputting a nonexistent word.
  • inputting a word that does not correspond to the game genre, like country or animal genre.
  • trying to repeat words that have already been used

What did we learn from doing this?

(This should be written after you have done the work.) What is the bottom-line? Is logic programming suitable for (part-of) the task? Make sure you include the evidence for your claims.

Prolog is efficient in checking dictionaries, quickly finding matches or discrediting matches, making it suitable for this Shiritori game in that sense. However, adding large dictionaries into prolog is unsuitable and would much rather parse the info from the web if I knew how. Dictionaries are large and hold many unconventional syntax like single quotations, dashes, hyphens, etc. Additionally, the syntax rules are very important in prolog, no capitals, no symbols, etc, thus' making it tedious transferring over dictionary words into the program. I had to convert large amounts of data from modern day colloquial syntax to words separated by commas, undercased, and the removal of all symbols.

Prolog does help when it comes to organising the rules and what must come first and next. As seen in this function, lastOfWord(A,C), begOfWord(H,D), D == C, \+ aListedWord(D), B = H. Every step is being taken care of one at a time, before the other, making sure it finishes one prerequisite before the next. Dynamic variable assertions are also very useful, knowing when and where dynamic variables are being used is very helpful in making sure it's being used in the proper way. \+aListedWord(apple), B = apple, assert(aListedWord(B));.