Hey guys,
I have been asked to write a program in php which is to play hangman but used in messenger chat. We are using imified to create our "bot".

The game to me sounds backwards to normal but here is the deign brief.

. In your game of hang-man, the user should pick the word and the bot should guess the word. The bot should be allowed 13 wrong guesses before it has lost. A sample game might look like this (user messages in bold, bot response in normal font):

hangman: __________
● How about E?
● Oh no! I only have 12 lives left :( How about I?
● Great! How about O?
● Hmm. Difficult. How about U?
● Interesting. How about P?
● Wonderful! How about X?
● Argh! Another life lost. Only 11 to go. How about T?
● Cool. How about N?
● Hmm. Difficult. How about G?
● Wonderful! How about M?
● Interesting. How about C?
● I win!

● choose random responses such as “Great!” and “Hmm. Difficult.” from a database of responses.
● give a useful error message if the user does not play the game as expected.
● guess the next letter using an algorithm that works as follows:
a. look at the length of the word that the user has entered
b. find all words in the british-english.txt dictionary of the same length, we’ll call this array of words the search array
c. determine the frequency of all of the letters that appear in words in the search array; guess the most frequent letter
d. if the bot has guessed wrongly, guess the next most frequent letter and repeat until it guesses correctly. If the bot has guessed correctly, then narrow the search array to include only those words with the letter occurring in the right places. Then go to step c. and repeat until the game is over.
● know how often it is likely to win. Write a program to go through each word in the british-english.txt dictionary and determine whether or not your bot could guess the word. Your bot will guess a word correctly if it can correctly guess every letter in the word before it makes 13 wrong guesses. Then the percentage of games which the bot will win is this:

(number of words guessed correctly/number of words in dictionary)*100

I won't lie it is for a uni project, and we have no idea on how to get started.

Help would be very much appreciated. Thank you :)

How dare you.I guess you are from university of wolverhampton.

I am the module leader. I will definately address this issue in class. I know who you are, I will make sure you face the consequences of your shameful actions.

commented: Oh Noes! +3

Hello Mr Rupert is look like you are looking for some code to learn about PHP aswell, good luck :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.