Qbasicnews.com
December 15, 2019, 04:24:18 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: Back to Qbasicnews.com | QB Online Help | FAQ | Chat | All Basic Code | QB Knowledge Base
 
   Home   Help Search Login Register  
Pages: 1 [2]
  Print  
Author Topic: Word Scrambler (kind of) Challenge  (Read 9234 times)
ToohTooh
New Member

Posts: 24



« Reply #15 on: September 22, 2004, 02:39:56 PM »

Quote
"Behold, I teach you the superman."
- Thus Spake Zarathustra, The 'Miracle Man' Series.

Talking rubbish? Anyway, evening, y'all...
Logged

Don't interrupt me while I'm interrupting." - Winston S. Churchill
wildcard
*.*
Administrator
__/--\__
*****
Posts: 2369



« Reply #16 on: September 22, 2004, 04:06:31 PM »

There are different types of efficieny. Speed and size. Lets not have driveby comments and such, constructive cristiscm is lot harder but a lot better.
Logged
Meg
Ancient QBer
****
Posts: 483


« Reply #17 on: September 22, 2004, 04:12:19 PM »

What I'm looking for is neat, easy-to-follow code which is contained in one function.  The reason for keeping this to one function is simple:  it's a CHALLENGE.  Sure there's ways of doing this which results in calls to one-task functions, each one more refined than the last.  That's standard programming procedure.  But this is limited because it's supposed to make people think outside of the "usual."  That's why it's a challenge.

So, do your best within the limitations.  It's not that complex a task.

Antoni, I went ahead and wrote my own entry to this contest after I'd posted it, and now that I look I realize that mine's VERY close to the one you entered! ^_^

My entry doesn't count, of course.  So far Antoni is the only valid entry.  Let's see if anybody can do better!

This was mine:
Code:
DECLARE FUNCTION Jumble$ (t$)

LINE INPUT InputText$
PRINT Jumble$(InputText$) + "-"

FUNCTION Jumble$ (InputText$)

InputText$ = InputText$ + " "
Ends$ = "0123456789!$&() ,.?';:" + CHR$(34)

FOR Position% = 1 TO LEN(InputText$)
     Letter$ = MID$(InputText$, Position%, 1)

     IF INSTR(Ends$, Letter$) THEN
          IF Word$ > "" THEN
               J$ = J$ + LEFT$(Word$, 1)
               Word$ = RIGHT$(Word$, LEN(Word$) - 1)
               WHILE LEN(Word$) > 1
                    x% = INT(RND * (LEN(Word$) - 1)) + 1
                    J$ = J$ + MID$(Word$, x%, 1)
                    Word$ = LEFT$(Word$, x% - 1) + RIGHT$(Word$, LEN(Word$) - x%)
               WEND
               J$ = J$ + Word$
               Word$ = ""
          END IF
          J$ = J$ + Letter$
     ELSE
          Word$ = Word$ + Letter$
     END IF
NEXT Position%

Jumble$ = LEFT$(J$, LEN(J$) - 1)

END FUNCTION


*peace*

Meg.
Logged
Z!re
*/-\*
*****
Posts: 4599


« Reply #18 on: September 22, 2004, 06:19:16 PM »

Efficient code is when you can read it easily, and it's fast, and get's the job done.

Easy code, is when you can understand it and follow it easily by reading it.



It's like this:
"How do I play a wav file in QB?"
"Duh, Call DQB.PlayWavFile(File$)"

EDIT: (Above is NOT easy, sure, easy, but not easy as in easy to understand HOW YOU ACTUALLY DO IT!, kid)



And read my entire posts you clown!
"Calling a function is slow btw, so less functions = more efficient"

Code:
If program = slow Then efficient = FALSE



*slap slam, kick, rip, tear!*
Logged
ToohTooh
New Member

Posts: 24



« Reply #19 on: September 24, 2004, 04:23:32 PM »

This clown went on an educational trip to beautiful Ankara city, but sees that the issue is pursued.

Let us see
Quote
And read my entire posts you clown!
"Calling a function is slow btw, so less functions = more efficient"
and
Code:
If program = slow Then efficient = FALSE

Here's Zire's matchless logic:
Code:
IF program = slow THEN efficient = false SO efficient = fast

What's your profession, Zire? Do you hold a degree? Hope not.

Word "efficient" deals with "how" you do the task, whereas "fast" deals with the time you need to complete it. If efficiency dealt with time taken [as in your bare logic(!) ], things would have been tad easier.

So, note to self: Send Zire a dictionary for his/her very next birthday.

Viewers: Please do not get this to be a problematic approach to the subject, and I have nothing to do with Zire -either good or bad- and am sure, neither does he/she.

There are hundreds ways of naming things, but for the humane, they -for sure- aren't "clown"s, "kid"s, or "mess"es.

Got it, Zire?
Logged

Don't interrupt me while I'm interrupting." - Winston S. Churchill
HQSneaker
Wandering Guru
***
Posts: 394



WWW
« Reply #20 on: September 24, 2004, 05:58:47 PM »

One word: Arrogance
Logged
wildcard
*.*
Administrator
__/--\__
*****
Posts: 2369



« Reply #21 on: September 24, 2004, 08:28:20 PM »

Can we all please focus on the challenge at hand, word scrambling.

Nice work Antoni, its difficult making sure all letters are scramled like in boost/etc. I'll try get my entry in soon, I'm just trying not to look at the other entries first ;-)
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #22 on: September 25, 2004, 03:05:38 AM »

Quote from: "HQSneaker"
One word: Arrogance


You said it bro.

Hey meg what about words with only 3 letters in them? Like gun, eat, wet? They wont get scrambled at all.
Logged
Meg
Ancient QBer
****
Posts: 483


« Reply #23 on: September 26, 2004, 01:21:48 AM »

right.  Three letter words are unchanged.
Logged
Meg
Ancient QBer
****
Posts: 483


« Reply #24 on: September 28, 2004, 09:57:44 AM »

I'm going to set a deadline on this challenge for Thursday, September 30th.  Right now Antoni is the only person who has submitted a qualifying entry, so he's winning.

Please don't fight in my threads. c( >.)b

*peace*

Meg.
Logged
Meg
Ancient QBer
****
Posts: 483


« Reply #25 on: October 11, 2004, 01:16:33 PM »

I hate to drag this thread back to the top, but I should mention that Antoni Gual was the official winner of this challenge, with the only qualifying entry.  You have your choice of Kudos, Antoni.  Any flavor.  Cool

*peace*

Meg.
Logged
TheBigBasicQ
*/-\*
*****
Posts: 4550



WWW
« Reply #26 on: October 12, 2004, 12:32:12 PM »

yeah, its unfair! Antoni should be given his share of credit =P.
Logged
Pages: 1 [2]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!