Blake's Project - Under Construction

blake

School Cricketer
Joined
Jul 15, 2007
Location
Brisbane, Australia
Online Cricket Games Owned
As of yet I have not started any of the programming - just the runscoring algorithm. I haven't enough knowledge yet to make the menus look good and get all the team selection, etc. working yet, but I think I can simulate a match - using a lot of hard work.

This is just a core project right now - only at the very beginning. Just doing this for fun really, and there is not a huge chance of this being finished.

My run algorithm seems to be working solidly now - it is still not brilliant.

I have completed 2 overs of testing. Here is how my ball is determined.

There are 48 different places a ball can be delivered, ranging from a full toss from wide outside off, or an extremely short bouncer outside leg.

Each place in the pitch is given a value, for the bowler and batsman. Each batsman's values is individual, so a batsman might be better at playing certain areas than other.

The bowler is assigned skill and consistency. Consistency determines where the ball will land - the higher the consistency, the better place the ball will land - the ideal spot is on a good length outside off for a test match.

Each place in the pitch where a ball can land is given a value for bowling also which is fixed for all bowlers. Once a location is determined, the value is multiplied by the bowler's skill to find the 'BowlBall' value, which is the final value of how good a delivery it is.

For the batsman, a random number is now chosen between 4-25 which is then divided by 10. (I could've just done 0.4 to 2.5 but I am not sure how decimals fully work yet in C++ with random number selection). Next, it is determined where the ball has landed from the bowler, and we find out how good the batsman is in that area. Now, the random number is multiplied by the batsman's skill in the area which finds the BatBall value.

Finally, BatBall is divided by BowlBall, and whatever the number determines the result. The lower the number, the more runs scored.

I have assigned a good length outside off a value of 9, and an extreme bouncer outside leg a value of 0.5, which is the worst you can get.

I haven't added any extras (wides, no balls, byes, etc.) yet. Just pure runs.

I have tested two bowlers (Glenn McGrath and Brett Lee).

Glenn McGrath:
Consistency: 95
Skill: 80

Brett Lee
Consistency: 80
Skill: 95

These are two top notch bowlers, and I have made a batsman called Blake. He is a good opening batsman with solid attributes. Here is how the 5 overs panned out.

0.1 Glenn McGrath to Blake: Outside Off, Blockhole, 0 runs
0.2 Glenn McGrath to Blake: Off Stump, Blockhole, 0 runs
0.3 Glenn McGrath to Blake: Straight, Blockhole, 0 runs
0.4 Glenn McGrath to Blake: Straight, Blockhole, 1 run
0.5 Glenn McGrath to Blake: Straight, Blockhole, 0 runs
0.6 Glenn McGrath to Blake: Off Stump, Good Length, 0 runs

Only one batsman, no running between wickets yet.

A very full over from McGrath. Considering it is test match cricket, I might have to make shorter deliveries far more common. Still, a blockhole is a handy delivery here and tough to score from.

Batsmen 0/1 (1.0 overs)
Blake: 1* (6)
McGrath: 1-0-1-0

1.1 Brett Lee to Blake: Off Stump, Blockhole, 0 runs
1.2 Brett Lee to Blake: Leg Stump, Blockhole, 2 runs
1.3 Brett Lee to Blake: Outside Off, Low Full Toss, 4 runs

1.4 Brett Lee to Blake: Leg Stump, Blockhole, 0 runs
1.5 Brett Lee to Blake: Straight, Good Length, 2 runs
1.6 Brett Lee to Blake: Outside Off, Blockhole, 2 runs


Expensive over from Brett Lee. Lee's consistency isn't as good, meaning the ball doesn't always find the best areas, but his skill is higher, giving him a better chance of taking a wicket. Still, the run rate is a little high for a test match.

Batsmen 0/11 (2.0 overs)
Blake: 11* (12)
Lee: 1-0-10-0

2.1 Glenn McGrath to Blake: Off Stump, Blockhole, 0 runs
2.2 Glenn McGrath to Blake: Wide Off, Good Length, 2 runs
2.3 Glenn McGrath to Blake: Wide Off, Good Length, 3 runs
2.4 Glenn McGrath to Blake: Straight, Blockhole, 1 run
2.5 Glenn McGrath to Blake: Wide Off, Good Length, 2 runs

2.6 Glenn McGrath to Blake: Straight, Blockhole, 0 runs

Turning out a bit more like One Day cricket now. Perhaps I should change it to that. Good start anyway for the batsman.

Batsmen 0/19 (3.0 overs)
Blake: 19* (18)
McGrath: 2-0-9-0

3.1 Brett Lee to Blake: Off Stump, Good Length, OUT
3.2 Brett Lee to Blake: Outside Off, Blockhole, 2 runs
3.3 Brett Lee to Blake: Off Stump, Blockhole, 2 runs
3.4 Brett Lee to Blake: Outside Off, Low Full Toss, 4 runs
3.5 Brett Lee to Blake: Leg Stump, Blockhole, 1 run
3.6 Brett Lee to Blake: Wide Off, Good Length, 2 runs


Batsmen 1/30 (4.0 overs)
Blake c Gilchrist b Lee 19 (19)
Blake 2: 11* (5)
Lee: 2-0-21-1

Brett Lee gets the breakthrough in an eventful over, it was pitched on a good length and the worst possible random number for the batsman is never a good sign.

4.1 Glenn McGrath to Blake: Off Stump, Good Length, 0 runs
4.2 Glenn McGrath to Blake: Straight, Blockhole, 0 runs
4.3 Glenn McGrath to Blake: Off Stump, Blockhole, 0 runs
4.4 Glenn McGrath to Blake: Off Stump, Blockhole, 0 runs
4.5 Glenn McGrath to Blake: Outside Off, Good Length, 0! runs
4.6 Glenn McGrath to Blake: Off Stump, Blockhole, 0 runs

Maiden over from McGrath, including a perfect ball on a good length outside off. Blake probed at it but it fell short of first slip.

Batsmen 1/30 (5.0 overs)
Run Rate: 6.00
Blake c Gilchrist b Lee 19 (19)
Blake 2: 11* (11)
McGrath: 3-1-9-0

So, there we have it, the first 5 overs using my algorithm. Now that I look at this I find out that I need to include far more short deliveries and way less blockholers as it is quite rare to see a delivery pitched in the blockhole in a test match, let alone 3 every over.

Solid start anyway by my sim. Tweaking needed but it is looking decent anyway. :)
 

dbest

School Cricketer
Joined
Apr 14, 2007
Online Cricket Games Owned
Nice start. 1/30 of 5 overs would seem perfect for an ODI rather than a test match.

We seem to have similar issues with the runs being scored. :)
 

Kshitiz_Indian

Executive member
Joined
Apr 9, 2006
Location
New Delhi, India
Hi blake,

It sounds like a promising project. But just to say, I don't understand why so many sim projects have started ever since sohum's one started, and I started one in May. I've completed mine now [Its in BETA test phase]. I made it for a school project.

Since yours is in C++ as well, I might be able to give a little help here and there. I've made one for T20 Cricket only though, so here's a sim sheet to show how to make pacing vary. My commentary is pretty similar to yours somehow :p But mine was finished way back, just didn't think it useful to release on PC.

Good luck, though I'd suggest if you make something different now. :)


Dale Steyn to Graeme Smith, Dot Ball
Dale Steyn to Graeme Smith, FOUR
Dale Steyn to Graeme Smith, Dot Ball
Dale Steyn to Graeme Smith, Three Runs
Dale Steyn to Jacques Kallis, Single
Dale Steyn to Graeme Smith, Single

Over Up

Scorecard
Runs : 9
Wickets : 0
Overs : 1.0


Wayne Parnell to Graeme Smith, Single
Wayne Parnell to Jacques Kallis, OUT
Wayne Parnell to Herschelle Gibbs, Dot Ball
Wayne Parnell to Herschelle Gibbs, Dot Ball
Wayne Parnell to Herschelle Gibbs, Dot Ball
Wayne Parnell to Herschelle Gibbs, FOUR

Over Up

Scorecard
Runs : 14
Wickets : 1
Overs : 2.0


Dale Steyn to Graeme Smith, Single
Dale Steyn to Herschelle Gibbs, Dot Ball
Dale Steyn to Herschelle Gibbs, SIX
Dale Steyn to Herschelle Gibbs, Three Runs
Dale Steyn to Graeme Smith, FOUR
Dale Steyn to Graeme Smith, Three Runs

Over Up

Scorecard
Runs : 31
Wickets : 1
Overs : 3.0


Wayne Parnell to Graeme Smith, OUT
Wayne Parnell to AB de Villiers, Dot Ball
Wayne Parnell to AB de Villiers, Single
Wayne Parnell to Herschelle Gibbs, Dot Ball
Wayne Parnell to Herschelle Gibbs, Three Runs
Wayne Parnell to AB de Villiers, Three Runs

Over Up

Scorecard
Runs : 38
Wickets : 2
Overs : 4.0


Dale Steyn to AB de Villiers, Dot Ball
Dale Steyn to AB de Villiers, Single
Dale Steyn to Herschelle Gibbs, Two Runs
Dale Steyn to Herschelle Gibbs, Dot Ball
Dale Steyn to Herschelle Gibbs, Dot Ball
Dale Steyn to Herschelle Gibbs, Two Runs

Over Up

Scorecard
Runs : 43
Wickets : 2
Overs : 5.0


Wayne Parnell to AB de Villiers, Dot Ball
Wayne Parnell to AB de Villiers, Single
Wayne Parnell to Herschelle Gibbs, SIX
Wayne Parnell to Herschelle Gibbs, OUT
Wayne Parnell to Jean-Paul Duminy, Two Runs
Wayne Parnell to Jean-Paul Duminy, FOUR

Over Up

Scorecard
Runs : 56
Wickets : 3
Overs : 6.0


Albie Morkel to AB de Villiers, Single
Albie Morkel to Jean-Paul Duminy, Dot Ball
Albie Morkel to Jean-Paul Duminy, Dot Ball
Albie Morkel to Jean-Paul Duminy, Two Runs
Albie Morkel to Jean-Paul Duminy, Dot Ball
Albie Morkel to Jean-Paul Duminy, FOUR

Over Up

Scorecard
Runs : 63
Wickets : 3
Overs : 7.0


Jacques Kallis to AB de Villiers, FOUR
Jacques Kallis to AB de Villiers, Two Runs
Jacques Kallis to AB de Villiers, Single
Jacques Kallis to Jean-Paul Duminy, Dot Ball
Jacques Kallis to Jean-Paul Duminy, Two Runs
Jacques Kallis to Jean-Paul Duminy, Dot Ball

Over Up

Scorecard
Runs : 72
Wickets : 3
Overs : 8.0


Johan Botha to AB de Villiers, Single
Johan Botha to Jean-Paul Duminy, Three Runs
Johan Botha to AB de Villiers, Three Runs
Johan Botha to Jean-Paul Duminy, Dot Ball
Johan Botha to Jean-Paul Duminy, Single
Johan Botha to AB de Villiers, Single

Over Up

Scorecard
Runs : 81
Wickets : 3
Overs : 9.0


Roelof van der Merwe to AB de Villiers, Single
Roelof van der Merwe to Jean-Paul Duminy, Dot Ball
Roelof van der Merwe to Jean-Paul Duminy, Single
Roelof van der Merwe to AB de Villiers, Two Runs
Roelof van der Merwe to AB de Villiers, Single
Roelof van der Merwe to Jean-Paul Duminy, Three Runs

Over Up

Scorecard
Runs : 89
Wickets : 3
Overs : 10.0


Johan Botha to Jean-Paul Duminy, Dot Ball
Johan Botha to Jean-Paul Duminy, FOUR
Johan Botha to Jean-Paul Duminy, Dot Ball
Johan Botha to Jean-Paul Duminy, Dot Ball
Johan Botha to Jean-Paul Duminy, Dot Ball
Johan Botha to Jean-Paul Duminy, FOUR

Over Up

Scorecard
Runs : 97
Wickets : 3
Overs : 11.0


Roelof van der Merwe to AB de Villiers, Two Runs
Roelof van der Merwe to AB de Villiers, Two Runs
Roelof van der Merwe to AB de Villiers, FOUR
Roelof van der Merwe to AB de Villiers, Single
Roelof van der Merwe to Jean-Paul Duminy, Two Runs
Roelof van der Merwe to Jean-Paul Duminy, Two Runs

Over Up

Scorecard
Runs : 110
Wickets : 3
Overs : 12.0


Johan Botha to AB de Villiers, FOUR
Johan Botha to AB de Villiers, Single
Johan Botha to Jean-Paul Duminy, Dot Ball
Johan Botha to Jean-Paul Duminy, Single
Johan Botha to AB de Villiers, Single
Johan Botha to Jean-Paul Duminy, Dot Ball

Over Up

Scorecard
Runs : 117
Wickets : 3
Overs : 13.0


Roelof van der Merwe to AB de Villiers, Dot Ball
Roelof van der Merwe to AB de Villiers, Single
Roelof van der Merwe to Jean-Paul Duminy, FOUR
Roelof van der Merwe to Jean-Paul Duminy, Two Runs
Roelof van der Merwe to Jean-Paul Duminy, FOUR
Roelof van der Merwe to Jean-Paul Duminy, Dot Ball

Over Up

Scorecard
Runs : 128
Wickets : 3
Overs : 14.0


Johan Botha to AB de Villiers, Single
Johan Botha to Jean-Paul Duminy, Single
Johan Botha to AB de Villiers, Dot Ball
Johan Botha to AB de Villiers, Dot Ball
Johan Botha to AB de Villiers, Single
Johan Botha to Jean-Paul Duminy, Dot Ball

Over Up

Scorecard
Runs : 131
Wickets : 3
Overs : 15.0


Roelof van der Merwe to AB de Villiers, Three Runs
Roelof van der Merwe to Jean-Paul Duminy, Three Runs
Roelof van der Merwe to AB de Villiers, Dot Ball
Roelof van der Merwe to AB de Villiers, Dot Ball
Roelof van der Merwe to AB de Villiers, FOUR
Roelof van der Merwe to AB de Villiers, FOUR

Over Up

Scorecard
Runs : 145
Wickets : 3
Overs : 16.0


Dale Steyn to Jean-Paul Duminy, Two Runs
Dale Steyn to Jean-Paul Duminy, SIX
Dale Steyn to Jean-Paul Duminy, Two Runs
Dale Steyn to Jean-Paul Duminy, Dot Ball
Dale Steyn to Jean-Paul Duminy, FOUR
Dale Steyn to Jean-Paul Duminy, SIX

Over Up

Scorecard
Runs : 165
Wickets : 3
Overs : 17.0


Wayne Parnell to AB de Villiers, OUT
Wayne Parnell to Albie Morkel, Dot Ball
Wayne Parnell to Albie Morkel, Dot Ball
Wayne Parnell to Albie Morkel, OUT
Wayne Parnell to Mark Boucher, Single
Wayne Parnell to Jean-Paul Duminy, Dot Ball

Over Up

Scorecard
Runs : 166
Wickets : 5
Overs : 18.0


Albie Morkel to Mark Boucher, Dot Ball
Albie Morkel to Mark Boucher, FOUR
Albie Morkel to Mark Boucher, Dot Ball
Albie Morkel to Mark Boucher, Dot Ball
Albie Morkel to Mark Boucher, Three Runs
Albie Morkel to Jean-Paul Duminy, Dot Ball

Over Up

Scorecard
Runs : 173
Wickets : 5
Overs : 19.0


Jacques Kallis to Mark Boucher, Three Runs
Jacques Kallis to Jean-Paul Duminy, Single
Jacques Kallis to Mark Boucher, OUT
Jacques Kallis to Roelof van der Merwe, Single
Jacques Kallis to Jean-Paul Duminy, Two Runs
Jacques Kallis to Jean-Paul Duminy, Single

Over Up

Scorecard
Runs : 181
Wickets : 6
Overs : 20.0



The final scorecard was :
Score: 181
Wickets : 6
Overs : 20.0

The second innings begins now


Dale Steyn to Graeme Smith, Single
Dale Steyn to Jacques Kallis, Single
Dale Steyn to Graeme Smith, Dot Ball
Dale Steyn to Graeme Smith, Two Runs
Dale Steyn to Graeme Smith, Two Runs
Dale Steyn to Graeme Smith, Dot Ball

Over Up



Scorecard
Runs : 6
Wickets : 0
Overs : 1.0


Wayne Parnell to Jacques Kallis, Dot Ball
Wayne Parnell to Jacques Kallis, Dot Ball
Wayne Parnell to Jacques Kallis, Single
Wayne Parnell to Graeme Smith, FOUR
Wayne Parnell to Graeme Smith, FOUR
Wayne Parnell to Graeme Smith, Single

Over Up



Scorecard
Runs : 16
Wickets : 0
Overs : 2.0


Dale Steyn to Graeme Smith, Two Runs
Dale Steyn to Graeme Smith, FOUR
Dale Steyn to Graeme Smith, Dot Ball
Dale Steyn to Graeme Smith, Dot Ball
Dale Steyn to Graeme Smith, Single
Dale Steyn to Jacques Kallis, Two Runs

Over Up



Scorecard
Runs : 25
Wickets : 0
Overs : 3.0


Wayne Parnell to Graeme Smith, Dot Ball
Wayne Parnell to Graeme Smith, Three Runs
Wayne Parnell to Jacques Kallis, Two Runs
Wayne Parnell to Jacques Kallis, Dot Ball
Wayne Parnell to Jacques Kallis, Two Runs
Wayne Parnell to Jacques Kallis, Two Runs

Over Up



Scorecard
Runs : 34
Wickets : 0
Overs : 4.0


Dale Steyn to Graeme Smith, Two Runs
Dale Steyn to Graeme Smith, OUT
Dale Steyn to Herschelle Gibbs, OUT
Dale Steyn to AB de Villiers, Three Runs
Dale Steyn to Jacques Kallis, FOUR
Dale Steyn to Jacques Kallis, Three Runs

Over Up



Scorecard
Runs : 46
Wickets : 2
Overs : 5.0


Wayne Parnell to Jacques Kallis, Dot Ball
Wayne Parnell to Jacques Kallis, Single
Wayne Parnell to AB de Villiers, SIX
Wayne Parnell to AB de Villiers, Dot Ball
Wayne Parnell to AB de Villiers, Dot Ball
Wayne Parnell to AB de Villiers, Single

Over Up



Scorecard
Runs : 54
Wickets : 2
Overs : 6.0


Albie Morkel to AB de Villiers, Dot Ball
Albie Morkel to AB de Villiers, Dot Ball
Albie Morkel to AB de Villiers, Two Runs
Albie Morkel to AB de Villiers, Two Runs
Albie Morkel to AB de Villiers, Dot Ball
Albie Morkel to AB de Villiers, FOUR

Over Up



Scorecard
Runs : 62
Wickets : 2
Overs : 7.0


Jacques Kallis to Jacques Kallis, FOUR
Jacques Kallis to Jacques Kallis, Dot Ball
Jacques Kallis to Jacques Kallis, Dot Ball
Jacques Kallis to Jacques Kallis, Two Runs
Jacques Kallis to Jacques Kallis, Three Runs
Jacques Kallis to AB de Villiers, Single

Over Up



Scorecard
Runs : 72
Wickets : 2
Overs : 8.0


Johan Botha to AB de Villiers, Dot Ball
Johan Botha to AB de Villiers, Single
Johan Botha to Jacques Kallis, Dot Ball
Johan Botha to Jacques Kallis, Two Runs
Johan Botha to Jacques Kallis, FOUR
Johan Botha to Jacques Kallis, Two Runs

Over Up



Scorecard
Runs : 81
Wickets : 2
Overs : 9.0


Roelof van der Merwe to AB de Villiers, Dot Ball
Roelof van der Merwe to AB de Villiers, Dot Ball
Roelof van der Merwe to AB de Villiers, FOUR
Roelof van der Merwe to AB de Villiers, Three Runs
Roelof van der Merwe to Jacques Kallis, Single
Roelof van der Merwe to AB de Villiers, Single

Over Up



Scorecard
Runs : 90
Wickets : 2
Overs : 10.0


Johan Botha to AB de Villiers, FOUR
Johan Botha to AB de Villiers, Dot Ball
Johan Botha to AB de Villiers, Single
Johan Botha to Jacques Kallis, FOUR
Johan Botha to Jacques Kallis, Single
Johan Botha to AB de Villiers, Single

Over Up



Scorecard
Runs : 101
Wickets : 2
Overs : 11.0


Roelof van der Merwe to AB de Villiers, Single
Roelof van der Merwe to Jacques Kallis, Two Runs
Roelof van der Merwe to Jacques Kallis, FOUR
Roelof van der Merwe to Jacques Kallis, Dot Ball
Roelof van der Merwe to Jacques Kallis, Single
Roelof van der Merwe to AB de Villiers, Dot Ball

Over Up



Scorecard
Runs : 109
Wickets : 2
Overs : 12.0


Johan Botha to Jacques Kallis, Dot Ball
Johan Botha to Jacques Kallis, Single
Johan Botha to AB de Villiers, Single
Johan Botha to Jacques Kallis, Dot Ball
Johan Botha to Jacques Kallis, Two Runs
Johan Botha to Jacques Kallis, Dot Ball

Over Up



Scorecard
Runs : 113
Wickets : 2
Overs : 13.0


Roelof van der Merwe to AB de Villiers, Three Runs
Roelof van der Merwe to Jacques Kallis, Dot Ball
Roelof van der Merwe to Jacques Kallis, Dot Ball
Roelof van der Merwe to Jacques Kallis, Dot Ball
Roelof van der Merwe to Jacques Kallis, Dot Ball
Roelof van der Merwe to Jacques Kallis, Single

Over Up



Scorecard
Runs : 117
Wickets : 2
Overs : 14.0


Johan Botha to Jacques Kallis, Dot Ball
Johan Botha to Jacques Kallis, Two Runs
Johan Botha to Jacques Kallis, Two Runs
Johan Botha to Jacques Kallis, Dot Ball
Johan Botha to Jacques Kallis, Dot Ball
Johan Botha to Jacques Kallis, Dot Ball

Over Up



Scorecard
Runs : 121
Wickets : 2
Overs : 15.0


Roelof van der Merwe to AB de Villiers, SIX
Roelof van der Merwe to AB de Villiers, Dot Ball
Roelof van der Merwe to AB de Villiers, Single
Roelof van der Merwe to Jacques Kallis, SIX
Roelof van der Merwe to Jacques Kallis, Two Runs
Roelof van der Merwe to Jacques Kallis, OUT

Over Up



Scorecard
Runs : 136
Wickets : 3
Overs : 16.0


Dale Steyn to AB de Villiers, Single
Dale Steyn to Jean-Paul Duminy, Dot Ball
Dale Steyn to Jean-Paul Duminy, FOUR
Dale Steyn to Jean-Paul Duminy, FOUR
Dale Steyn to Jean-Paul Duminy, Single
Dale Steyn to AB de Villiers, FOUR

Over Up



Scorecard
Runs : 150
Wickets : 3
Overs : 17.0


Wayne Parnell to Jean-Paul Duminy, Dot Ball
Wayne Parnell to Jean-Paul Duminy, SIX
Wayne Parnell to Jean-Paul Duminy, Dot Ball
Wayne Parnell to Jean-Paul Duminy, FOUR
Wayne Parnell to Jean-Paul Duminy, Dot Ball
Wayne Parnell to Jean-Paul Duminy, Dot Ball

Over Up



Scorecard
Runs : 160
Wickets : 3
Overs : 18.0


Albie Morkel to AB de Villiers, Dot Ball
Albie Morkel to AB de Villiers, Two Runs
Albie Morkel to AB de Villiers, OUT
Albie Morkel to Albie Morkel, Two Runs
Albie Morkel to Albie Morkel, Three Runs
Albie Morkel to Jean-Paul Duminy, Dot Ball

Over Up



Scorecard
Runs : 167
Wickets : 4
Overs : 19.0


Jacques Kallis to Albie Morkel, Two Runs
Jacques Kallis to Albie Morkel, Dot Ball
Jacques Kallis to Albie Morkel, Two Runs
Jacques Kallis to Albie Morkel, Single
Jacques Kallis to Jean-Paul Duminy, FOUR
Jacques Kallis to Jean-Paul Duminy, FOUR

Over Up



Scorecard
Runs : 180
Wickets : 4
Overs : 20.0



The final scorecard for second innings was :
Score: 180
Wickets : 4
Overs : 20.0


- The match was SA vs SA :p
 

blake

School Cricketer
Joined
Jul 15, 2007
Location
Brisbane, Australia
Online Cricket Games Owned
Hey Kshitiz - yours looks pretty accurate. I have pretty much given up on making mine in C++ until I get more experience - I still struggle to make the ball by ball sequence work correctly with all the variables, my algorithm is probably far too complex, and my switch() thing isn't working right.

Oh well. Maybe when I get better. :(
 

Kshitiz_Indian

Executive member
Joined
Apr 9, 2006
Location
New Delhi, India
How far are you in C++ mate? Your algorithm looks solid to me, although to put together a program on it requires knowledge of some more things, like pointers and etc. if you want to do it efficiently. :)
 

blake

School Cricketer
Joined
Jul 15, 2007
Location
Brisbane, Australia
Online Cricket Games Owned
I just learned about pointers very recently, but I'm still not exactly sure how to use them in my own game. I was having trouble and I was confused about how to calculate the runs and display commentary, etc. in C++, so I'm sort of giving up until I learn more. I tried an if else if ladder instead of using a switch() or anything (I don't fully understand switch yet) and that failed.. so I sorta gave up. So many variables in mine and I sorta feel they should be grouped a bit better.
 

dbest

School Cricketer
Joined
Apr 14, 2007
Online Cricket Games Owned
If you are not serious about programming, try working with C#, its much easier to work with and learn. At least that's my opinion.
 

blake

School Cricketer
Joined
Jul 15, 2007
Location
Brisbane, Australia
Online Cricket Games Owned
Well see Dbest - I'm still in high school now, and I'm actually very seriously considering taking up a future path in either programming or graphic design. Whilst I understand that Python and Basic and C# might be easier, I figured if I learned C++ first, I could simply learn other codes off the base of that, simply because C++ is pretty much the core language. Also, if I'm going to consider going into programming as a future, C++ would be the one to know.

Anyway, thanks for your feedback. I've currently found a great website for source code which has actually helped me no end - sometimes seeing a source code, then re-writing certain things can really really really help you compared to just reading a tutorial. I found a great source code of an RPG and I am trying to take it apart and comprehend it all, and watching how all the functions interlock with each other.

Anyway, I'm getting there. One day. :D
 

blake

School Cricketer
Joined
Jul 15, 2007
Location
Brisbane, Australia
Online Cricket Games Owned
I've started this back up again. Still a little bit confused about the switch() operation but I'm trying to get things going. I have learnt a lot more about functions which is helping, rather than me trying to make a million variables and hunking them all into int main.
 

blake

School Cricketer
Joined
Jul 15, 2007
Location
Brisbane, Australia
Online Cricket Games Owned
Well, after learning heaps I've finally managed to get into a runnable state. Currently, there is just two players - Ponting and Flintoff (the true Ashes). Unfortunately, this currently lacks:

  • team lists
  • exportable scorecards
  • exportable text files
  • players
  • editing teams
  • ball by ball summary
  • commentary
  • statistics
  • any other good stuff

But - wait for it - it does churn out a match. A very shaky match, but it works.

The problems with this match is:

  • no AI
  • no powerplay
  • batsman doesn't attack with wickets left
  • bowlers don't bowl defensively
  • or aggressively
  • no strategy
  • nothing good

But - it still works.

A few test runs:

Ponting vs Flintoff - First Twenty20

This is what the game displays:

Flintoff to Ponting, One run
Flintoff to Ponting, No runs
Flintoff to Ponting, Two runs
Flintoff to Ponting, One run
Flintoff to Ponting, One run
Flintoff to Ponting, No runs

Scorecard

Wickets: 0
Runs: 5
Overs: 1

Flintoff to Ponting, Chance!
Flintoff to Ponting, Four runs
Flintoff to Ponting, One run
Flintoff to Ponting, One run
Flintoff to Ponting, Three runs
Flintoff to Ponting, One run

Scorecard

Wickets: 0
Runs: 15
Overs: 2

Etc. etc.

Here are some final scores from the matches:

Twenty20 Scores:
4/142
4/168
3/164

The scores should be a little less higher - considering every batsman is Ponting and he has great stats. However, I thought I might be a little bit more harsh. Adjusted a few ratings and...

Twenty20 Scores (Updated Ratings):
1/129
7/152
1/176

As you can see, it made little to no impact at all, with exception to the 7/152 game.

The game relies on the batsman's stats in this - however, the rest is pure luck. This is what I need to change.

Next update will focus on more AI stuff.

Oh - by the way, thought I would test some 50 over matches. Don't be alarmed if the team loses 14 wickets or whatever, I haven't made any stop command when they lose more than 10 so it's highly likely they'll lose heaps.

Scoreboard:
9/432 (50 overs)

Alright, from this it's clearly evident that we have a problem. Ricky Ponting is just too damn good for Freddy Flintoff. The coding is great, it's just that Flintoff is a woeful player and not up to the class of Ricky.. OK, my programming sucks.

One last scoreboard to leave you with:
6/384 (50 overs)

Sensational. I'm delighted. I really am.
 

das_vicky

International Cricketer
Joined
Apr 1, 2004
Location
Orissa
Online Cricket Games Owned
Well see Dbest - I'm still in high school now, and I'm actually very seriously considering taking up a future path in either programming or graphic design. Whilst I understand that Python and Basic and C# might be easier, I figured if I learned C++ first, I could simply learn other codes off the base of that, simply because C++ is pretty much the core language. Also, if I'm going to consider going into programming as a future, C++ would be the one to know.

Anyway, thanks for your feedback. I've currently found a great website for source code which has actually helped me no end - sometimes seeing a source code, then re-writing certain things can really really really help you compared to just reading a tutorial. I found a great source code of an RPG and I am trying to take it apart and comprehend it all, and watching how all the functions interlock with each other.

Anyway, I'm getting there. One day. :D

I guess the only reason why you think C# is easier, is because in the IDEs you are helped by the Intellisense.

As you learn more, you would understand that the problem is not actually "coding" per se, but design of classes.
 

Hooper

ICC Board Member
Joined
Dec 5, 2006
Location
West Australia
Online Cricket Games Owned
  1. Don Bradman Cricket 14 - Steam PC
Haha, nice work blake. I'm more interested in your analysis of your own game then the game itself. Good work.
 

blake

School Cricketer
Joined
Jul 15, 2007
Location
Brisbane, Australia
Online Cricket Games Owned
Tried adding my first 'AI' as such variable - aggression. A player will be able to have the default value of aggression - but as their confidence goes up (omg, this sounds exciting amirite) their aggression will grow higher.

The highest will be a standard 100 for now - a player with 100 aggression will be a reckless bastard. A player with 1 aggression should play a careful methodical game.

Just as an example - I was aiming a player with full aggression would score 240 runs in a Twenty20 game if they batted nonstop, and a full defensive player would score 100 runs from Twenty20. I made some exceptions - in a Twenty20 they would be encouraged to lift their scoring to five an over.

I decided to make Ricky Ponting an aggressive bitch. I told him to go at that pussy Flintoff and slog him everywhere. Aka 100 aggression.

Here's the result.

Flintoff to Ponting, Four runs Shot Punter
Flintoff to Ponting, One run
Flintoff to Ponting, Two runs
Flintoff to Ponting, One run
Flintoff to Ponting, OUT R. Punting b Flintoff 8 (5)
Flintoff to Ponting, Two runs

Wickets: 1
Runs: 10
Overs: 1

Flintoff to Ponting, Six runs Take that you bitch
Flintoff to Ponting, Six runs Still more realistic than AC09
Flintoff to Ponting, Two runs
Flintoff to Ponting, No runs
Flintoff to Ponting, Six runs boomchakakakakalaka
Flintoff to Ponting, OUT R. Pointing b Flintoff 22 (7)

Short innings comes to an end - Pointing managed 22 runs from just 7 deliveries. Star knock.

Score: 2/30
Overs: 2

Flintoff to Ponting, Chance!
Flintoff to Ponting, Two runs
Flintoff to Ponting, One run
Flintoff to Ponting, Six runs Maybe I overdid it with the formula of six runs. Oh well, the 12 year old Indians on here will love it if this thing ever gets good)
Flintoff to Ponting, One run
Flintoff to Ponting, One run

2/41 (3 overs)

Flintoff to Ponting, Three runs
Flintoff to Ponting, OUT S. Ponting b Flintoff 15 (8)
Flintoff to Ponting, Four runs Because all players slog Flintoff for a four when first entering the crease
Flintoff to Ponting, Two runs
Flintoff to Ponting, Six runs 5 sixes from 4 overs. Entertaining to say the least. I would pay to see this if it was a real match.

o well I cbf doing all of it.

In the end, Australia made a smexy 178 a.o from 16 overs. Realistic I say. Of course, whilst everyone will be like omglol you made 178 from a slogger.. not all the batsmen will be as skilled as Ponting or all the bowlers as bad as Flintoff. So, once you get down the order obviously the batsmen will get worse. My algorithm is really complicated but it lets you modify how good each batsman is in different areas - outside off etc. I was going to do length, but then I realised that would be unfair on Phil Hughes so I just left it on area so Hughesy can dominate - when he gets introduced to the game.

Anyway, from 5 T20 I did with those settings, here were the results:

Game One: 11/260
Game Two: 12/239
Game Three: 14/192
Game Four: 14/264
Game Five: 13/230

Runs Scored: 1185
Wickets Lost: 64
Average: 18.51

Run Rate Required: 12.00
Run Rate Achieved: 11.85

blake added 2 Minutes and 17 Seconds later...

Oh, by the way, that was the fifth game which finished 13/230. I just counted it up and there were 10 sixes struck by Ponting from 20 overs. Would an extremely aggressive player do that normally? Your thoughts, please. :)
 

Storer11

Club Captain
Joined
Mar 5, 2006
Online Cricket Games Owned
Ponting is not good at Twenty20's, TBH. But good otherwise.
Possibly you can implement an option where if there is an LBW chance, a dropped catch, an edge, etc, you can say something like 'Chance - Edged for 4' or 'Chance - Dropped - 2 runs'.
 

Users who are viewing this thread

Top