Skip to content

Build A Player Interface: Type hints invalidating Test No. 9 #71760

In review

Description

@mr-payaso

Describe the Issue

When type hints are used when defining the make_move() function, Test No. 9: "The Player's make_move method should have a single parameter self." fails. Removing the hints will validate the test.

Affected Page

https://www.freecodecamp.org/learn/python-v9/lab-player-interface/build-a-player-interface

Your code

from abc import ABC, abstractmethod
import random

class Player(ABC):
    def __init__(self) -> None:
        self.moves = []
        self.position = (0, 0)
        self.path = [self.position]

    def make_move(self) -> (int, int):
        move = random.choice(self.moves)
        new_position = (self.position[0] + move[0], self.position[1] + move[1])
        self.position = new_position
        self.path.append(new_position)
        return new_position

    @abstractmethod
    def level_up(self) -> None:
        pass

class Pawn(Player):
    def __init__(self) -> None:
        super().__init__()
        self.moves = [(0,1),(0,-1),(-1,0),(1,0)] # Up, Down, Left, Right

    def level_up(self):
        self.moves.extend([(1,1),(-1,1),(-1,-1),(1,-1)]) # In degrees: 45, 135, ...

Expected behavior

It is expected that the code passes the aforementioned test as it only has self as the parameter.

Screenshots

image image

System

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/157.0.0.0 Safari/537.36

Additional context

No response

Activity

  1. added
    scope: curriculum
    status: waiting triage
    on Nov 22, 2026
  2. added theissue type on Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scope: curriculumstatus: waiting triage

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions