The problem is how to represent the 3x3 grid of Vess Cola cards in such a way that I can compare the color and bottle top/bottom. Red Top must match Red Bottom, and so forth.
At first glance, a good data structure to represent the cards' grid would be a directed graph.
A directed graph would be simpler than an undirected graph. The compare only needs to work one way.
For example, Card 0 only has to compare itself to Cards 1 and 3. The relationship is symmetrical. If Card 0 matches Card 1 then certainly Card 1 matches Card 0. With a directed graph, I can connect the cards together to quickly traverse the pattern.
So how to represent in Python?
There are numerous graph libraries. There are numerous graph libraries in Python.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.