[SOLVED] Help cannon landing force


#1
# We should send soldiers to defend the village.
# Also we need clear out old fire traps.
# For both of those goals we'll use the artillery!
# The artillery can launch soldiers and anti-traps.

# The scout prepared a map of the landing zone.
# The map is a 2D array where cells are strings.
landingMap = hero.findNearest(hero.findFriends()).landingMap

# Tell the cannons the row, column, and target type.
# To get the element, use array[i][j]
# First, let's look at row 0 and column 0.
cell = landingMap[0][0]
# Next, say the coordinates and what's there.
hero.say("row 0 column 0 " + cell)

# Next cell is the 3rd row and the 2nd column.
hero.say("row 3 column 2 " + landingMap[3][2])

# Now do it yourself for the next point:
# The 2nd row and 1st column.
hero.say("row 2 column 1 " + cell)
hero.say("row 2 column 1 " + landingMap[2][1])
# The 1st row and 0th column.
hero.say("row 1 column 0 " = cell)
hero.say("row 1 column 0 " + landingMap[1][0])
# The 0th row and 2nd column.
hero.say("row 0 column 2 " + cell)
hero.say("row 0 column 2 " + landingMap[0][2])
# The 1st row and 3rd column.
hero.say("row 1 column 3 " + cell)
hero.say("row 1 column 3 " + landingMap[1][3])


#2

Look at the variable cell and how it is defined. Then look at your code. The coordinates on the landingMap of the variable cell are (0, 0) regardless of what the string before it says. Did you really want to do that four more times?


#3

Thanks @MunkeyShynes


#4

It’s great that you finished the level but please don’t post finished code or final solutions. The purpose of this board is to help people figure out the solutions themselves so they can learn. Simply providing solutions/code is counterproductive to the main goal.


#5

Please put [SOLVED] so nobody thinks this isn’t solved.