Repository: HumanCompatibleAI/overcooked_ai
Issue: Possible Bug in featurize_state() – Incorrect Distances for Serving and Empty Counter
Root cause: Algorithmic Error

**Problem:**
I'm encountering a potential issue with the data returned by the step() function.

After analyzing the 96-element state vector it returns and comparing it with the indexing described in the featurize_state() function (overcooked_mdp.py, line 2597), I noticed some inconsistencies.

**Observations:**
- The player's distance to the serving station is expected to be found at indices 16:18.
- However, this value is always (0, 0) and becomes (num_onion_in_soup, 0) when an agent is holding a soup.

The distance to an empty counter, which should be located at indices 18:20, seems to instead report the distance to the serving station.

This suggests that either the values are being calculated incorrectly, or the indexing in the feature vector doesn't align with what's described in the code.

Could you please verify whether this is a bug or if I'm misunderstanding the intended feature indexing, I've left some code to reproduce the two problem that I'm talking about.

Thanks!
```
layouts = ["cramped_room"]
base_mdp = OvercookedGridworld.from_layout_name(layout)
base_env = OvercookedEnv.from_mdp(base_mdp, info_level=info_level, horizon=horizon)
env = Overcooked(base_env=base_env, featurize_fn=base_env.featurize_state_mdp)

put_onion = [2,5,3,0,5,3]
put_onion_cook = [2,5,3,0,5,5]
wait_cook = [4]*20
take_dish_serve = [1,3,1,5,2,0,5,2,1,5]

action_seq_1_onion = put_onion_cook + wait_cook + take_dish_serve
action_seq_3_onion = put_onion + put_onion + put_onion_cook + wait_cook + take_dish_serve
for i in range(2):
    obs = env.reset()
    agents_obs, env_state, other_agent_idx = obs['both_agent_obs'], obs['overcooked_state'], obs['other_agent_env_idx']
    done = False

    if i % 2 == 0:
        action_seq = action_seq_1_onion
    else:
        action_seq = action_seq_3_onion

    for i in range(len(action_seq)):
        env.render(env_state, timeout=100)
        agent1_obs, agent2_obs = agents_obs[0], agents_obs[1]

        # See overcooked_mdp.py line 2597 to see the indexing
        print("Orientation", agent1_obs[0:4], agent2_obs[0:4])
        print("Obj hold", agent1_obs[4:8], agent2_obs[4:8])
        print("Onion", agent1_obs[8:10], agent2_obs[8:10])
        print("Tomato", agent1_obs[10:12], agent2_obs[10:12])
        print("Dish", agent1_obs[12:14], agent2_obs[12:14])
        print("Soup", agent1_obs[14:16], agent2_obs[14:16])
        print("Serving (dx, dy):", agent1_obs[16:18], agent2_obs[16:18])
        print(f"Empty counter (dx, dy): {agent1_obs[18:20]}, {agent2_obs[18:20]}")
        print("-------------------------------------------------------------------")

        if other_agent_idx == 1:
            agent1_action = 4
            if i == 0:
                agent1_action = 0
            agent2_action = action_seq[i]  # STAY
        else:
            agent1_action = action_seq[i]
            agent2_action = 4  # STAY
            if i == 0:
                agent2_action = 0  # Go UP to free dishes location

        obs, reward, done, env_info = env.step((agent1_action, agent2_action))

        if reward > 0:
            print(reward)

        agents_obs, env_next_state, other_agent_idx = obs['both_agent_obs'], obs['overcooked_state'], obs['other_agent_env_idx']
        env_state = env_next_state
```