Build a Player Interface - Build a Player Interface

Tell us what’s happening:

Test 9 Error: ‘make_move’ method should have a single parameter ‘self’

Your code so far

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.append((1,1),(-1,1),(-1,-1),(1,-1)) # 45, 135, ...

pawn = Pawn()
pawn.make_move()

Your browser information:

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

Challenge Information:

Build a Player Interface - Build a Player Interface

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-player-interface/68e2c945cc1d8e778152be31.md at main · freeCodeCamp/freeCodeCamp · GitHub

Nevermind, it has an error on the ‘Pawn’ class’ ‘level_up’ method.

Never-never-mind. That was a different problem.

Solved it . Removed the hints (int, int).

I’m pretty sure it’s not supposed to do that…

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.