Re: [Tutor] Risk Dice Program

2015-01-27 Thread Mark Lawrence
On 28/01/2015 01:28, Alan Gauld wrote: On 28/01/15 00:09, Mark Lawrence wrote: To get round that you need to explicitly compare o_die1 to both values: if (o_die1 > d_die1) or (o_die1 > d_die2): I consider the chained comparisons shown here https://docs.python.org/3/reference/expressio

Re: [Tutor] Risk Dice Program

2015-01-27 Thread Alan Gauld
On 28/01/15 00:09, Mark Lawrence wrote: To get round that you need to explicitly compare o_die1 to both values: if (o_die1 > d_die1) or (o_die1 > d_die2): I consider the chained comparisons shown here https://docs.python.org/3/reference/expressions.html#not-in to be far more Pythonic.

Re: [Tutor] Risk Dice Program

2015-01-27 Thread Mark Lawrence
On 27/01/2015 23:09, Alan Gauld wrote: On 27/01/15 19:12, Dillon Cortez wrote: problem is that if any of the offensive dice is bigger > than only one of the defensive dice, the program shows the offense as the winner, def winner(): if o_die1 > d_die1 or d_die2: print "The off

Re: [Tutor] Risk Dice Program

2015-01-27 Thread Alan Gauld
On 27/01/15 19:12, Dillon Cortez wrote: problem is that if any of the offensive dice is bigger > than only one of the defensive dice, the program shows the offense as the winner, def winner(): if o_die1 > d_die1 or d_die2: print "The offense has won" The problem is that the c

[Tutor] Risk Dice Program

2015-01-27 Thread Dillon Cortez
I’m trying to write a program for the dice in a game of risk. It runs but the problem is that if any of the offensive dice is bigger than only one of the defensive dice, the program shows the offense as the winner, even when the defense should win. Can you help me out with this? here’s the code