Run the game

  Blog    |     February 06, 2026

Here's a Python implementation of the "Wrong Factory" map with interactive gameplay elements:

class WrongFactoryMap:
    def __init__(self):
        # 10x10 grid representing the factory floor
        self.grid = [
            ['E', '.', '.', '#', '.', '.', '.', '.', '.', '.'],
            ['.', '#', '.', '#', '.', '#', '#', '#', '#', '#'],
            ['.', '#', '.', '.', '.', '.', '.', '.', '.', '.'],
            ['.', '#', '#', '#', '#', '#', '#', '.', '#', '#'],
            ['.', '.', '.', '.', '.', '.', '.', '.', '.', '.'],
            ['#', '#', '#', '#', '#', '.', '#', '#', '#', '.'],
            ['.', '.', '.', '.', '.', '.', '.', '.', '.', '.'],
            ['.', '#', '#', '#', '#', '#', '#', '#', '#', '.'],
            ['.', '.', '.', '.', '.', '.', '.', 'C', '.', '.'],
            ['.', '#', '#', '#', '#', '#', '#', '#', 'X', '#']
        ]
        self.player_pos = [0, 0]  # Starting position (Entry point)
        self.has_key = False
        self.assembly_active = True
        self.moves = 0
    def display_map(self):
        # Create a copy of the grid to show player position
        display_grid = [row[:] for row in self.grid]
        display_grid[self.player_pos[0]][self.player_pos[1]] = 'P'
        print("\nFactory Floor Map (P = Player):")
        print("Legend: E=Entry, C=Control Room, X=Exit, #=Wall, .=Floor")
        print("        A=Assembly Line (Hazard), S=Storage, K=Key")
        print("----------------------------------------------------")
        for row in display_grid:
            print(' '.join(row))
        print(f"Moves: {self.moves} | Key: {'Found' if self.has_key else 'Missing'} | Assembly: {'Active' if self.assembly_active else 'Inactive'}")
    def move_player(self, direction):
        moves = {
            'up': (-1, 0),
            'down': (1, 0),
            'left': (0, -1),
            'right': (0, 1)
        }
        if direction not in moves:
            print("Invalid direction! Use: up, down, left, right")
            return False
        dy, dx = moves[direction]
        new_y, new_x = self.player_pos[0] + dy, self.player_pos[1] + dx
        # Boundary check
        if not (0 <= new_y < 10 and 0 <= new_x < 10):
            print("Can't move outside the factory!")
            return False
        # Wall collision check
        if self.grid[new_y][new_x] == '#':
            print("There's a wall in the way!")
            return False
        # Hazard handling (assembly line)
        if self.assembly_active and self.grid[new_y][new_x] == 'A':
            print("Ouch! You've been caught in the assembly line!")
            return False
        # Movement logic
        self.player_pos = [new_y, new_x]
        self.moves += 1
        # Item interactions
        cell = self.grid[new_y][new_x]
        if cell == 'K':
            self.has_key = True
            self.grid[new_y][new_x] = '.'  # Remove key after pickup
            print("You found a key!")
        elif cell == 'S':
            print("You're in the storage area. Search for items?")
            # Add item interaction logic here
        elif cell == 'C':
            if self.has_key:
                print("You unlocked the control room!")
                self.assembly_active = False  # Deactivate assembly lines
            else:
                print("The control room is locked. You need a key!")
        return True
    def play(self):
        print("Welcome to the Wrong Factory! Find the key and escape.")
        while True:
            self.display_map()
            # Check win condition
            if self.player_pos == [9, 8]:  # Exit position
                print("\nCongratulations! You escaped the factory!")
                break
            # Get player input
            action = input("\nEnter action (move up/down/left/right or quit): ").lower().strip()
            if action == 'quit':
                print("Game ended. Better luck next time!")
                break
            if action.startswith('move '):
                direction = action.split()[1]
                self.move_player(direction)
            else:
                print("Invalid command. Use 'move [direction]' or 'quit'")
if __name__ == "__main__":
    factory = WrongFactoryMap()
    factory.play()

Key Features:

  1. Interactive Map:

    • 10x10 grid with walls (#), empty paths (.), entry (E), control room (C), exit (X), assembly lines (A), storage (S), and keys (K)
    • Player position marked as 'P'
  2. Game Mechanics:

    • Movement controls (up/down/left/right)
    • Collision detection for walls and active assembly lines
    • Key collection system
    • Assembly line hazards that deactivate after unlocking control room
    • Move counter and status tracking
  3. Objective:

    • Find the key (K) to unlock the control room (C)
    • Deactivate assembly lines by accessing control room
    • Reach the exit (X) to win
  4. Visual Feedback:

    • Dynamic map display with player position
    • Status indicators for key possession and assembly line state
    • Clear legend and move counter

How to Play:

  1. Run the program to start the game
  2. Use commands like move down, move right, etc. to navigate
  3. Avoid walls (#) and active assembly lines (A)
  4. Find the key (K) to unlock the control room (C)
  5. Reach the exit (X) after deactivating assembly lines

The map creates a challenging puzzle where players must strategically navigate hazards while collecting key items to unlock areas and escape. The "Wrong Factory" theme is enhanced by the dangerous assembly lines and locked control room mechanics.


Request an On-site Audit / Inquiry

SSL Secured Inquiry