Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Randomize?letters
#1
I am pretty new at QBASIC I have tried for several days to make a descrambler (using only letters)
example:
parc = crap

I know you can randomize numbers but what abought letters?
like so:
input " place letter here",first$
input " place letter here",second$
input " place letter here ",third$
input " place letter here ', forth$

cls
print first$; second; third; forth$

could you not randomize the 4 letters they input?
Or could you somehow give the letters numeric value as such.
a = 1
b = 2
Does this post make any since at all ? God I hope so ,lol
Thanks for any help Big Grin
I know you can keep going by repeating the print statement & revolving the letters but if you goto a 10 letter descrambler then there would have to be 1000 print statements not the mention of other lines such as locate to put as much on one page as possable
unescape.com
Massive online role playing game
Free to play
Reply
#2
yes you can randomize letters
Code:
letter$ = CHR$(INT(RND * 26) + 96)
you post partially made sense...
so you have a bunch of scambled letters right? well. in order to have a descrammbeller you either need the target word (whats the point?) or a big dictionary.
[Image: sig.php]
Back by popular demand!
I will byte and nibble you bit by bit until nothing remains but crumbs.
Reply
#3
or a descrambling/scrambling algorithm.
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#4
Do you just want to take what the user inputs and print it out backwards?
Reply
#5
no if im not mistaking (due to beeing a begginer) you would use REVERSE$ For that right ?
I was tring to get every possability like so

crap rapc apcr pcra prac pacr

so on but if you go to 10 letters then to get every possable solution you would have to write 1,000 print statements
it's not that writing it bothers me but yu would be getting into something close to 64 kbs would you not. Also if it was that big coul you even compile it....

If it seems I don't know what Im talking about it is due to my experience in qbasic (very little) wanting to learn thoughSmile
unescape.com
Massive online role playing game
Free to play
Reply
#6
You can also learn all about this stuff in QB help.
When your working in QB, look in the top right corner of the screen.
Click on Help, then click on Index. It will show you a list of every QB command and how to use it. :wink:


Code:
CLS
RANDOMIZE TIMER
INPUT "Enter a word to scramble ", Word$

WordLength% = LEN(Word$)
PRINT STR$(WordLength%) + " total characters"


DO
RandomPick% = 1 + INT(RND * WordLength%)
IF MID$(Word$, RandomPick%, 1) <> CHR$(255) THEN
  LetterCount% = LetterCount% + 1
   NewWord$ = NewWord$ + MID$(Word$, RandomPick%, 1)
    MID$(Word$, RandomPick%, 1) = CHR$(255)
END IF
LOOP UNTIL LetterCount% = WordLength%

PRINT NewWord$

[EDIT]
I was writing that code while you posted that I guess.
You could easily modify thaqt code to do what you want. Why don't you give it a shot? :wink:
[/EDIT]
Reply
#7
Thanks I will defintly give it a try . I use the help alot but I am a bit new to some of the words they use .It's sort of hard for me to understand alot of it I guess it all will fall into place sooner or later
unescape.com
Massive online role playing game
Free to play
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)