Hackish Hangman

Talk about YBoxen, widgets, Propeller hacking, etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
labelreader
 
Posts: 10
Joined: Mon Aug 18, 2008 7:59 pm

Hackish Hangman

Post by labelreader »

ThinkGeek is picking up the ybox2, and I wanted to do something as a demo for when we launched it (sometime early tomorrow [EDIT: Spoke too soon - should be later this week!).

So, here's a simple Hangman game I hacked together. It uses telnet as a controller, and a subset of words from the Jargon File as its word list. You connect for one round at a time, and get feedback at the command line as well as the TV screen. There are a few minor bugs (which I hope to fix shortly), but it's generally playable. Let me know what you think!

BTW, I have been tinkering with the ybox2 for a little while now, trying to come up with a multiplayer game that, like Hackish Hangman, can be controlled via telnet -- using Wi-Fi to turn laptops into very expensive wireless controllers. I didn't have a lot of luck allowing multiple simultaneous TCP/IP connections; from reading the code, there seems to be a hard limit of two connections allowed, and I wasn't sure whether that was there for my protection or just someone's moment of "no one will ever need..." billg-itude. Anybody know whether it's as simple as changing the limits in driver_socket.spin, or if doing that will bite me later on?
Attachments
hackish_hangman-0.1.1.tar.gz
(17.89 KiB) Downloaded 531 times
Last edited by labelreader on Wed Oct 29, 2008 1:06 am, edited 1 time in total.

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Hackish Hangman

Post by adafruit »

wow that is an awesome sounding demo. iirc the socket stuff was written by harrison, he may be here but id look for him on the parallax site

User avatar
harrison
 
Posts: 8
Joined: Mon Jun 09, 2008 3:55 am

Re: Hackish Hangman

Post by harrison »

The sNumSockets constant in driver_socket.spin is used to define the max number of concurrent sockets. You are limited by the amount of available hub ram since each socket's variables and buffers are statically allocated at compile time. You'll also need to change the Q_MAX constant in qring.spin (each socket requires 2 buffers, so you'll need to set this to 2 * sNumSockets).

You will probably also have to change a few lines in the ybox2's driver_socket.spin file that seem to have been stuck in there for testing purposes. I'm guessing darco put them in for testing and forgot to change them to use the defined constant.

Look in the methods 'isConnected' and 'isValidHandle' and change the lines:

Code: Select all

  if (handle => 2) OR (handle < 0)
    abort -111
to

Code: Select all

  if (handle => sNumSockets) OR (handle < 0)
    abort -111

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Hackish Hangman

Post by adafruit »

p00f! say his name and he appears :)
thanks for the assistance

User avatar
labelreader
 
Posts: 10
Joined: Mon Aug 18, 2008 7:59 pm

Re: Hackish Hangman

Post by labelreader »

Thanks, Harrison (and thanks to you, Lady Ada, for thusly invoking him!)! I noticed the hard-coded values in there -- that was part of what made me worry that there was a good reason to limit it to two connections. I'll give it a whirl.

User avatar
labelreader
 
Posts: 10
Joined: Mon Aug 18, 2008 7:59 pm

Re: Hackish Hangman

Post by labelreader »

Oh, BTW, if you want to connect to our Ybox2 to play the hangman game remotely, try this from your command prompt:

telnet 68.110.242.199 42

You won't get the cute (if slightly morbid) animated ASCII art that appears on-screen, but you can still enjoy the frustration of trying to guess Jargon File entries with no vowels...

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Hackish Hangman

Post by adafruit »

argh it is extra tough!

User avatar
labelreader
 
Posts: 10
Joined: Mon Aug 18, 2008 7:59 pm

Re: Hackish Hangman

Post by labelreader »

This update now tells you the fate of the last player, and what word they were challenged with. I also made it so the button hangs up on the current player instead of rebooting. I should probably code a timeout too.
Attachments
hackish_hangman-0.1.2.tar.gz
(18.76 KiB) Downloaded 468 times

adafruit
 
Posts: 12151
Joined: Thu Apr 06, 2006 4:21 pm

Re: Hackish Hangman

Post by adafruit »

cool. im going to post about it & put this in the 'example widgets' list, is that alright?

User avatar
labelreader
 
Posts: 10
Joined: Mon Aug 18, 2008 7:59 pm

Re: Hackish Hangman

Post by labelreader »

Wow, thanks! I'm honored.

User avatar
labelreader
 
Posts: 10
Joined: Mon Aug 18, 2008 7:59 pm

Re: Hackish Hangman

Post by labelreader »

Okay, this version fixes the few bugs I was aware of before tonight...it seems like it's possible to wedge the device with the wrong telnet client (the one that seemed to bork it was 'telnet' for iPhone by ThroughPut, Inc -- not a recommended buy, unfortunately).
Attachments
hackish_hangman-0.1.3.tar.gz
(18.94 KiB) Downloaded 512 times

User avatar
ex-h0trod
 
Posts: 22
Joined: Sun Jun 08, 2008 8:44 pm

Re: Hackish Hangman

Post by ex-h0trod »

thanks for the game. cool to see some new code.
labelreader wrote:Okay, this version fixes the few bugs I was aware of before tonight...it seems like it's possible to wedge the device with the wrong telnet client (the one that seemed to bork it was 'telnet' for iPhone by ThroughPut, Inc -- not a recommended buy, unfortunately).

User avatar
labelreader
 
Posts: 10
Joined: Mon Aug 18, 2008 7:59 pm

Re: Hackish Hangman

Post by labelreader »

We've had a bunch of people connect and then apparently hang up in ways that made the TCP/IP code not detect a disconnect, so I've added a timeout in this version.
Attachments
hackish_hangman-0.1.4.tar.gz
(19.38 KiB) Downloaded 486 times

Lusankya23
 
Posts: 1
Joined: Fri Feb 05, 2010 12:37 am

Re: Hackish Hangman

Post by Lusankya23 »

It seems the timeout in version 0.1.4 didn't fix the issue with people disconnecting in ways that would hang the program. When users disconnect in a certain way (like X'ing out the terminal window) it can essentially "freeze" the Listener cog completely, forcing you to power-cycle the YBox2. Here is a list of changes that I made:

* Added a "Medic" method on a separate cog that re-initializes the Listener cog if it freezes when players disconnect in a certain way
* Pressing the on-board button also re-initializes the Listener cog and makes a sad chirp
* Red LED when no one is connected
* Green LED and happy chirp when someone connects

Now you can leave Hackish Hangman running all day and all night without having to reset it :mrgreen: Enjoy!!!
Attachments
hackish_hangman-0.1.5.zip
(24.18 KiB) Downloaded 438 times

Locked
Please be positive and constructive with your questions and comments.

Return to “YBox2 (discontinued)”