This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#51 2012-02-26 20:29:30

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Cheating Hangman Game Help!

steaksauceyum wrote:

Greenatic wrote:

steaksauceyum wrote:


This is a bit confusing haha.  I'll give it a go now.  If you could produce code using the one I sent you with the one you created, that would be appreciated too! I just want to see how to mix them together.  Text is harder to visualize haha

Gkc's script seems to work pretty well.  You just need to add in the part that prevents the total number of possible words from going to 0, as well as what to do if it hits 1.

Yeah I took a look at his.  But it seems as though that the game never chooses another word.  It changes over and over again after the first guess and goes on and on.  Why does it do that?

It has 1799 words.   tongue   Put it in turbo mode.

Offline

 

#52 2012-02-26 20:37:14

steaksauceyum
New Scratcher
Registered: 2012-02-23
Posts: 14

Re: Cheating Hangman Game Help!

Greenatic wrote:

steaksauceyum wrote:

Greenatic wrote:


Gkc's script seems to work pretty well.  You just need to add in the part that prevents the total number of possible words from going to 0, as well as what to do if it hits 1.

Yeah I took a look at his.  But it seems as though that the game never chooses another word.  It changes over and over again after the first guess and goes on and on.  Why does it do that?

It has 1799 words.   tongue   Put it in turbo mode.

Ok I'm new to this haha, is there really a turbo mode?
Also, I designed my game (without the cheating algorithm) to ask for the length of the word you want to play with.  Could this be used to make the "searching" for the new word a bit faster?  Like have it only search through words with the same length as the the specified by the player at the start of the game?  Or is that what GKc's code already doing?

Sorry if these are noobish questions, I just have a hard time visualizing code. (hence why I'm having a hard time implementing the cheating algorithm into my code).

Offline

 

#53 2012-02-26 20:58:09

Greenatic
Scratcher
Registered: 2009-05-03
Posts: 1000+

Re: Cheating Hangman Game Help!

steaksauceyum wrote:

Greenatic wrote:

steaksauceyum wrote:

Yeah I took a look at his.  But it seems as though that the game never chooses another word.  It changes over and over again after the first guess and goes on and on.  Why does it do that?

It has 1799 words.   tongue   Put it in turbo mode.

Ok I'm new to this haha, is there really a turbo mode?
Also, I designed my game (without the cheating algorithm) to ask for the length of the word you want to play with.  Could this be used to make the "searching" for the new word a bit faster?  Like have it only search through words with the same length as the the specified by the player at the start of the game?  Or is that what GKc's code already doing?

Sorry if these are noobish questions, I just have a hard time visualizing code. (hence why I'm having a hard time implementing the cheating algorithm into my code).

Turbo mode in Flash:  Hold down the shift key and click the green flag.
Turbo mode in Scratch:  Edit > Set Stepping Speed > Turbo.   smile

One of the flaws of gkc's script is that it doesn't replace words after you delete them.  You should make another list, and at the beginning, clear out the word list being used and copy over the duplicate list.

There's a code snippet near the beginning of my project that will clear out all words that do not match the length given.   smile

Last edited by Greenatic (2012-02-26 21:01:05)

Offline

 

#54 2012-02-26 21:21:06

steaksauceyum
New Scratcher
Registered: 2012-02-23
Posts: 14

Re: Cheating Hangman Game Help!

Greenatic wrote:

steaksauceyum wrote:

Greenatic wrote:


It has 1799 words.   tongue   Put it in turbo mode.

Ok I'm new to this haha, is there really a turbo mode?
Also, I designed my game (without the cheating algorithm) to ask for the length of the word you want to play with.  Could this be used to make the "searching" for the new word a bit faster?  Like have it only search through words with the same length as the the specified by the player at the start of the game?  Or is that what GKc's code already doing?

Sorry if these are noobish questions, I just have a hard time visualizing code. (hence why I'm having a hard time implementing the cheating algorithm into my code).

Turbo mode in Flash:  Hold down the shift key and click the green flag.
Turbo mode in Scratch:  Edit > Set Stepping Speed > Turbo.   smile

One of the flaws of gkc's script is that it doesn't replace words after you delete them.  You should make another list, and at the beginning, clear out the word list being used and copy over the duplicate list.

There's a code snippet near the beginning of my project that will clear out all words that do not match the length given.   smile

Ok cool thanks!
I'm a bit confused about all of these lists  hmm   In my original hangman I have "guessed words" and "words" ("words" being the large list of words used to pick a word)

I'm confused about what the other lists mean and do. Do you mind explaining them?  I'd appreciate it! I suppose we should stick to Gkc's version? But if you could explain what your lists did in your version (C1, C2, Bool) that would be awesome too!

Offline

 

#55 2012-02-26 22:04:10

steaksauceyum
New Scratcher
Registered: 2012-02-23
Posts: 14

Re: Cheating Hangman Game Help!

steaksauceyum wrote:

Greenatic wrote:

steaksauceyum wrote:


Ok I'm new to this haha, is there really a turbo mode?
Also, I designed my game (without the cheating algorithm) to ask for the length of the word you want to play with.  Could this be used to make the "searching" for the new word a bit faster?  Like have it only search through words with the same length as the the specified by the player at the start of the game?  Or is that what GKc's code already doing?

Sorry if these are noobish questions, I just have a hard time visualizing code. (hence why I'm having a hard time implementing the cheating algorithm into my code).

Turbo mode in Flash:  Hold down the shift key and click the green flag.
Turbo mode in Scratch:  Edit > Set Stepping Speed > Turbo.   smile

One of the flaws of gkc's script is that it doesn't replace words after you delete them.  You should make another list, and at the beginning, clear out the word list being used and copy over the duplicate list.

There's a code snippet near the beginning of my project that will clear out all words that do not match the length given.   smile

Ok cool thanks!
I'm a bit confused about all of these lists  hmm   In my original hangman I have "guessed words" and "words" ("words" being the large list of words used to pick a word)

I'm confused about what the other lists mean and do. Do you mind explaining them?  I'd appreciate it! I suppose we should stick to Gkc's version? But if you could explain what your lists did in your version (C1, C2, Bool) that would be awesome too!

Woop's didnt realize this was already explained.  haha sorry!
I guess my real problem is: how do the lists all fit together? From my "words" to the other ones you created, how do they work together?  Just a simple explanation would suffice.  Thanks!

Offline

 

#56 2012-02-26 22:20:26

steaksauceyum
New Scratcher
Registered: 2012-02-23
Posts: 14

Re: Cheating Hangman Game Help!

Also I just noticed that gkc's code allows the computer to change the word to a different number of letters.  For example, "line" was the word to be guessed, but when I guessed "l" the computer chose the word "the."

Offline

 

#57 2012-02-27 14:48:22

steaksauceyum
New Scratcher
Registered: 2012-02-23
Posts: 14

Re: Cheating Hangman Game Help!

Smozzick wrote:

Well my code is much longer than the above (Read: Badly written) but it's effectively the code for a cheating hangman game:

Link to Project

I really like how you handled it. But is there anyway to just use a list or variable to express if the letters you guessed were right or wrong?

Offline

 

#58 2012-02-28 12:16:10

Smozzick
Scratcher
Registered: 2011-10-23
Posts: 100+

Re: Cheating Hangman Game Help!

steaksauceyum wrote:

Smozzick wrote:

Well my code is much longer than the above (Read: Badly written) but it's effectively the code for a cheating hangman game:

Link to Project

I really like how you handled it. But is there anyway to just use a list or variable to express if the letters you guessed were right or wrong?

Thanks ^^ As to changing how it handles wrong or right...first I should say that that's only on stage because I was using it for testing lol. If you go into it then wherever it has

broadcast [correct v]
or
broadcast [wrong v]
just replace them with something like:

set [LetterIsRight v] to [1]
or

set [LetterIsRight v] to [0]
Note: A lot of people use True or False but I use 1 or 0, same meaning.

---

Really, though, there isn't much reason to keep track of whether the letter guess was right or wrong since if it appears in the word then it'll be stamped...

Hope you find this useful.

Last edited by Smozzick (2012-02-28 12:16:54)


http://i50.tinypic.com/ded8m.png

Offline

 

#59 2012-04-20 07:45:20

gkc
Scratcher
Registered: 2009-09-17
Posts: 23

Re: Cheating Hangman Game Help!

I MADE A SCRIPT THAT WORKS!!! (http://scratch.mit.edu/projects/gkc/2358434)  smile

Offline

 

Board footer