## (note (code cslai))

Notes on codes, projects and everything

## Introduction

We were asked to develop a program that demonstrate Artificial Intelligence and apply what we had learned in class into the program. Then we came out with an idea to develop a program that is able to do tarot reading. At first the program did not have a GUI and is operated through Swi-Prolog interpreter but in the end we included a GUI-frontend for the program using XPCE.

First the program will require 3 random numbers from the user, then a random number will be generated as the seed. Then the card will be “shuffled” (in fact, we did some calculations to the user provided random numbers) and then determine the orientation of the card (normal and reversed). Then, we use the computed number to pick a tarot card and get the reading based on the orientation.

## Technical Information

### Shuffling the Cards

To shuffle the cards, we use a random number and place the random number into the formula such that $$c=x^y\text{ mod }23$$ where c is the corresponding card number, x is the user provided number and y is the system generated random number. Then the orientation of the card is determine by calculating the mod 2 of the random number.

### Search Strategy

To implement simple search strategy, we used a hash function to divide the total of 22 major arcana cards into 5 groups. Each group will have one individual database file storing the card characteristics and reading. Then, depending on the calculated number, the system will choose to query which database file to decrease the inclusion of database files. We may not be able to observe the performance enhancement as we only have 5 database files but it should be more obvious for system with more database files.

### GUI-Frontend

I am the developer for the GUI front-end. At first we planned to write the GUI using other languages/platforms but because of the time constraint we decided to give up on GUI front-end. However, I managed to pick up basic XPCE GUI construction just in time and made a GUI for the program. However, the GUI is not very friendly and is not able to display images. Because XPCE is a multi-platform supported toolkit therefore the appearance of the GUI is consistent in various supported operating system.

## Screenshots

2. ### Display Result

The program displays the result after computing the input.

The program is reading input through GUI

4. ### Display Result

The program displays the result through the GUI

## Credits

• GUI by Me
• Core logic by Regina
• Database entry by Janet and Janice, modified by Regina

## Random Posts

• ### My evil evil form and database library

Writing a usable form and database library has always been a painful experience. So why bother re-inventing the wheel when there are so many to choose from already? I am writing one mostly for learning purpose. After numerous attempts, I finally get my form and database library in shape. It is nowhere complete, but nor it is perfect, but it is currently the implementation that is closest to my original design. I will keep working on it so it can be used in my personal projects in the future.

• ### Recommender System Classification

Had a discussion with my secondary supervisor and it turned out pretty bad because I wasn’t fully prepared and he was rushing to somewhere else for a meeting. So I am jotting down a brief summary (read: highly based on personal/subjective feelings/opinions) of my readings here to help organize things before the followup meeting that is taking place next week.