connect four (game)
nospam.Chris Angelico
rosuav at gmail.com
Mon Nov 27 04:10:00 EST 2017
On Mon, Nov 27, 2017 at 9:01 PM, <namenobodywants at gmail.com> wrote:
> On Sunday, November 26, 2017 at 7:09:25 PM UTC-8, Michael Torrie wrote:
>
>> So you are using this Infinity class as a sentinel value of some kind?
>> Representing game state? There may be an easier way than a full on
>> custom type. Sometimes just a sentinel object is sufficient. Or an
>> enumeration.
>
> they're not sentinels; they're the maximum and minimum of the extended real
numbers; the point is that, no matter how boards are evaluated (which is, of
course, subject to change), a won game is always the most valuable and a lost
game is always the least valuable; ordinary real numbers could be used for the
purpose, but in that case i would have to figure out the maximum and minimum of
the heuristic values the script assigns and then add/subtract one (for
example) to get the value of a won/lost game
>
Or you could use the floating-point values for positive and negative infinity,
which already compare as you need with all integers and floats. But that's up
to you.
ChrisA
More information about the Python-list
mailing list