Another Typo Challenge

Post Reply
deutronium
Posts: 7
Joined: Tue Dec 16, 2008 3:52 pm

Another Typo Challenge

Post by deutronium »

I wrote a PHP script which is trying all possible characters for all positions in the string and it found no solution.

Is there a special trick?
Am I looking in the wrong direction?
Can I assume that $x is zero before calling the given line?
The programming language of this challenge is still PHP, isn't it?
Is there a PHP function which name is just 1 character long (to be placed before the parentheses in the string)?
Last edited by deutronium on Tue Feb 10, 2009 8:53 pm, edited 1 time in total.
rmplpmpl
Posts: 113
Joined: Sun Oct 26, 2008 10:38 am
Location: Germany

Re: Another Typo Challenge

Post by rmplpmpl »

deutronium wrote:I wrote a PHP script which is using eval() and is trying all possible characters for all positions in the string and it found no solution.

Is there a special trick?
Am I looking in the wrong direction?
Can I assume that $x is zero before calling the given line?
The programming language of this challenge is still PHP, isn't it?
Is there a PHP function which name is just 1 character long (to be placed before the parentheses in the string)?
It's 99% about mathematics and 1% about informatics.
MagneticMonopole
Posts: 26
Joined: Fri Nov 07, 2008 3:19 pm

Post by MagneticMonopole »

@deutronomium: Your approach did work just fine for me. (Well, I had perl feed expressions to fresh instances of a php interpreter. In your case, could previous eval()s have influenced the result of the current one?)

@rmplpmpl: Normally, I'd agree. In this particular case, not...
deutronium
Posts: 7
Joined: Tue Dec 16, 2008 3:52 pm

Post by deutronium »

>> In your case, could previous eval()s have influenced the result of the current one?

I don't hope so. I reassigned $x and $y in every iteration and I let my other variables end with two underscores so that this eval should not influence them.
MerickOWA
Posts: 182
Joined: Mon Apr 07, 2008 5:54 pm
Location: HkRkoz al KuwaiT 2019 HaCkEr 101

Post by MerickOWA »

If you're trying all possible characters for all positions, you will find the answer eventually.

The challenge is still in PHP.
deutronium
Posts: 7
Joined: Tue Dec 16, 2008 3:52 pm

Post by deutronium »

Thanks for the answers, it works now :-)

Although I explicity reassigned the variables in every iteration their values got corrupted somehow, after I added an explicit unset() for the variables it worked!
wiz1989
Posts: 10
Joined: Thu Feb 19, 2009 7:00 pm
Location: Germany

Post by wiz1989 »

Just don't get the answer for this one.
I wrote a bruteforcing code like you did as well. But I made it with C#.
Also, it works fine for "Typo", but I don't get any results for "Another Typo". So I guess, it's php-depending, isn't it?
Thx for any hints =)
b0bA
Posts: 13
Joined: Tue Dec 30, 2008 4:45 pm

Post by b0bA »

I would say it's more a general programming style you miss, instead of a php-depending code only.
The hint by rmplpmpl is the best here. You should care about the 1% in computer science. I guess your BF-Algo is missing at least 0ne char ;)
wodkahack0r
Posts: 9
Joined: Thu Mar 05, 2009 7:27 pm

Post by wodkahack0r »

Hm. I figured out what char to change. But it always says: '.....' is incorrect. My solution is 100% correct as any calculator gets the right result from the modified version. Any idea what could be wrong?

- Forget it. My position was off-by-one. It works now.
horst
Posts: 24
Joined: Fri Mar 06, 2009 11:07 am
Location: Germany

Re: Another Typo Challenge

Post by horst »

rmplpmpl wrote:
deutronium wrote:I wrote a PHP script which is using eval() and is trying all possible characters for all positions in the string and it found no solution.

Is there a special trick?
Am I looking in the wrong direction?
Can I assume that $x is zero before calling the given line?
The programming language of this challenge is still PHP, isn't it?
Is there a PHP function which name is just 1 character long (to be placed before the parentheses in the string)?
It's 99% about mathematics and 1% about informatics.
Well, after many tries with a calculator and a C(++) program I must say that this is a little bit more about informatics than just 1%. Although this challenge isn't necessarily PHP dependent and is solvable without programming, in this case I had to brute force the PHP code to get the hint to the tiny difference between C and PHP.
gfoot
Posts: 269
Joined: Wed Sep 05, 2007 11:34 pm
Location: Brighton, UK

Post by gfoot »

Maybe I'm misremembering, but I don't think this depended on a difference between C and PHP.
Chocoholic
Posts: 44
Joined: Mon Feb 16, 2009 4:11 pm
Location: UK

Post by Chocoholic »

True, the solution works in both C and C++ as well. However using an interpreted language as PHP helps if one really wants to brute-force it to save a few minutes thinking. A program in C would have to be recomplied every time something is changed.
magnus
Posts: 20
Joined: Thu Mar 05, 2009 2:29 pm

Post by magnus »

THe solution even works in Java !!
Post Reply