checkio/Codeship/Express Delivery/test_express_delivery.py 1 location
|
@@ 156-169 (lines=14) @@
|
| 153 |
|
if step not in ACTIONS: |
| 154 |
|
print("Unknown action {0}".format(step)) |
| 155 |
|
return False |
| 156 |
|
if step == "B": |
| 157 |
|
if hold_box: |
| 158 |
|
if field[s_row][s_col] == "B": |
| 159 |
|
hold_box = False |
| 160 |
|
total_time += 1 |
| 161 |
|
continue |
| 162 |
|
else: |
| 163 |
|
print("Stephan broke the cargo") |
| 164 |
|
return False |
| 165 |
|
else: |
| 166 |
|
if field[s_row][s_col] == "B": |
| 167 |
|
hold_box = True |
| 168 |
|
total_time += 1 |
| 169 |
|
continue |
| 170 |
|
n_row, n_col = s_row + ACTIONS[step][0], s_col + ACTIONS[step][1] |
| 171 |
|
total_time += 2 if hold_box else 1 |
| 172 |
|
if 0 > n_row or n_row >= max_row or 0 > n_col or n_row >= max_col: |
checkio/Codeship/Express Delivery/express_delivery.py 1 location
|
@@ 112-125 (lines=14) @@
|
| 109 |
|
if step not in ACTIONS: |
| 110 |
|
print("Unknown action {0}".format(step)) |
| 111 |
|
return False |
| 112 |
|
if step == "B": |
| 113 |
|
if hold_box: |
| 114 |
|
if field[s_row][s_col] == "B": |
| 115 |
|
hold_box = False |
| 116 |
|
total_time += 1 |
| 117 |
|
continue |
| 118 |
|
else: |
| 119 |
|
print("Stephan broke the cargo") |
| 120 |
|
return False |
| 121 |
|
else: |
| 122 |
|
if field[s_row][s_col] == "B": |
| 123 |
|
hold_box = True |
| 124 |
|
total_time += 1 |
| 125 |
|
continue |
| 126 |
|
n_row, n_col = s_row + ACTIONS[step][0], s_col + ACTIONS[step][1] |
| 127 |
|
total_time += 2 if hold_box else 1 |
| 128 |
|
if 0 > n_row or n_row >= max_row or 0 > n_col or n_row >= max_col: |