1. my first application in euphoria: a simple hangman
- Posted by kobi Apr 24, 2012
- 1312 views
hi all,
please see http://openeuphoria.org/pastey/117.wc
my first application in euphoria - all suggestions are welcomed!
- clearer code,
- library functions i should know about,
- ways to make it more concise,
- or other language idioms to learn from
Thanks, Kobi
2. Re: my first application in euphoria: a simple hangman
- Posted by gbonvehi Apr 24, 2012
- 1240 views
hi all,
please see http://openeuphoria.org/pastey/117.wc
my first application in euphoria - all suggestions are welcomed!
- library functions i should know about,
Hi Kobi,
I must say it's a very good code for being your first program, great work!
One function that you should use there is wait_key http://openeuphoria.org/docs/std_console.html#_942_wait_key , it stops execution until you press something so you can wait for input instead of refreshing constantly.
keypress = wait_key() -- You can remove the -1 check when using this :)
Cheers,
Guillermo
3. Re: my first application in euphoria: a simple hangman
- Posted by jimcbrown (admin) Apr 24, 2012
- 1254 views
hi all,
please see http://openeuphoria.org/pastey/117.wc
my first application in euphoria - all suggestions are welcomed!
- library functions i should know about,
Hi Kobi,
I must say it's a very good code for being your first program, great work!
One function that you should use there is wait_key http://openeuphoria.org/docs/std_console.html#_942_wait_key , it stops execution until you press something so you can wait for input instead of refreshing constantly.
keypress = wait_key() -- You can remove the -1 check when using this :)
Cheers,
Guillermo
What about maybe_any_key() ?
http://openeuphoria.org/docs/std_console.html#_953_maybe_any_key
4. Re: my first application in euphoria: a simple hangman
- Posted by euphoric (admin) Apr 24, 2012
- 1213 views
What about maybe_any_key() ?
I think he's getting user input (letters for the hangman game), not just wanting a keypress, so maybe_any_key() wouldn't work.
5. Re: my first application in euphoria: a simple hangman
- Posted by jimcbrown (admin) Apr 24, 2012
- 1221 views
What about maybe_any_key() ?
I think he's getting user input (letters for the hangman game), not just wanting a keypress, so maybe_any_key() wouldn't work.
Ah, you're right.
6. Re: my first application in euphoria: a simple hangman
- Posted by Lnettnay Apr 24, 2012
- 1199 views
Hi Kobi,
Your program is pretty nice. There are a few nitpicks I have:
- Most hangman games I have seen give 7 to 11 bad guesses. The player is not penalized for correct guesses.
- Yours gives 20 total (bad and good). Unless one of the letters is in the last 6 of the alphabet (uvwxyz) it is possible to win just by going through the alphabet in order.
- There is only one puzzle available. It would be better to have a list of words and pick randomly from them.
All in all, it's a good first effort.
Lonny
7. Re: my first application in euphoria: a simple hangman
- Posted by kobi Apr 25, 2012
- 1145 views
hi all,
please see http://openeuphoria.org/pastey/117.wc
my first application in euphoria - all suggestions are welcomed!
- library functions i should know about,
Hi Kobi,
I must say it's a very good code for being your first program, great work!
One function that you should use there is wait_key http://openeuphoria.org/docs/std_console.html#_942_wait_key , it stops execution until you press something so you can wait for input instead of refreshing constantly.
keypress = wait_key() -- You can remove the -1 check when using this :)
Cheers,
Guillermo
Thank you!
your suggestion now removes the flicker, and I only had to move a few lines, for some logic to be evaluated sooner.
I have programmed for a few years in C# and Factor. I find euphoria refreshing and challenging. some languages have such a large surface area, so many libraries and complexity of implementation. Euphoria is so simple and transparent, offering one tool instead of many. (atoms, sequences, and seq manipulations) I enjoy solving/creating with primitives instead of huge libraries. (the basic constructs though are advanced and smart) so I try to become proficient in Euphoria.
Factor is a very good programming language that encourages refactoring, and I may port some functions over to euphoria, the ones that I'll find missing.
8. Re: my first application in euphoria: a simple hangman
- Posted by kobi Apr 25, 2012
- 1149 views
Hi Kobi,
Your program is pretty nice. There are a few nitpicks I have:
- Most hangman games I have seen give 7 to 11 bad guesses. The player is not penalized for correct guesses.
- Yours gives 20 total (bad and good). Unless one of the letters is in the last 6 of the alphabet (uvwxyz) it is possible to win just by going through the alphabet in order.
- There is only one puzzle available. It would be better to have a list of words and pick randomly from them.
All in all, it's a good first effort.
Lonny
Hi, nitpicks are also welcomed :))
thank you - you're absolutely right, I didn't think of good guesses vs. bad guesses.
the program was mainly to evaluate and see how euphoria feels. I was reading and reading, but had to start coding something, too.
Thank you. perhaps a followup will ensue
9. Re: my first application in euphoria: a simple hangman
- Posted by petelomax Apr 25, 2012
- 1170 views
nitpicks are also welcomed :))
One tiny thing I spotted:
65 <= normalized and normalized <= 90 -- within A..Z
could equally be written as
normalized >= 'A' and normalized <= 'Z'
Pete