You are not logged in.

#1 2014-07-31 02:39:15

bdjnk
Member
Registered: 2009-08-24
Posts: 78

Game: Hangman (en_US) for your console / command line, written in C

FpUwV5B.png?1
Hangman, as simply as possible. This is basically 80 lines of straightforward C code, and 80000 English words in a giant list.

AUR git: https://aur.archlinux.org/packages/hangman-git/
Source: https://github.com/bdjnk/hangman

For educational purposes, here is a fairly in depth analysis of the code

I haven't utilized this forum much, especially recently, but that's because my Arch installs work perfectly, and never break (seriously).

Speaking of which, this is my first AUR package, and my first C program released for actual public consumption, so if I've done something wrong, please let me know.

Thanks, and enjoy.

Last edited by bdjnk (2015-07-06 00:21:07)

Offline

#2 2014-07-31 11:21:00

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Game: Hangman (en_US) for your console / command line, written in C

Very nice! Even though it's small, not many people can say they've written a complete video game. smile

By the way, it's not true Hang Man unless I see a man get hanged! (But I'd even settle for a text description.) wink

Offline

#3 2014-08-01 21:59:13

bdjnk
Member
Registered: 2009-08-24
Posts: 78

Re: Game: Hangman (en_US) for your console / command line, written in C

drcouzelis wrote:

Very nice! Even though it's small, not many people can say they've written a complete video game. :)

By the way, it's not true Hang Man unless I see a man get hanged! (But I'd even settle for a text description.) ;)

Thank you :)

I updated. Now it can use any wordlist and has a minimum word size option. Use 'hangman -h' for details.

Unfortunately I didn't yet add in an ASCII art hangman, nor even a description. So far it's non-violent hangman, for our politically correct era ;)

Offline

#4 2014-08-01 23:41:15

iv597
Member
From: United States
Registered: 2011-09-18
Posts: 96
Website

Re: Game: Hangman (en_US) for your console / command line, written in C

There's an idea... a "--rated-r" flag to enable "Blood and Gore" mode... smile

Nice job!


Currently running Arch on a Samsung Chromebook Pro (dual booted with ChromeOS), and various VPSes and Docker containers.

Dotfiles on Github

Offline

#5 2015-07-06 00:22:54

bdjnk
Member
Registered: 2009-08-24
Posts: 78

Re: Game: Hangman (en_US) for your console / command line, written in C

I've updated the original post with this fairly in depth analysis of the code. I wrote it a while ago, but never linked it. Anyway, there it is for your reading pleasure.

Offline

#6 2015-07-06 00:40:49

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,334

Re: Game: Hangman (en_US) for your console / command line, written in C

Out of curiosity, why did you choose to not use argp from glibc?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Online

#7 2015-07-06 00:47:13

bdjnk
Member
Registered: 2009-08-24
Posts: 78

Re: Game: Hangman (en_US) for your console / command line, written in C

ewaller wrote:

Out of curiosity, why did you choose to not use argp from glibc?

I don't recall having seen it before. Thank you for bringing it to my attention.

Even if I had seen it though, I doubt I would've used it for the same reasons I didn't use getopt. First, excessive overhead for a couple simple arguments. Second, you need to experience the pain before you can appreciate the salve.

Offline

Board footer

Powered by FluxBB