Beta

Hangman

Description:

This kata will be deleted soon.
Solve Hangman game instead

Hangman

Hangman is a paper and pencil guessing game for two or more players. One player thinks of a word, phrase or sentence and the other tries to guess it by suggesting letters, within a certain number of guesses.

Everytime the player misses a word, a part of the sketch is drawn:

Hangman

If the player finds the word before being hung he wins. He has 6 chances to miss before being hung.

Your task

You have to implement the function hangman that receives a word and an array of letters as arguments and has to return the result of the game:

input:

  • word: The word the player had to guess
  • letters: An array with the sequence of letters which the player guessed

output:

  • result: true if the player managed to find the word or false if he was hung

Example

Input: hangman('codewars',['a','e','i','o','u','c','d','p','r','k','l','j','h'])

Expected output: false

Games
Algorithms

Similar Kata:

Stats:

CreatedDec 25, 2015
PublishedDec 26, 2015
Warriors Trained169
Total Skips1
Total Code Submissions703
Total Times Completed64
JavaScript Completions41
C# Completions14
Ruby Completions16
Total Stars5
% of votes with a positive feedback rating90% of 36
Total "Very Satisfied" Votes32
Total "Somewhat Satisfied" Votes1
Total "Not Satisfied" Votes3
Total Rank Assessments40
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • gabrielsiedler Avatar
  • omegahm Avatar
  • ZozoFouchtra Avatar
  • brunolm Avatar
  • CorsaiR Avatar
  • hobovsky Avatar
Ad