<html>
<head>
<style>
P
{
margin:0px;
padding:0px
}
body
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body>
The projects are moving along.<BR>
<BR>
I've created a very simplistic cricket game to learn a few things.<BR>
<BR>
The user is asked whether to play Aggressive or Defensively.<BR>
<BR>
Once they pick... a random is picked based on their choice,.. and various scores happen until they get out.<BR>
<BR>
Ignore the realism at this point,.. just getting the basic mechanics working first.<BR>
<BR>
Works fine no problem.<BR>
<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>
<BR>
So the output would look something like this.<BR>
<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>
<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>
<BR>
First things first,... and the project at hand.<BR>
<BR>
How do i ... post the totals... as listed above, to the working code below.<BR>
<BR>
<BR>
Thanks as always<BR>
<BR>
Tony Noyeaux<BR>
<BR>
---------------------------------------------------------------------------------<BR>
import random<BR>
score = None<BR>strat = raw_input("Will you play (a)aggressive or (b)defensive?")<BR>if strat == "a":<BR> while score != "Out":<BR> score = random.choice(["1","2","3","4","4","6","6","Out","Out","Out","Out"]) <BR> print score<BR>else:<BR> while score != "Out":<BR> score = random.choice(["1","1","2","2","3","4","6","Out"])<BR> 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>