<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>
The projects are moving along.<BR>
&nbsp;<BR>
I've created a very simplistic cricket game to learn a few things.<BR>
&nbsp;<BR>
The user is asked whether to play Aggressive or Defensively.<BR>
&nbsp;<BR>
Once they pick... a random is picked based on their choice,.. and various scores happen until they get out.<BR>
&nbsp;<BR>
Ignore the realism at this point,.. just getting the basic mechanics working first.<BR>
&nbsp;<BR>
Works fine no problem.<BR>
&nbsp;<BR>
I want to be able to calculate in the program,.. the total score,.. either at each successive score,... or when they finally get out. Not sure how to do that at this point.<BR>
&nbsp;<BR>
So the output would look something like this.<BR>
&nbsp;<BR>
You Hit a 2, you now have scored 2 runs<BR>
You hit a 4, you now have scored 6 runs<BR>
You hit a "Out", you are dismissed for 6 runs total.<BR>
&nbsp;<BR>
After i get this worked out.. will tweak the actual formulas for the randoms, maybe put in multiple outs etc,.. changeable strategy at each out etc, and high scores list towards the end.<BR>
&nbsp;<BR>
First things first,... and the project at hand.<BR>
&nbsp;<BR>
How do i ... post the totals... as listed above, to the working code below.<BR>
&nbsp;<BR>
&nbsp;<BR>
Thanks as always<BR>
&nbsp;<BR>
Tony Noyeaux<BR>
&nbsp;<BR>
---------------------------------------------------------------------------------<BR>
import random<BR>
score = None<BR>strat = raw_input("Will you play (a)aggressive or (b)defensive?")<BR>if strat == "a":<BR>&nbsp;while score != "Out":<BR>&nbsp;&nbsp;score = random.choice(["1","2","3","4","4","6","6","Out","Out","Out","Out"]) <BR>&nbsp;&nbsp;print score<BR>else:<BR>&nbsp;while score != "Out":<BR>&nbsp;&nbsp;score = random.choice(["1","1","2","2","3","4","6","Out"])<BR>&nbsp;&nbsp;print "You hit a "+score<BR>
----------------------------------------------------------------------------------<BR><br /><hr />PC Magazine’s 2007 editors’ choice for best web mail—award-winning Windows Live Hotmail. <a href='http://imagine-windowslive.com/hotmail/?locale=en-us&ocid=TXT_TAGHM_migration_HMWL_mini_pcmag_0707' target='_new'>Check it out!</a></body>
</html>