Answer to Question #10217 in Prolog for Kostas
% "display phrase" with blanks in it, and the code of the letter that was just guessed. If the guess
% was right, call substitute to put the letter in the display phrase and check for a win. Otherwise, just
% get another guess from the user.
substitute(AnsList, BlankList, GuessName, NewBlanks),
processGuess(AnsList, BlankList, _, CountFailed) :-
( CountFailed == 5
-> format('Sorry, game over. You didn\'t guess (~s)~n', [AnsList])
; write('Wrong Try Again!'),
CountFailed1 is CountFailed + 1,
getGuess(AnsList, BlankList, CountFailed1)
The main idea is to make a list where i will put all the wrong letters the user gave and check it everytime he gives another wrong letter
Submit it with all requirements as an assignment to our control panel and we'll assist you.
Need a fast expert's response?Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!