<s>[INST] import numpy as np

class Pedestrian:
    def __init__(self, x, y):
        self.x = x
        self.y = y
        self.direction = np.random.choice(['up', 'down', 'left', 'right'])

    def move(self):
        if self.direction == 'up':
            self.y += 1
        elif self.direction == 'down':
            self.y -= 1
        elif self.direction == 'left':
            self.x -= 1
        elif self.direction == 'right':
            self.x += 1

    def change_direction(self):
        self.direction = np.random.choice(['up', 'down', 'left', 'right'])

# Simulate pedestrian movement
pedestrian = Pedestrian(0, 0)
for step in range(10):
    pedestrian.move()
    print(f'Step {step+1}: ({pedestrian.x}, {pedestrian.y})')
    if np.random.random() < 0.2:
        pedestrian.change_direction()
        print(f'Changed direction to {pedestrian.direction}')

This code defines a simple simulation of a pedestrian moving around. The pedestrian starts at the origin (0,0) and moves in a random direction at each step. There's a 20% chance of changing direction at each step. 

However, I want to define a grid and have the pedestrians move within that grid. How would I modify the code to achieve that?[/INST]