flat assembler
Message board for the users of flat assembler.

Index > Heap > find the next occurence. :D

Author
Thread Post new topic Reply to topic
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
i don't remember if this game was still posted here. i used search tool to find the 4th occurence, and nothing else than the biggest number wiht 9 chars was output.

then, i post it:

find the next occurence of this:
1
11
21
1211
111221

what is the next? and why.

PS: it is an easy game, then, if you find directlly, or still know the solution, don't post it immediatelly, let the "newbies" seek.

and one more question, is it possible to see the "4" char number in any occurence, and when? for this question, i don't know the answer... Very Happy
Post 06 Apr 2010, 18:45
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
and one more question is to make the solver function in less than 70 bytes, in 32bits, using esi as input, edi as output, and eax as accumulator for calculations. Very Happy
Post 06 Apr 2010, 19:49
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

i've found

Wink

_________________
I am not young enough to know everything (Oscar Wilde)- Image


Last edited by ouadji on 06 Apr 2010, 23:25; edited 1 time in total
Post 06 Apr 2010, 20:58
View user's profile Send private message Send e-mail Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
ok, and can somebody else find the solution?

it is very important, it is the key for the new security fail in the FBI server. if you are not at least 40 to find the next solutions, the planet will explode. hurry up guys, the world depend on you!!! Very Happy Laughing
Post 06 Apr 2010, 21:02
View user's profile Send private message Visit poster's website Reply with quote
TmX



Joined: 02 Mar 2006
Posts: 821
Location: Jakarta, Indonesia
TmX
1
11
21
1211
111221
312211
13112221

...

I found this puzzle for the first time from Brian Bolt's Even More Mathematical Activities...
Post 07 Apr 2010, 15:28
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
yeah yeah yeah.
we are 3 to save the world.

if someone understand the macanism, he can post the next step of this puzzle. Very Happy
Post 07 Apr 2010, 16:48
View user's profile Send private message Visit poster's website Reply with quote
Tyler



Joined: 19 Nov 2009
Posts: 1216
Location: NC, USA
Tyler
111321213211
311312111211131221
132113111231123112112211
Shall I continue?
Post 07 Apr 2010, 21:55
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 2915
Location: [RSP+8*5]
bitRAKE
{count}{value} pairs are obtained from describing the previous string.
It is a type of "run-length" encoding.
70 bytes is too much!, Very Happy
Post 08 Apr 2010, 03:38
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
more than 70bytes, because there is a security problem when string are growing, then, need to use ecx as a count.
Code:
        push eax ecx esi edi
        mov esi,[.in+txt.txt]
        mov edi,[.out+txt.txt]
        xchg esi,edi
        mov [.in+txt.txt],esi
        mov [.out+txt.txt],edi
        mov ecx,511
.next:
        mov ah,[esi]
        mov al,'1'
        cmp ah,0
        je .end
@@:
        inc esi
        cmp ah,[esi]
        jne @f
        inc al
        jmp @b
@@:
        mov [edi],ax
        add edi,2
        dec ecx
        jne .next
.end:
        mov byte[edi],0
        pop edi esi ecx eax
        ret
    


i presume it can be optimised a lot.
but how much?
Post 08 Apr 2010, 06:41
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
edfed wrote:
i presume it can be optimised a lot.
Optimised for what?
Post 08 Apr 2010, 06:55
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
for size of course.
and maybe for speed too.
Post 08 Apr 2010, 07:11
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
edfed wrote:
for size of course.
and maybe for speed too.
I would think that you can't get both together. You have to choose which is more important to you.
Post 08 Apr 2010, 07:12
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
size.
no speed.
no! size
NO! spee...
arghhhh!

Laughing

i don't know, size for example? using 32bits registers of course.
Post 08 Apr 2010, 07:38
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
The metric for size is very very easy to quantify.

The metric for speed is very very hard to quantify.

Perhaps size would be the easier choice here. Wink
Post 08 Apr 2010, 07:43
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
ok for size optimisation then. Very Happy
Post 08 Apr 2010, 07:54
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
edfed wrote:
and one more question, is it possible to see the "4" char number in any occurence, and when? for this question, i don't know the answer... Very Happy
Not possible.

Work it backwards. Assume that we did have a 4: ...4?...

The previous line would have to be: ...????..., i.e. 4 repeats of ?

If ?=1 then the the previous previous line would have to be ....11.... which leads to ...21..., not ...1111...

If ?=2 then the the previous previous line would have to be ....2222.... which leads to ...42..., not ...2222...

If ?=3 then the the previous previous line would have to be ....333333.... which leads to ...63..., not ...3333...

So, not possible.
Post 08 Apr 2010, 08:12
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
yeah.

and one more question, there are positions where chars doesn't change.
Code:
1
11
21
1211
111221
312211
1311222 1 
1113212 1 3211
3113121 1 1211131221
1321131 1 1231123112112211
1113122 1 133112132112132112212211
    

and ones the strings are very long, there are many chars that nevr change.
giving this pattern:

XXXX1X2XXXXX1XXXXXXXXXX12XX1XXX1XXXXXX112XXXX1XXX...

it is amazing...
Post 08 Apr 2010, 08:26
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17287
Location: In your JS exploiting you and your system
revolution
Is there a long string that completely self-references itself?

eg. "22" is self referenced, but is there a longer one?
Post 08 Apr 2010, 10:27
View user's profile Send private message Visit poster's website Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4238
Location: 2018
edfed
i think no, it is impossible.

are there strings that reloop during many convertions? i doubt a lot about that.

and another Q, what happens if we try to implement the '0' count?

1
0203040506070888090011

etcetc...
meaning a very exponential grow of the string.
Post 08 Apr 2010, 11:27
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.