Giter VIP home page Giter VIP logo

hangman's Introduction

Hangman

Created : September 2017

This is a quick script I wrote to solve hangman puzzles. The "word" string is declared with known letters and unknown letters (represented by an asterick). There is an array of guessed letters. The script loops through a file of 479,000 known English words, printing out all that match the parameters given. Credit for the dictionary goes to dwyl/english-words.

This is not a complex script, nor is there an intuitive interface. I wrote this in 10 minutes to solve a hangman contest online. Possible improvements would be a better interface (even just CLI arguments), or more intelligent guessing. A dull solution could be to dynamically accept letters, and print out appropriate responses and likely guesses based on the statistics of possible words. For example:

> python hangman.py "e*ep***nt"

> "There are 38 words that match this expression. Guess the letter 'h' next."

Other more interesting implementations could be to use a machine learning algorithm to intelligently guess letters and play the game by itself until it is solved (or a point of unsolvability), or be able to give it hints "this is a food" or "this is an animal" and have the program intelligently guess based on those. But I will likely never do that.

hangman's People

Contributors

aknobloch avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.