Build a Player interface

can someone help me with this…

my code:

from abc import ABC, abstractmethod

import random

class Player(ABC):

def \__init_\_(self):

    self.moves=\[\]

    self.position=(0, 0)

    self.path=\[self.position\]



def make_move(self):

    move=random.choice(self.moves)

    self.position=(self.position\[0\]+move\[0\]+self.position\[1\]+move\[1\])

    self.path.append(self.position)

    return self.position

Hi @mohammedsameermys

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge.

The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

I got it but I need help with the code to solve the error

We need a link to the challenge and your formatted code, which is what using the “Help” button provides.

I need help with this…

import random
from abc import ABC

def __init__(self):
    self.moves=[]
    self.position=(0, 0)
    self.path=[self.position]

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

import random
from abc import ABC

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

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

Isn’t self.position supposed to be a tuple? See the __init__ method.

Happy coding

I went ahead and combined your posts for you. In the future, just reply to the original thread to add further updates.