Skip to content

Instantly share code, notes, and snippets.

@rposborne
Created November 4, 2016 02:11
Show Gist options
  • Save rposborne/657aa1de2f2c3f9ccc636b7464cf3162 to your computer and use it in GitHub Desktop.
Save rposborne/657aa1de2f2c3f9ccc636b7464cf3162 to your computer and use it in GitHub Desktop.
Crash Course Hangman Solution
require './words'
puts "Hello, you are playing hangman!!!"
random_position = rand(@words.length)
selected_word = @words[random_position]
# selected_word = "moose"
lives = 7
guesses = []
puts "The word is "+selected_word.length.to_s+" letters long!"
loop do
puts "Guess a letter a-z"
guessed_letter = gets.chomp
guesses << guessed_letter
# Troubleshooting
p guesses
# I am a comment my contents will never be considered code.
if !selected_word.include?(guessed_letter)
lives -= 1
end
if lives == 0
puts selected_word
puts "whomp whomp"
break
end
winner = true
selected_word.chars.each do |letter|
if guesses.include?(letter)
print letter
else
print "_"
winner = false
end
end
puts ""
puts lives.to_s + " Lives Left "
if winner == true
puts "You won, but you were clever so your PM got mad."
break
end
end
@words = %w(
abduct
ablative
abloom
abound
abrasively
abusive
academician
accenting
accentuates
access
accumulating
accustomed
acquiesce
acquittals
actuary
adaptability
admiringly
admixture
admonitory
adventuresome
adverser
advisories
advisors
aeries
afoot
afterburner
afterglow
aglitter
agrarian
agreed
aide
aimed
akimbo
allergens
alteration
amalgamate
ambiances
amorally
amputated
amusement
ancestries
anchorman
anglers
angling
ankh
ankled
annihilating
anonymity
antimony
antiquities
aphelion
appetizers
appreciated
apprehensions
approach
approaching
approximates
aptitudes
aquanaut
aridity
armhole
armorers
arousing
arrowhead
artichokes
article
artsiest
ascribable
asked
assays
assuring
asylums
atrociousness
attenuates
atwitter
audiovisual
audition
auditoria
aureole
authentically
authorizes
automated
autonomous
availability
avenging
avidest
awards
axle
babied
backbite
backdrop
backpack
backpedal
backpedalled
backups
backwoods
bagginess
bailouts
baize
balked
balling
ballistics
ballparks
barbershop
bargains
barnstormed
barnyards
baroness
barrages
bassoonists
bather
batik
batiks
battle
bayberries
beak
beastly
beauteously
bedevilled
bedrooms
befalls
befouled
begonias
behavior
beheaded
beholder
behoove
bellows
bellwether
bellyaching
beloved
berates
berkeley
berliner
berrying
bertie
besiegers
bested
bestow
betokened
biassed
biennially
bigmouths
bigotries
billboard
billfolds
billings
biologist
bistro
bistros
bitter
blackbirds
blackthorns
blazed
blended
bless
blinding
blither
bloated
blob
bloc
blockade
bloodstreams
blown
bogeyed
bogs
bolton
bondage
bonita
bonkers
bonnet
boorishly
boosters
booth
borden
boringly
bosch
boswell
bourgeois
boyhoods
brads
brainchildren
brainstorm
branch
brand
brandeis
brave
breckenridge
brendan
brett
brew
brezhnev
brick
bright
brimstone
briny
brisked
brisket
bristlier
brittleness
brocade
broiling
brooders
broth
brr
btu
bucking
buddy
bullfighting
bullier
bullock
bulwark
bumpers
bunched
bundling
bunked
burglarizing
burgling
buries
burl
bursar
businesswoman
busted
busyness
butte
buttressing
buy
cabbages
cabin
cajoling
cajuns
californians
callings
calliper
callowest
calve
camellia
cameos
camshaft
canaveral
cannibalize
canny
canopy
cantata
capablest
capaciously
carcinogen
cardiologists
cargos
caricature
carrousels
carver
castration
catapults
catastrophic
catchier
caterwauls
cathy
caucusses
cauterizing
cautioning
cellos
censers
censor
centigrade
certificated
cetacean
chalet
chancellery
chanel
chapultepec
charolais
charring
charybdis
cheapest
cheater
checking
chicle
chiefest
chiller
chinese
chins
choler
choleric
choosy
choreograph
christoper
chronicler
chucks
chunks
ciphers
circumcision
civilized
claimed
clam
clammy
clamp
clampdown
clasped
claudia
clause
cleanup
clemson
clergy
clerical
clinchers
clorox
closure
clownishly
coats
cocteau
codification
coerced
coffees
coffers
cogitate
cohabiting
coincide
collide
colloquial
colonized
coloreds
colts
comas
comfort
commands
commercialism
compaction
compactors
compensation
competency
complemented
completion
components
comprehend
comprehensively
concatenations
concierge
concurrent
concussions
condensations
confederate
configurable
confirm
confirms
confiscations
conformed
confucian
congregated
conjunctive
conniving
consistent
constipation
constitutionals
constructions
constructive
consummate
consummating
contention
continentals
contingency
contraction
contractions
contradicts
controvert
conversed
converters
cookies
coolie
coordinate
coordinated
copied
copiously
cores
corey
corner
corny
corroded
corsica
cotes
councilors
count
countenancing
countersinks
couplets
cowley
cozen
crackles
crackliest
craftiness
crater
creams
creep
crested
crimsoning
cringed
cristina
critiques
crossbreeding
crowbars
crunched
cryptographers
cudgel
cue
cuffing
culverts
curates
cursedest
curtseys
cutesy
cuttlefishes
cyclades
cycling
dachshund
daftest
dali
dancing
daniel
darting
dashikis
daunt
daydreamer
dealers
dean
deann
debarring
debates
debentures
debora
debriefings
decalogue
deceptive
decommission
decompose
decomposes
deeds
defecation
defection
degeneracy
deicers
deliberate
delight
delphinus
demagogy
democratic
demoed
denigration
denominates
denting
depend
depicted
deplored
deprograms
descants
desecrated
desperate
destructing
detachment
detoxes
deviance
dewdrops
dexedrine
diapered
diarists
dickerson
dictaphone
digestion
dijkstra
dinginess
dings
diplomas
dirichlet
disaffection
disallowing
disapproving
disavowals
disbands
disbarring
disbelieved
discommoded
discomposure
disconnectedly
discuses
disengage
disfigurement
disgruntling
disinfected
disintegration
dismantles
disobedient
dispensaries
dispensers
display
dispossess
disproven
disputants
disrupted
disrupts
dissatisfy
dissembling
dissuading
distension
distincter
distinctest
distracts
distresses
distressful
distributed
disturb
dithers
dive
diversifying
divisible
divorcée
dixiecrat
dizzies
docility
docket
doctor
dogtrotted
dollop
dolloped
dolphins
dome
doored
dorm
dot
dotings
doubted
dourer
down
downstairs
dramatization
dreads
dribbling
driver
drudges
dryad
dryden
drywalled
dumbbells
dummies
dumpiest
dumpling
dumpsters
dunning
dusters
dustin
dustpans
dwarfed
earnestine
earnests
eavesdropper
ebeneezer
edginess
editorship
effectively
eggbeaters
egging
eggs
eiffel
elaboration
elbe
elegantly
elicit
eliot
elisha
elliptic
elvira
embellishments
emissaries
enacted
encarta
encountering
encrust
engineering
enjoins
enmesh
enrolment
enrolments
ensuring
entangling
entombed
entourages
entreats
envious
environment
eon
equinoxes
equitably
er
eradication
ericson
eros
errata
error
escher
espousal
esquire
establishments
etchers
eunuch
exceptionable
exciting
exclamatory
excrescence
execrates
exemplification
exhibiting
expands
expatriating
expectancy
expedient
explode
exploratory
exterminates
exterminating
exude
eyeteeth
fags
fain
falasha
falconry
fanaticism
fanciest
farmhouses
fascinations
fashions
fastnesses
faultless
favor
feasted
feat
feathers
felt
femur
fennel
ferment
fetters
fibbers
fictionalizes
fiddle
fiend
figaro
figureheads
fileted
filibusters
finagles
finely
fingering
finniest
firebomb
firetrap
firewalls
firmness
fischer
fizzier
flagellating
flagellum
flashes
flattered
flautists
fleck
fleece
fleeter
fleeting
fleetingly
flexible
flimsy
flirtatious
flog
floggings
floppy
florine
flour
flouring
flowing
fluid
fluorescence
flyleaf
follower
footsore
forager
foraying
forecloses
forerunner
forestry
forevermore
forgetful
forgiveness
forks
formality
forms
formulates
fought
foxhound
framers
franking
frederic
freezer
frenetically
fresco
friendlier
friendliest
fright
frightfully
frolics
from
frontage
frontiersmen
fruitcake
fruiting
frustration
fryer
furlough
furloughed
furniture
galaxies
galleys
galling
galloway
galores
galvanometer
gamete
gap
gatherer
gathering
gazetteering
gearshift
geisha
generate
geranium
geriatrics
girdling
glacial
glacially
glades
glenna
glittered
gloria
glut
gluten
gnarl
gnaws
gneiss
goaling
goalkeepers
goethe
goldwyn
gondwanaland
goodlier
goof
gorky
gout
governmental
grad
graham
grebe
grenada
grenadier
gridlocking
grievance
grouchier
ground
grouted
growled
grownup
grows
grudged
grudgingly
gruels
grumpily
guaranteed
guillotines
gunslingers
gurgles
gushy
gustavo
gustiest
gutter
gwalior
gwen
gybed
gyrated
haggard
hagglers
halloween
hallucination
hamiltonian
handmaiden
handpicking
hands
handshake
hangover
happily
hapsburg
harding
hardly
harmonica
hasidim
haunch
headlocks
headmasters
hecuba
heed
heedlessly
heightened
heightens
heinlein
helled
hellespont
helpmates
heralds
heroic
herschel
hershel
hewers
hibiscuses
hideouts
hillside
himalaya
histrionic
hoagie
hoarding
hoaxing
hokkaido
hokum
holidayed
holman
holocausts
holsters
homeboy
homestretches
homonym
honer
hoofed
horizontals
horsehair
hounded
housemaids
hoyle
hub
hugs
humidity
hunchback
hunchbacks
hurriedly
huskiness
hustlers
huts
hydroelectric
hysteria
hz
iconoclasts
idolize
ignores
illness
illumined
illumines
imagining
imbalances
impart
impeaches
impecuniousness
imperishables
impinging
implanting
imposed
impounding
inaction
inane
inappropriate
inappropriately
inaugurating
inconclusively
inconvenient
incorruptibles
increased
incumbency
incurables
indecencies
indecisively
indians
indistinctness
individualizes
indorse
inducements
inducing
inestimably
inexperts
inextinguishable
infatuated
infect
influences
influx
informality
information
informing
inhere
initialized
initializes
initializing
innkeeper
innuendoes
innuendoing
innuendos
insane
insentient
instances
institution
institutionalize
instrumentalists
insufficiency
insults
interactively
interconnections
interfaced
interferes
intermediaries
intermingled
intermittent
internally
interviewed
intimately
intransigent
intransitives
intuit
inventories
invoicing
invokes
irish
ironing
irrationally
isolationists
it
ives
iyar
izhevsk
jackhammered
jacob
jake
janell
jeez
jewellers
jiggles
jockstraps
jog
john
johnathan
journal
juggler
juicy
jujitsu
juliennes
jut
juxtaposes
kampuchea
kant
kennedy
kennels
kentucky
kermit
keypunching
kidder
kidnapper
kigali
kilobytes
kind
kinder
kindergartens
king
kingfishers
kinglier
kirchner
kislev
kit
kitchenware
knickers
kohlrabi
kris
kurile
kyushu
lagrangian
lakes
lambkins
lampooning
landlubber
landsat
landscaper
landsliding
langerhans
lardner
lards
lasso
latasha
laughingly
laundress
leagues
leakage
leann
leash
leashed
leather
lecturer
leeward
lemmas
lepke
lessen
lessening
lexicographer
liaisons
libraries
libretto
lien
likelier
liker
lilian
limberest
limitations
lindbergh
lingos
link
linotype
lipsticks
liquor
lithographer
liveries
lobing
lobsters
loch
loftiness
lollygag
lonnie
lorena
lousiest
loveliest
lozenge
lubricators
lug
lumping
luncheon
lures
lysenko
mackintosh
maimonides
maker
managing
manifold
manipulation
mannequin
maori
maps
marine
marines
marissa
marketable
marshier
marxist
maryann
masher
masquerading
massacre
mat
mathewson
matt
matts
mauls
maurois
mauve
maws
maximals
mayor
mccarthy
mcdaniel
meatball
megaton
melancholy
mellowing
melpomene
melville
mendicants
merited
merry
mesa
mesh
messieurs
metamorphose
methane
methodically
millage
millikan
milliliter
mind
minded
mineralogist
mines
minimalism
ministry
misappropriations
miscasting
miscues
misdiagnose
mishandles
mispronounced
mistrials
mitigates
mizzenmasts
moaning
moderators
modernizes
mohamed
moloch
moments
monarchists
monoliths
montserrat
moonshots
moose
morned
mortals
mortising
mountebank
mournfulness
moussorgsky
mucks
muddying
mullahs
mulled
mulligan
multiplier
mumbled
mummifies
municipals
muse
musketeer
muster
mycenae
mylar
mylars
n
namibia
naming
nappier
narrating
nausea
nazareth
nebular
nembutal
netscape
networked
neuters
nib
nibblers
nibbles
nibbling
nibelung
noels
nonphysical
nonproductive
norms
norplant
northbound
nostrums
notepaper
nowhere
numbest
nunnery
nyerere
objection
obliterated
oceanography
odd
oddball
odder
off
oiliness
okras
olajuwon
oldsmobile
olivia
onomatopoeic
opaquest
openest
operas
operational
opiates
opinion
oracular
oratory
ordinations
orthodoxies
outbuildings
outclasses
outcome
outed
outfielders
outfields
outhouses
outmaneuver
outranking
outsell
outstript
outweighs
outwitted
overage
overdressing
overestimates
overgrown
overlaid
oversee
overshoots
overspends
oversupplied
overwhelm
overworking
ovid
owl
oxyacetylene
oxygenating
pads
pahlavi
pajamas
paleogene
paleontologist
palermo
palestinian
palindromic
palmetto
pampered
panacea
pandemic
panegyric
panicky
pantomime
pantomiming
paradigmatic
paraná
park
parole
parry
parthenogenesis
particulates
passion
pastorates
pate
patenting
patrons
patronymic
patted
pavemented
paws
peacekeeping
peasants
peat
peddles
pederast
penalizing
pendulum
penile
peninsulas
penknives
pentagons
pentax
pepys
perceivable
perigees
perilling
periphery
periscopes
periscoping
perked
permeating
persecuted
persepolis
pervaded
petard
pews
philistine
phlegmatically
phosphor
phosphoric
photographing
photography
phrygia
physiologist
pictured
piddles
pilfers
pimply
pinups
piscatorial
pistils
pitiable
pizzeria
pkwy
placental
plastics
plausibly
playstation
pleasantries
pleasured
plebeian
pluperfects
poesies
pogromed
poised
poisoners
pokeys
polarity
poling
politics
polonaises
polyester
polysyllables
polytheists
pompously
pompousness
ponytails
poodles
portentously
position
possessions
postdates
postpartum
pothooks
potion
practising
pragmatist
prearrange
prearranges
preceding
precinct
preconditioning
predecessors
predefined
predominate
preexisting
preferentially
premiering
prerequisite
prescribe
presidencies
presume
presumptuously
pretenses
principal
principe
printable
priories
pristine
privatest
privatizations
privileged
process
prodigiously
profanation
profane
progesterone
proliferates
promise
prompts
proofed
properest
proportionality
pros
prosecute
prosody
prostrates
proteans
proteins
protest
protests
protoplasmic
provinces
provocatively
prudentials
pshaw
pterodactyls
publicist
publicly
pudgiest
pudgy
pungency
pupa
purchasing
purifiers
purina
pygmy
pyrex
quaking
qualitative
quids
quieted
quietest
quiets
quintessence
quipped
rabat
rabbit
racers
rackets
racqueted
radiant
ramona
rancher
ranges
rapport
rared
rasalhague
rather
ravish
rawest
raze
readouts
realists
rearrangement
reassure
rebekah
reborn
recapitulates
recaps
receivables
recesses
reciprocating
recitals
reclamation
reconnaissance
reconnected
record
redeems
redistrict
redo
redolence
redress
reduced
reeves
refashions
referenced
refine
reflexes
refocuses
reforest
reforesting
reformat
reformulate
refreshments
reggie
regimentation
regress
regularize
reining
religious
reloaded
remission
removable
renunciations
repeated
rephrasing
replenished
represents
represses
reproved
requisite
resenting
resound
respite
restorations
restriction
resumed
resurrects
retakes
rethink
retinal
revised
revocation
rhee
rhone
rhyming
rickety
rickie
ricks
rifest
rightfulness
rimbaud
ripeness
riper
ripes
riveted
robuster
roistering
rolling
rookies
roseate
roundhouse
ruffian
rumbaed
ruminating
ruses
ruthless
rutledge
rutted
saboteur
sadder
safes
salas
sale
salesgirls
salespeople
salinger
salmons
saltiest
salton
salving
sangfroid
sanitarium
sanitizes
sanka
sappier
saragossa
sarsaparilla
sat
satanic
satisfying
savannahs
sawhorse
scalawag
scalpels
scans
scares
scarlet
scenic
scheduling
schemed
schlockier
schulz
schuylkill
scorn
scotswoman
scoundrel
scour
scoutmaster
scraggly
scrapbooks
scratchiest
scrawls
screechiest
scribble
scrimps
scrupulously
seaside
seattle
seaways
secretes
segundo
sellers
semen
semiprofessional
send
sensationalist
senselessness
septics
septuagenarian
sepulchered
serened
sereneness
serpens
serpentine
serpenting
served
servility
seuss
shaka
shakier
shamefulness
shames
sharpshooters
sheaths
shedding
sheldon
shepherdesses
sheree
shipwrecking
shires
shockproof
shogun
shorthorn
shovelled
shrine
shucking
shuffle
sickliest
sidearms
sight
signalize
significantly
sikhism
silos
simplified
simulations
simulcasts
sistering
skew
ski
skied
skyline
skyscrapers
slake
slap
slaughterhouses
slavic
sledgehammer
slick
slimming
slimness
slivered
slowing
slum
smeared
smoked
smuggler
snail
snapple
snazzy
sneakers
sneeze
sniped
snotty
snowdrift
soapboxes
socialists
socially
soirées
solver
sombre
somersault
sooth
sophia
soppier
soreness
sorghum
sounded
soundest
southerner
southwards
soviets
sparrer
spartans
speakeasies
speculator
speculators
speedways
spheroid
spin
spindled
spinets
spitefullest
splash
splashdown
splashed
sponsors
spreed
springs
sprinkler
sprucest
spunkier
squabble
squalls
squelch
squid
squinting
squirrel
stabilizes
staci
stadium
stalwarts
stamen
stand
standing
star
stare
starts
station
statistician
statuesque
stealth
stencils
steroid
steve
sticklers
stigmatizes
stillest
stinkers
stinkings
stipulate
stockade
stomped
storehouses
stowe
strangle
strasbourg
strategist
stringiest
strings
stripling
stultified
stupendously
subcommittees
subprogram
subtrahends
succeeded
succession
suggesting
suicidal
suicides
suits
sulking
sully
summarizes
sump
sums
sunbeam
sunday
sunk
suntan
super
superintendent
supplicant
surceases
surety
surf
surfboarded
surgical
swattered
swatting
swearer
sweater
sweatshirt
sweeping
sweetie
swording
swordsman
syllable
symbolism
symbolization
systems
ta
tablelands
tablespoon
tabulation
tabulators
taine
takeouts
tallies
tangents
tangs
tangy
tans
tansy
taoists
tarpon
tarries
tarter
tattlers
teardrop
tearier
technical
teem
telecast
teleconferences
telegraphy
telemetries
teletypewriters
temperating
tendons
tenth
testament
textural
textures
then
therapies
thermonuclear
thermopylae
thinning
thornton
thorough
thralled
threesome
thresholds
throaty
throng
throughways
thrums
thuds
thunderclouds
tidbit
tightening
tillage
tillers
timetabling
tinder
tinkered
tinkling
tinseled
titan
toby
tong
tongan
tonsil
toolboxes
topped
toppled
topsy
tory
totalitarians
toughens
tousled
towelings
towpaths
trailblazers
trailed
transcribe
transform
transformer
transitions
transmitters
trappable
trappers
traversing
trawling
tremolos
triathlons
tricked
triplicate
trite
trochee
tropisms
trouping
truancy
true
truest
trumpets
trunk
trussed
truth
tsarina
turfing
turmoiled
turniped
turntable
turquoises
turtledoves
tushing
tweedledum
tweeted
twingeing
twinges
twinkle
typifying
tyroes
ultrasuede
ululate
unacquainted
uncatalogued
unclear
uncommonly
unctuous
unctuously
underachieved
underacted
underlays
underpinnings
underrating
underscores
underseas
undershirt
undershirts
understandably
underwrote
undeserving
unflappable
unforeseen
unfriendlier
ungrateful
unicorn
unidentifiable
unintelligent
unitarian
unitarianism
unkempt
unkind
unlikelier
unloosed
unmask
unmasking
unnaturally
unplanned
unsettling
unsolved
unspecific
untidier
unto
unwanted
unwariness
upchucks
upperclassman
uppercut
urbaner
urinated
usurpers
utopia
utopian
uvula
uvulas
vacillation
vagueing
vainer
valedictorian
valid
vanessa
varieties
vassalage
vazquez
vectoring
vectors
vegetarian
verballing
verdigrising
vibrant
victories
videoing
viewed
vijayawada
villa
villainies
vincent
vinegar
vinson
virgil
viscosity
vociferation
voicing
voltaire
volvo
voraciously
vote
vowels
waddle
walnut
wandering
wanton
ware
watchmakers
watercolor
wavelets
weakfishes
weariest
weatherproofs
weddell
wehrmacht
westernized
wharton
wheeler
whereupon
whimming
whipped
whirlwinds
whitecaps
whomsoever
whorl
wield
wiggling
wilburn
wilt
windburnt
windiest
windmill
wired
withstand
wolf
woodcut
woodenest
woodsy
woof
wranglers
wrenches
wryness
wyoming
xenon
xerox
years
yoknapatawpha
yuccas
yucking
zambezi
zanying
zenith
zeta
zibo
zimbabweans
zubenelgenubi).freeze
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment