Re:Show HN: Hangman in 3 lines of Python
by RodgerTheGreat on Sunday February 07, 2016 @02:12AM
(#11052029)
Sure, I could certainly compress it into a oneliner. I'm mainly focused on trying to make something simple with few moving parts. To that end I did a little more tinkering. Most pleasantly I was able to remove the conditional:
w: *1?("aardvark";"apple";"peanut";"etc") / pick a word
c: {|/w=/:x} / correctly guessed
b: {("_",'w)@'c x} / word with blanks
p: {`0:" > ";*0:`} / prompt for a letter
{~&/c x}{`0:b x; x,p[]}/"__"; `0:w,"\n";
EDIT: Realized words from usr/.. word list, not internet.