samedi 24 février 2018

Keep a 2-tuple of ints within a specific range

I am having trouble with logic checks. There is a coordinate system grid that is 15x15, row x column.

There is a random list of 2-tuples that contains coordinates:[(3,3),(4,5),(14,14),(13,0),(0,13)].

I would like to check if some random choice tuple is within a certain range: 2x2 and 12x12. So for example the tuple: (3,3) and (4,5) would be allowed, but (13,0) and (0, 13) would not.

How would I go about implementing checks to see if a tuple pair lies within the range?

Aucun commentaire:

Enregistrer un commentaire