0

I'm trying to make a simple 5v5 sport management, but I'm not sure how can I link players to teams, in order to make the overall rating of the team be the sum of the players rating / amount of players. Unfortunately my current code only returns where the object is ( <main.Player object at 0x000001CED897FCD0>) but not the player at all, so of course the overall is off

class Player:
    totalPlayers = 0
    def __init__(self,PName, PYearBorn, POvr, PNumber, PIndex):
        self.PName = PName
        self.PYearBorn = PYearBorn
        self.POvr = POvr
        self.PNumber = PNumber
        self.PIndex = PIndex
        Player.totalPlayers += 1
    def getPlayer(self):
        return self.PName, self.PYearBorn, self.POvr, self.PNumber, self.PIndex

'''
Player Name
Year Born
Player Overall
Player Number
Player Index'''

class HistoricPlayer(Player):
    def __init__(self,PName, PlayerAge, POvr, PNumber, PIndex):
        self.PlayerAge=PlayerAge
        Player.__init__(self,PName, PlayerAge, POvr, PNumber, PIndex,)
class Franchise():
    totalFranchises = 0
    def __init__(self, FName, region, championships, yearCreated, rivals):
        self.FName = FName
        self.region = region
        self.championships = championships
        self.yearCreated = yearCreated
        self.rivals = rivals
        Franchise.totalFranchises += 1
class Team(Franchise):
    totalTeams = 0
    def __init__(self, TName, FName, amountofplayers, maxplayercapacity, region, championships, yearCreated, rivals, currentplayers):
        Franchise.__init__(self, FName, region, championships, yearCreated, currentplayers)
        self.currentplayers = currentplayers
        self.overall = currentplayers[1].POvr/amountofplayers
        self.rivals = rivals
        self.TName = TName
        self.amountofplayers = amountofplayers
        self.maxplayercapacity = maxplayercapacity
        self.currentplayers = currentplayers
        Team.totalTeams+=1

    def getTeam(self):
        return self.TName, self.FName, self.amountofplayers, self.maxplayercapacity, self.region, self.championships, self.yearCreated, self.rivals, self.currentplayers

    ''' #Team Class Values
    Team Name
    Franchise Name
    Overall
    Amount of current players
    Maximum player capacity
    Team Region
    Championships
    Year of Creation
    Rivals
    Current Players
    '''

P01=Player('Francis', 2000, 8, 69, 'p01')
P02=Player('Franton', 2000, 8, 69, 'p01')
P03=Player('Frank', 2000, 8, 69, 'p01')
P04=Player('Felitio', 2000, 8, 69, 'p01')
P05=Player('Fred', 2000, 8, 69, 'p01')
T01=Team('5 Friends', "The friends' club", 5, 6, "Hometown", 0, 2022, 'Rich', (P01, P02, P03, P04, P05))
print(T01.getTeam())

Any idea what should or can I do/what am I doing wrong?

Remi
  • 33
  • 5
  • 1
    `` means that the object is there, but Python doesn't know how to print the object. Your function is still returning the object though. – Michael M. Oct 27 '22 at 01:24
  • Yeah but the overall returns 0 so, somehow i'm not calling it right – Remi Oct 27 '22 at 01:35

0 Answers0