last day (15 days later) » 

6:46 AM
So I've been trying to crack the long code '10100000200310310113030200221013111213110130332101', but I get to 21 instead of 22.
My algorithm first removes all 0s, then does the bomb-explosions from left to right. The input looks like this along the way:
11231311133222113111213111333211
112311133222113111213111333211
1121133222113111213111333211
11211322113111213111333211
112112113111213111333211
1121121111213111333211
11211211112111333211
112112111121113311
11211211112111
.........^
10th chr @
So the final contents of the vase are the first 9 characters of this string, and the las (because new input replaces what's on top): 1121121111
Then we stuff this into eval:c=0+1+1;c*=2;c=c+1+1;c*=2;c=c+1+1+1+1
So, where do I go wrong?
 
 
3 hours later…
9:26 AM
Hey !
So first of all
What kind of behaviour do you get when you already have 10 characters
And add one more ?
 
If I have abcdefghij and receive number k, I would replace j with k.
This is in the specs: If the vase is already full[...], the input will replace the element at the top of the vase.
So that's how I interpret this. In practise, this is implemented as such:
 
Yup !
For the following example : 12122111131
When the vase is full
It will look like this
|x|
|-|
|-|
|-|
|-|
|~|
|~|
|-|
|~|
|-|
(Last character "1" not interpreted yet)
One step later
We get that
|-|
|-|
|-|
|-|
|-|
|~|
|~|
|-|
|~|
|-|
If you count, it returns 43
Which is the correct result
 
my implementation: With input string abcdefghijklmn, take substring 0-9 and, if input is longer than 9, add the last character (because every char > 9 will continuously replace each other)
Result abcdefghin
I really don't get why this isn't working. Will look into this more tonight. At least I read the specs right...
 
I think
One of your bomb
Does explode
When it shouldn't
When input = "12122111131"
Your program returns this state before counting :
111122121
Which means
A bomb destroyed the last "1" where this same "1" should have REPLACED the bomb :)
Because if you make all bombs explodes without checking if they weren't at the top at the vase at this moment (where they were supposed to be simply replaced without exploding), you will destroy rocks that were actually useful :)
 
9:44 AM
Hey, nice find. You're right. Thx
 
9:58 AM
Figured how to fix this :) ?
 
 
2 hours later…
11:44 AM
Haha, not yet. It'll be about 5 or 6 hours before I can look into this...
 
12:19 PM
Decided to extend my lunchbreak; it's fixed now. Once again, thabks for your help.
 
 
5 hours later…
5:42 PM
Good job :D
 

last day (15 days later) »