Course:CPSC312-2023/Loldle

From UBC Wiki

What is the Problem?

Loldle is a League of Legends based spinoff of the game Wordle. The goal of the game is to correctly guess the identity of a League of Legends character (or champion). Every time the user makes a guess, the game makes a comparison with the following criteria: gender, position(s), species, resource, range type, release year. Each property is given a color and/or arrows corresponding to how close the user's guess was to the champion to find.

  • Correct indicates the property is an exact match.
  • Partial indicates a partial match.
  • Incorrect indicates there is no overlap.
  • A down arrow indicates the answer is before the answer's release year.
  • An up arrow indicates the answer is after the answer's release year.

According to loldle.net, here are the following details for each of the properties:

  1. Gender:
    • Male, Female, Other
  2. Position(s): Most played positions in game, i.e. if its play rate for a position is above 20% in the past 6 months, for all ranks.
    • Top, Jungle, Middle, Bottom, Support
  3. Species: There may be multiple species for one champion.
    • Human, Yordle, etc...
  4. Resource: The resource used by the champion in game.
    • Mana, Energy, Manaless, etc...
  5. Range type: How the champion hits other champions with right click in game. They are considered at least Ranged if they can buy Runaan's Hurricane.
    • Melee, Ranged, Melee Ranged
  6. Release year: When the champion was released to be played.
    • Any year between 2009 and today

What is something extra?

We will add the option to choose between difficulties: a normal mode and a hard mode. Choosing the normal mode will result in the inclusion of hints. These hints will be randomly generated among one of the champions' properties. The champion to guess is also randomly generated. In addition, the game will keep track of the number of guesses thus far, and will reset between games.

What did we learn from doing this?

Overall, we believe that it is suitable to implement Loldle using Prolog. The rule-based nature of prolog was beneficial for the implementation of our code. Translating Loldle into a rule-set was quite self explanatory, since the game is based on a set of rules in the first place. Thus, designing the base game into Prolog was simple and took little time. Generating random numbers was also simple to do in Prolog due to the existence of built-in predicates, unlike Haskell. Prolog's simple and powerful pattern-matching (due to its unification mechanism) also made it easy to extract information from champions seamlessly. One major disadvantage of Prolog was how difficult it is to debug. For example, the non-deterministic behavior of Prolog, makes it hard to pinpoint which part of the program is causing a certain bug. This issue is further magnified by the backtracking mechanism in Prolog; in combination of non-deterministic behavior, comparisons between the champion and the user's guess can be made in scenarios that should not be possible (e.g. when typing a champion that does not exist). Another issue we had was establishing our database. Due to the nature or Prolog, in order for our program to work, we needed to generate all the facts that are true for the program beforehand, and that led to a lot of manual labor (inputting 162 champions manually was not something we want to do ever again).

Links to Code

https://github.students.cs.ubc.ca/linky98/Loldle

To run, in terminal type swipl and compile the code. Then type play.