VB.NET
मैंने इसे अभी तक सिकोड़ने की कोशिश नहीं की है, लेकिन:
पहला सिकुड़ना:
दूसरा सिकुड़ना (3759 अक्षर):
Module Hangman
Sub Main()
Dim m As Int32, w = "banana|apple|pear|dog|cat|orange|monkey|programming|hangman".Split("|")(New Random().Next(9)), g = "", e = "", x, c As Char, f As Boolean, r = Sub(z) Console.Write(z), p = Sub(y, h) Console.SetCursorPosition(y, h), a = Sub() Console.Clear(), q = Function() Console.ReadKey(1), d = Sub()
r(" +--------+S | |S |S |S |S |S |S |S |S |S |S |S |S |S |S |S |S |S |S |S |S |S |S ---------------------".Replace("S", vbCrLf))
p(0, 2)
r(String.Join(vbCrLf, " /------\S | O O|S \ ... /S ------ S | S | S | S | S -------+-------S | S | S | S / \ S / \ S / \ S / \ ".Split("S").Take(m * 4)))
End Sub
Console.CursorVisible = 0
Do
a()
d()
p(30, 10)
f = 0
For Each x In w
If g.Contains(x) Then
r(x)
Else
r(" ")
f = 1
End If
Console.CursorTop += 1
Console.CursorLeft -= 1
r("_")
Console.CursorTop -= 1
r(" ")
Next
If Not f Then
a()
d()
p(30, 10)
r("You win! Press any key to close.")
q()
End
End If
p(30, 13)
r(e)
Do
c = q().KeyChar
Loop Until Char.IsLetter(c)
If g.Contains(c) Then
e = "You have already guessed that letter."
Else
g &= c
If w.Contains(c) Then
e = "There is a" & If("aehilmnorsx".Contains(c), "n", "") & " """ & c & """ in the word."
Else
e = "There is no """ & c & """ in the word. Try again."
m += 1
End If
End If
Loop Until m = 4
a()
d()
p(30, 10)
r("You lose! Press any key to close.")
q()
End Sub
End Module