I\'m currently making a tic-tac-toe program with AI and i\'m having a bit of a trouble translating this line of code (python) :
RANKS = dict([(4,3),
You could use a map or unordered_map for this (and they'd work fine) but given that your keys are a dense set of integers (I.e. all the integers from 0 to N) there are better choices.
I'd probably use an std::array
instead. It would look something like this:
std::array vals = { 2, 1, 2, 1, 3, 1, 2, 1, 2 };
This gives pretty much the same syntax and observable behavior, but will typically save quite a bit of memory and probably CPU time as well.