GNVE
Active Member
- Jul 20, 2018
- 724
- 1,190
So I'm kinda stuck and I don't see why I'm getting an unexpected result.
I got the following code which should select the next event to play.
what I expect it to do is the following:
if the currently selected tuple and the comparison are both red see which priority is the lowest number,
if the selected tuple is not red and the comparison is do nothing,
if the selected tuple is red and the comparison is not overwrite the current tuple
if neither is red select the tuple with the lowest number.
And yet it doesn't do that and I don't see why.
it has the following data and as far as I can see it should select the blue event:
and yet it's outcome is:
I got the following code which should select the next event to play.
what I expect it to do is the following:
if the currently selected tuple and the comparison are both red see which priority is the lowest number,
if the selected tuple is not red and the comparison is do nothing,
if the selected tuple is red and the comparison is not overwrite the current tuple
if neither is red select the tuple with the lowest number.
And yet it doesn't do that and I don't see why.
Python:
temptuple = ('','red')
priority = 100
for i in self.store['currenttuples']:
if i[1] == 'Red' and temptuple[1] == 'Red':
if priority > i[3]:
temptuple = i
priority = i[3]
elif i[1] == 'Red':
pass
elif temptuple[1] == 'Red':
temptuple = i
priority = i[3]
elif priority > i[3]:
temptuple = i
priority = i[3]
self.store['chosentuple'] = temptuple

and yet it's outcome is:

Last edited: