I am running simple simulations with Python, trying to learn the inner workings of AI. I've built up a very simple framework for drawing visual representations of what I'm working with (to give the ANN a "playground" to survive in).
class GUI: #Parent class for all displayed object classes
def __init__(self, x, y, width, height, xB, yB, image, isImage, color):
GUIObj.append(self)
#Appends self to a list that is iterated through in the main loop, where each iterated element
#has its .display() method run.
self.coord = (x, y) #SUBJECT MATTER
self.size = (width, height) #SUBJECT MATTER
def move(self, direction, distance=1):
#SUBJECT MATTER
self.coord = ( (self.coord[0] + direction[0] * distance) * SRConst[0], (self.coord[1] + direction[1] * distance) * SRConst[1])
Early on in my learning of Python, it was my understanding that tuples are calculated much faster than lists. And as you can see, I use tuples for the coordinates of my objects.
However, I am currently wondering if tuples are a good choice, when the values of these variables change quite frequently (with the "entity body" coordinates changing a lot, as you can imagine). And so I ask, simply: Is this faster, or should I be using mutable lists?