How to make an array of objects in Python?
How to make an array of objects in Python?
You are setting the class attributes, instead of assigning values to an instance of the class:
class piece:
def __init__(self, x_position, y_position, p_rank, p_family):
self.x = x_position
self.y = y_position
self.rank = p_rank
self.family = p_family
You are trying to set values to the class variables which are static. Hence only one copy is created and shared by all instances of the class. Hence only the last value is reflected