def _do_action_left(self, state):
reward = <NUM_LIT:0><EOL>for row in range(<NUM_LIT:4>):<EOL><INDENT>merge_candidate = -<NUM_LIT:1><EOL>merged = np.zeros((<NUM_LIT:4>,), dtype=np.bool)<EOL>for col in range(<NUM_LIT:4>):<EOL><INDENT>if state[row, col] == <NUM_LIT:0>:<EOL><INDENT>continue<EOL><DEDENT>if (merge_candidate != -<NUM_LIT:1> and<EOL>not merged[merge_candidate] and<EOL>state[row, merge_candidate] == state[row, col]):<EOL><INDENT>state[row, col] = <NUM_LIT:0><EOL>merged[merge_candidate] = True<EOL>state[row, merge_candidate] += <NUM_LIT:1><EOL>reward += <NUM_LIT:2> ** state[row, merge_candidate]<EOL><DEDENT>else:<EOL><INDENT>merge_candidate += <NUM_LIT:1><EOL>if col != merge_candidate:<EOL><INDENT>state[row, merge_candidate] = state[row, col]<EOL>state[row, col] = <NUM_LIT:0><EOL><DEDENT><DEDENT><DEDENT><DEDENT>return reward<EOL>
Executes action 'Left'.