Wayne Lambert
Helping travellers choose their next luxury holiday destination
A game centred on selecting a luxury holiday for the procrastinating traveller that cannot decide on their next destination.
There is a very small 'sleep' between each generated choice. This is a design decision to slow down the code so that the traveller can feel the suspense whilst the roulette wheel determines their fate.
The purpose of the project is to illustrate the implementation of randomised choices and the logging of them using Python's 'logging' module.
The starting point was to consider the logic of the game by thinking of a list of luxury travel destinations. Thankfully, this is an easy task for anyone with travel aspirations, so I picked 12 places where I would personally love to travel to. These are all stored within a dictionary where their values (i.e. their choices counter) is set to zero.
The next part was to use 'choices' from the random module to select a random destination for each iteration of the game's loop.
The running of the code is slowed down in order to build a bit of suspense in the game. It is slowed down by 0.003 seconds for each of the 1,000 iterations, representing a slowing down of circa 3 seconds. In a real game, there could be a lot more suspense built in, however I do not want to keep hiring managers and recruiters waiting for the outcome of the game when its purpose is to demonstrate usage of the libraries used.
Each choice was logged in a log file within the app's directory.
Some polish was applied to the game by creating an image for each of the 12 destinations and using that image dynamically when the winner is revealed on the destination screen.
Finally, the user has the option of viewing the log file contents. They are not actually viewing the log file itself because that sits securely on the server. They are the viewing the contents of the file which is rendered out to the HTML template.
Overall, I am happy with the development of the project. A recent refactor say the game's logic, the logging components, and the views separated into separate modules.
As further polish, a progress bar could be added to the application to give the user a visual indication of when the code will finish running.