stack level to deep?

  • Thread starter STEPHEN BECKER I V
  • Start date
S

STEPHEN BECKER I V

aaaaa
C:/Documents and Settings/IV/Desktop/crazy.rb:5:in `nextl': stack
level too deep (SystemStackError)

from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `nextl'
from C:/Documents and Settings/IV/Desktop/crazy.rb:5:in `nextl'
from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:4:in `nextl'
from C:/Documents and Settings/IV/Desktop/crazy.rb:5:in `nextl'
... 2083 levels...
from C:/Documents and Settings/IV/Desktop/crazy.rb:11
from C:/Documents and Settings/IV/Desktop/crazy.rb:10:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:10:in `each'
from C:/Documents and Settings/IV/Desktop/crazy.rb:10
Press any key to continue . . .


Is there away to increase the allowed space for the stack info?
I want to print out ever permutation of the alphabet. I know it
sounds crazy, but i want to.

def nextl (a,d)
if d==0 then print a # max depth
print "\n" end
for i in 'a'..'z' # add the next letter in the alphabet
nextl(a<<i.to_s,d-1) #concat and call
print "\n"
end
end

for i in 'a'..'z'
nextl(i.to_s,4)
print "\n"
end

is my code, it should print out all aaaaa,aaaab,aaaac....
becker
 
G

gabriele renzi

STEPHEN BECKER I V ha scritto:
Is there away to increase the allowed space for the stack info?
I want to print out ever permutation of the alphabet. I know it
sounds crazy, but i want to.

on unix there is the ulimit setting.. but you can just do that
iteratively, I think
 
S

STEPHEN BECKER I V

yes='a'*47
while true do
yes.succ!
print yes,"\n"
sleep 1
end


i guess what would work to?
 
M

Markus

Is there away to increase the allowed space for the stack info?
I want to print out ever permutation of the alphabet. I know it
sounds crazy, but i want to.
is my code, it should print out all aaaaa,aaaab,aaaac....

Why not something like:

(1..6).each { |n|
(('a'*n)..('z'*n)).each { |s| print s,"\n" }
}

Although, if you are using this to tell people about the amazingly low
mortgage rates you might try:

(1..6).each { |n|
(('a'*n)..('z'*n)).each { |s| print s,"\n" unless s == 'markus'}
}

instead.

-- MarkusQ
 
S

STEPHEN BECKER I V

No its not a spamer, it was a stupid idea on to how to crack some
ciphered text.
PBEGUUYMIQICUUFGUUYIQGUUYQCUIVFIQGUUYQCUQBEMEVP
And they gave no hints!
Becker
 
M

Markus

it was a stupid idea on to how to crack some
ciphered text.
PBEGUUYMIQICUUFGUUYIQGUUYQCUIVFIQGUUYQCUQBEMEVP
And they gave no hints!

So roll your own. (Hints, that is). Frequency analysis generally
doesn't help much in cyphers this short, but Q is just begging to be
space:

PBEGUUYMI ICUUFGUUYI GUUY CUIVFI GUUY CU BEMEVP

Which, assuming the plain text is English, makes GUUY on of:

Abba abbe Abby adds ally ammo Anna Anne
beef been beep beer bees beet book
boom boon boor boos boot cook cool coon
coop deem deep deer doom door ebbs eddy
eggs Ella Emma errs feed feel fees feet
food fool foot good goof Haag Haas heed
heel hood hoof hook hoop hoot ills illy
inns jeep jeer keel keen keep leek leer
lees look loom loon loop loot meek meet
mood Moon Moor moot need nook noon odds
offs Otto peek peel peep peer pool poor
reed reef reel roof rook room root seed
seek seem seen seep seer sees soon soot
teem teen took tool veer weed week weep
wood woof wool woos zoom zoos

...with the caveat that it isn't "peep" (that would make G == Y).
Noticing that the middle cypher symbol U is also the last in the two
letter cypher word CU and that GUUY occurs inside the two longest
words...

Well, you get the idea.

-- MarkusQ
 
S

STEPHEN BECKER I V

Enter file loc (use // for ): PBEGUUYMIQICUUFGUUYIQGUUYQCUIVFIQGUUYQCUQBEMEVP
Size = 47
B 2
C 3
E 3
F 2
G 4
I 5
M 2
P 2
Q 6
U 12
V 2
Y 4

*******************************************************
PB 1
EG 1
UU 5
YM 1
IQ 1
IC 1
FG 1
YI 1
QG 2
YQ 2
CU 2
IV 1
FI 1
QB 1
EM 1
EV 1

*******************************************************
PBE 1
GUU 4
YMI 1
QIC 1
UUF 1
YIQ 1
YQC 2
UIV 1
FIQ 1
UQB 1
EME 1


Ruby made this is so easy :)
Becker
 
B

Brian Candler

Is there away to increase the allowed space for the stack info?

Not enough to allow for infinite recursion, I'm afraid :)
def nextl (a,d)
if d==0 then print a # max depth
print "\n" end
for i in 'a'..'z' # add the next letter in the alphabet
nextl(a<<i.to_s,d-1) #concat and call
print "\n"
end
end

Try adding "puts d" at the very top of this method (before if d==0 ...) and
you'll see where the problem is. Hint: "return" is your friend :)

Regards,

Brian.
 
S

STEPHEN BECKER I V

the cook was a good cook as cooks go and as cooks go she went

YEAH! reverse Caesar !
 
E

Eric Hodel

--9dgjiU4MmWPVapMU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
is my code, it should print out all aaaaa,aaaab,aaaac....=20

Ruby already knows how to do this:

('aaaaa'..'zzzzz').each do |x|
puts x
end

--=20
Eric Hodel - (e-mail address removed) - http://segment7.net
All messages signed with fingerprint:
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04


--9dgjiU4MmWPVapMU
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (FreeBSD)

iD8DBQFBYiL2MypVHHlsnwQRAjoDAJ409HsN9ZlxcB61BQfYjrR1E5fgvACbBkJ/
SbSoopdybbFEntb7sDEhRJE=
=AnpB
-----END PGP SIGNATURE-----

--9dgjiU4MmWPVapMU--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,161
Latest member
GertrudeMa
Top