Ghost is a word game (look it up on Wikipedia if you want for more detailed instructions). The idea is that the player and the computer take turns to add letters to a string of letters in order to build towards a word. The person who actually makes a word, or adds a letter such that the string can never become a word, loses. (The Wikipedia explanation is more concise, sorry.) This program uses a modified version of an n-gram language model to intelligently play the game against a player. This is a technique in the field of computational linguistics and natural language processing.
Programming by @MicroWolf Word list from the whitelist by @griffpatch NOTE: all letters are in LOWERCASE. So, an l is an L, not an i. NOTE: the word list is incomplete, as it is an approved whitelist. There are words that aren't in it!!! So, you might find yourself losing more than you should be. Sorry - nothing can be done.