# Can you help the robot cross the platforms?

You have created a robot with artificial intelligence, to test his abilities you add to the robot a battery pack which can hold a maximum of 5 charges and build for him an obstacle he needs to overcome. The obstacle is a series of platforms, the only difference they have is the distance between them, which can either be a 1 length distance or a 2 length distance, for the robot to jump a 1 length distance he needs 1 battery charge and to jump a 2 length distance he needs 2 battery charges. The platforms are as follows:

So the first 5 platforms are 1 length apart and the next 4 are 2 lengths apart. Of course your superior intellect knows that this is impossible to solve so you add 2 objects to the platforms, first is a battery expansion pack which is placed on top every platform after the 5th one, every time the robot gets to a platform after the 5th one his maximum battery charge increases by 1 this expansion pack is then used up. The second object is a battery charge cell which is moved to the farthest platform the robot has reached, it gives him 1 battery charge every time he gets to the platform the cell is on, at the start this battery cell is placed on the 6th platform and stays there until the robot reaches the next platform(7th in this case). the battery charge cell needs 2 jump from the robot to recharge before it can power up the robot again.

While again you see that this is still impossible to solve, you device to also give the robot the ability to recharge his battery with jumping backwards to the previous platforms. Jumping backwards doesn't cost any charges, in addition the first jump backwards doesn't give any charge only the second jump backwards (and every jump backwards after that) gives the robot 2 charges. Everytime the robot jumps ahead this resets and the first jump backwards gives him no charge again. The last thing you decide to give the robot is the ability to move the battery charge cell one platform backwards this costs the robot 1 charge, and again every time the robot reaches a farther platform then the one the charge cell is currently on it gets moved up to platform. Jumping backwards with the cell doesn't alter the robots ability to gain charges, he does need a minimum of 1 charge to move the battery cell backwards opposed to just jumping backwards without the energy cell which costs no energy. Jumping backwards with the energy cell also counts towards the 2 jump counter that the cell needs to recharge.

Can the robot reach the 9th platform with only the things he is given? If so what is the minimum amount of jumps that the robot needs to do to reach the 9th platform?

Forgot to add, the robot starts at platform 1 and with 5 charges

Dont read this if you dont want to know if a solution actualy exists or not.

This is a original puzzle i created so gl! :)

• can the robot choose not to charge when landing on the charge cell or does he have to take it? – Ivo Beckers Jan 19 '15 at 12:25
• He has to take it if the charge cell has recharged(after 2 jumps) – Vajura Jan 19 '15 at 12:31
• Clarification on the charger #1: Robot on 6th, charger on 6th. (Gets charged+1). Now the Robot jumps to 7th, charger is also placed on 7th, but does not recharge. Now Robot jumps to 8th, charger also placed on 8th AND recharges? (since it was 2 steps since 6th) ? – BmyGuest Jan 19 '15 at 14:00
• Clarification on the charger #2: Robot on 6th, charger on 6th. (Gets charged+1). Now the Robot jumps to 5th, charger stays on 6ht. Now the Robot jumps to 6th, charger still at 6th and Robot recharges (since it was 2 jumps)? – BmyGuest Jan 19 '15 at 14:01

Based on Ivo's answer, where you're at spot #8 with 1 charge (from the charger):

Use the 1 charge to move the charger backwards ( to #7).
Hop back 5 to #2 (8 charges).
3 charges to #5, 4 charges to #7, left with 1 charge to move the charger back to #6.

At that point, hop back 4 to #2 (8 charges).
Forward to #6 (4 charges).
Back to #3 (8 charges).
Forward to #6 (5 charges).
Forward to #7 (3 charges, bring charger). Forward to #8 (2 charges, bring charger, use charger).
Forward to #9 (0 charges).

edit
I think with some optimization, I can get it down to 40 steps:
Key = $<location>(<charges>[,<charger>])$

1(5) 5(1)   2(5)   6(1)   5(0,c) = 15
2(6) 5(4)   7(1)   6(0,c) 3(6)   = 12 + 15 = 27
6(3) 5(2,c) 4(4,c) 3(6)   4(6)   = 5 + 27 = 32
5(5) 4(6,c) 3(7)   4(7)   5(6)   = 5 + 32 = 37
6(5) 7(3)   8(2)   9(0)          = 3 + 37 = 40

• at the point where you say Forward to #6 (4 charges). that will actually cost 5 charges i believe – Ivo Beckers Jan 19 '15 at 14:23
• You get 1 from the charger at #6 – JonTheMon Jan 19 '15 at 14:27
• yeah you're right. I believe you have the solution. I wonder why my program couldn't find it – Ivo Beckers Jan 19 '15 at 14:30

I made a program to simulate this and unless I made a mistake it is not possible. Best that I could find is getting to 8 with 1 charge left. Here is it step by step:

location of robot - location of charge cell - charges - maxCharges - charge cell cooldown
1 - 6 - 5 - 5 - 0
2 - 6 - 4 - 5 - 0
3 - 6 - 3 - 5 - 0
4 - 6 - 2 - 5 - 0
5 - 6 - 1 - 5 - 0
4 - 6 - 1 - 5 - 0
3 - 6 - 3 - 5 - 0
2 - 6 - 5 - 5 - 0
3 - 6 - 4 - 5 - 0
4 - 6 - 3 - 5 - 0
5 - 6 - 2 - 5 - 0
6 - 6 - 1 - 6 - 2
5 - 6 - 1 - 6 - 1
4 - 6 - 3 - 6 - 0
3 - 6 - 5 - 6 - 0
4 - 6 - 4 - 6 - 0
5 - 6 - 3 - 6 - 0
6 - 6 - 2 - 6 - 2
5 - 6 - 2 - 6 - 1
4 - 6 - 4 - 6 - 0
3 - 6 - 6 - 6 - 0
4 - 6 - 5 - 6 - 0
5 - 6 - 4 - 6 - 0
6 - 6 - 3 - 6 - 2
7 - 7 - 1 - 7 - 1
6 - 7 - 1 - 7 - 0
5 - 7 - 3 - 7 - 0
4 - 7 - 5 - 7 - 0
3 - 7 - 7 - 7 - 0
4 - 7 - 6 - 7 - 0
5 - 7 - 5 - 7 - 0
6 - 7 - 3 - 7 - 0
7 - 7 - 2 - 7 - 2
8 - 8 - 0 - 8 - 1
7 - 8 - 0 - 8 - 0
6 - 8 - 2 - 8 - 0
5 - 8 - 4 - 8 - 0
4 - 8 - 6 - 8 - 0
3 - 8 - 8 - 8 - 0
4 - 8 - 7 - 8 - 0
5 - 8 - 6 - 8 - 0
6 - 8 - 4 - 8 - 0
7 - 8 - 2 - 8 - 0
8 - 8 - 1 - 8 - 2

• it is possible :) – Vajura Jan 19 '15 at 13:53
• @Ivo I think the battery cool-down might only need 1/0 ? (The jump away and the jump back unless you jump forward and take it with you, in which case it would be two jumps forward.) See my comment in the OP. – BmyGuest Jan 19 '15 at 14:07
• I think you made the same mistake I did. The robot can move the battery charger one step back by paying 1 charge. – Taemyr Jan 19 '15 at 14:40

The instructions were a little confusing, but I think I understand. So...

(#) will represent the platforms while [#/#] represents the robots current/maximum charge. "BCC" is Battery Charge Cell.

(1) [5/5]

(2) [4/5]

(3) [3/5]

(4) [2/5]

(5) [1/5]

(4) [1/5]

(3) [3/5]

(2) [5/5]

(3) [4/5]

(4) [3/5]

(5) [2/5]

(6) [0/6] +1 BCC [1/6]

(5) [0/6] Bring BCC to (5)

(4) [2/6] BCC charged

(3) [4/6]

(2) [6/6]

(3) [5/6]

(4) [4/6]

(5) [3/6] +1 BCC [4/6]

(6) [2/6] Bring BCC to (6)

(7) [0/7] Bring BCC to (7), BCC charged, +1 BCC [1/7]

(6) [0/7] Bring BCC to (6)

(5) [2/7] BCC charged

(4) [4/7]

(3) [6/7]

(4) [5/7]

(5) [4/7]

(6) [2/7] +1 BCC [3/7]

(5) [3/7]

(4) [5/7] BCC charged

(3) [7/7]

(4) [6/7]

(5) [5/7]

(6) [3/7] +1 BCC [4/7]

(7) [2/7] Bring BCC to (7)

(8) [0/8] Bring BCC to (8), BCC charged, +1 BCC [1/8]

(7) [0/8] Bring BCC to (7)

(6) [2/8] BCC charged

(5) [4/8]

(4) [6/8]

(3) [8/8]

(4) [7/8]

(5) [6/8]

(6) [4/8]

(7) [2/8] +1 BCC [3/8]

(6) [2/8] Bring BCC to (6)

(5) [3/8] Bring BCC to (5), BCC charged, +1 BCC [4/8]

(4) [6/8]

(3) [8/8] BCC charged

(4) [7/8]

(5) [6/8] +1 BCC [7/8]

(6) [5/8] Bring BCC to (6)

(7) [3/8] Bring BCC to (7), BCC charged, +1 BCC [4/8]

(8) [2/8] Bring BCC to (8)

(9) [0/9] Bring BCC to (9), BCC charged, +1 BCC [1/9]

Just enough charged to jump off platform (9), even.

• Missed that. Thanks. (Going to delete my comments.) – BmyGuest Jan 19 '15 at 14:30

Ok I found the bug in my previous answer. Somehow it didn't account for bringing the charge cell up and recharge at the same time. This is my second attempt. It should also be the least amount of jumps (42 jumps):

1st number is location of robot
2nd number is location of charging cell
3rd number is jumps until cell is recharged again
4th number is max number of charges
5th number is number of charges
6th is a boolean indication whether the robot is moving backwards

1, 6, 0, 5, 5, false
2, 6, 0, 5, 4, false
3, 6, 0, 5, 3, false
4, 6, 0, 5, 2, false
5, 6, 0, 5, 1, false
4, 6, 0, 5, 1, true
3, 6, 0, 5, 3, true
2, 6, 0, 5, 5, true
3, 6, 0, 5, 4, false
4, 6, 0, 5, 3, false
5, 6, 0, 5, 2, false
6, 6, 2, 6, 1, false
5, 5, 1, 6, 0, true
4, 5, 0, 6, 2, true
3, 5, 0, 6, 4, true
2, 5, 0, 6, 6, true
3, 5, 0, 6, 5, false
4, 5, 0, 6, 4, false
5, 5, 2, 6, 4, false
4, 5, 1, 6, 4, true
3, 5, 0, 6, 6, true
4, 5, 0, 6, 5, false
5, 5, 2, 6, 5, false
6, 6, 1, 6, 3, false
7, 7, 2, 7, 2, false
6, 6, 1, 7, 1, true
5, 5, 0, 7, 2, true
4, 5, 0, 7, 4, true
3, 5, 0, 7, 6, true
4, 5, 0, 7, 5, false
5, 5, 2, 7, 5, false
4, 5, 1, 7, 5, true
3, 5, 0, 7, 7, true
4, 5, 0, 7, 6, false
5, 5, 2, 7, 6, false
4, 4, 1, 7, 5, true
3, 4, 0, 7, 7, true
4, 4, 2, 7, 7, false
5, 5, 1, 7, 6, false
6, 6, 2, 7, 5, false
7, 7, 1, 7, 3, false
8, 8, 2, 8, 2, false
9, 9, 1, 9, 0, false