|
|
אקסטרים
Started by CGX at 03-03-2009 9:31. Topic has 5 replies.
 
 
|
|
Sort Posts:
|
|
|
|
03-03-2009, 9:31
|
CGX
Joined on 11-13-2005
Posts 252
|
|
|
כפי שאמרתי לפני כמה שעות - מה תעשו אם השורדים היו מבזבזים את הפצצה החכמה שלהם? רצ"ב קוד מקור של אלף
push ds
pop es
int 87h
mov bx,ax
add ax,ax
inc ax
mul bx
mov [00000h],ax
w:
cmp word [bx],'CG'
jne w
השאר (בית עד וו) הם זהים, אלא שהכתובת אפס מתחלפת ב
0ded, 1bda, 29c7, 37b4, 45a1
אפשר להרוג את כולם תוך פחות מ200 פקודות.
בהצלחה!
|
|
|
|
|
Report
|
|
|
|
03-03-2009, 13:57
|
aantn
Joined on 02-02-2009
Posts 16
|
|
|
כמעט פטרתי את הבעיה היום, אך נגמר לי הזמן. (לא חשבתי על פצצות חכמות)
צריך למצוא פטרון למשוואה הריבועית 2X^2 + X - A
הוא הערך שהסורד כתב אל הכתובת 0 A
אפשר למצוא את הפטרון למשוואה על ידי שימוש בנוסחה:
x1, x2 = (-b +- sqrt(b^2 - 4ac)) / 2a
זאת אומרת, שצריך לכתוב תוכנית אסמבלי מהצורה: move ax, [0] ; move to ax the value that alef wrote to 0x0 mul 8 add ax, 1 sqrt ax ; (replace the non-existent sqrt opcode with your own code to find a square root)
dec ax mov cl, 4 div cl
ALהפטרון למשוואה נמצאת ב
(אני כמעט בתוח שאין צורך לחשב את הפתרון השני למשוואה [כי הוא יהיה שלילי], אבל לא חשבתי על זה מספיק להיות 100% בתוח)
עוד הערה: כמובן, צריך להחליף את השורה הרביעית במשהו מתאים (אפשר למצוא אלגוריתם למציאת שורש ריבועי על האינטרנת בקלות)
עוד לא בדקתי את התוכנה במחשב, ולכן תרגיש חופשי לתקן אותי אם תעיתי למעלה
|
|
|
|
|
Report
|
|
|
|
03-04-2009, 11:29
|
GalDor
Joined on 09-09-2008
Posts 48
|
|
|
It's more difficult than that - doing sqrt modulu 0x10000 is not like takinga normal sqrt - and there are no negative numbers, as -x is equivalent to 0x10000-x. Actually, you can't even divide by two - 0x4000*2=0xc000*2=0x8000.
---------------------------------- Have you heard about the new Cray super computer? It’s so fast, it executes an infinite loop in 6 seconds.
|
|
|
|
|
Report
|
|
|
|
03-06-2009, 4:05
|
aantn
Joined on 02-02-2009
Posts 16
|
|
|
For an algorithm in assembly to find a square root see http://www.azillionmonkeys.com/qed/sqroot.html.
I'm not sure what you meant about the division.
|
|
|
|
|
Report
|
|
|
|
03-07-2009, 1:36
|
GalDor
Joined on 09-09-2008
Posts 48
|
|
|
That gives you a non-natural number!
I have managed to prove that the odd numbers with square roots modulo 0x10000 are the numbers of the form 8x+1. If A is a root of 8x+1, then the others are:
-A, 0x8001*A, 0x7FFF*A
And there four roots, not two!
Anyhow, about division, it too has many solutions - division by 2 gives (if A is one solution):
A+0x8000*k
and division by 4:
A+0x4000*k
and so on. The point is, we are dealing with modular arithmatic, not the normal arithmatic, so even though the equation works, your algorithm won't, and you're neglecting a lot of subtleties.
---------------------------------- Have you heard about the new Cray super computer? It’s so fast, it executes an infinite loop in 6 seconds.
|
|
|
|
|
Report
|
|
|
|
03-07-2009, 12:46
|
CGX
Joined on 11-13-2005
Posts 252
|
|
|
מי שיכתוב שורד שמנצח את ששת השורדים אלף עד וו מוזמן לשלוח כמה פעולות זה לוקח לו (בנתיים אל תשלחו את השורד עצמו, כדי לא לקלקל לאחרים את ההנאה בפתרון).
כאמור, השורד שלי פותר בפחות מ200 צעדים, ואפשר עוד לשפר אותו.
|
|
|
|
|
Report
|
|
|
|
|
קודגורו » פורומים » אקסטרים » Re: Alef
|
|
|
|