niteshborad / cricket Goto Github PK
View Code? Open in Web Editor NEWA cricket simulator on the command-line
A cricket simulator on the command-line
Introduction A cricket simulator on the command-line. Description In its current version, this is a program that simulates a 50-over cricket match between two teams (no players yet), whose names are provided by the user. The aim is to offer a realistic simulation. During a match, every over is played out and the score is kept for each team's innings. Additional features include statistics such as the projected score and the number of boundaries; a brief description of the condition of the pitch before the start of play; the ability to control the degree of attack or defense while batting: a more aggressive style increases the likelihood of scoring runs, but also the chance of losing wickets. Vice versa for a more defensive style. The simulator is written to conform to ISO/IEC 9899:1999 ("C99"). It only uses these facilities of the C99 Standard: * stdbool.h for the boolean type bool Limitations * No players * Ignores free-hit rules, powerplay rules, ball change rules Enhancements possible * Implementing players [In progress] This is by far the primary feature on the roadmap of enhancements. * Other minor improvements These are mentioned in the items marked `TODO' in the file todo.org External functionality A piece of code required case insensitive string comparisons. There is int strcasecmp(const char *s1, const char *s2); for systems conforming to POSIX.1-2001, but it is not in a Standard C library. The wish to stay within the bounds of the C99 standard motivated the search for a portable solution. For case insensitive string comparison, `lexcmp' from the Standard Function Library (c) 1991-2000 by iMatix Corporation has been modified and used as per the SFL License Agreement found here: <http://legacy.imatix.com/html/sfl/sfl4.htm#license> The original library is at <http://legacy.imatix.com/html/sfl/> Origin Many of the mechanics were adapted from the rules for a postal cricket game, /Cosmic Celebrity Cricket/, originally at <http://www.sholing.force9.co.uk/cosmic.htm> but which is now unavailable. However, it has been archived at the Web Archive at, for example, <https://web.archive.org/web/20030930100637/http://www.sholing.force9.co.uk/cosmic.htm> Changes have been made to the rules described in the above. The idea for permuting the list of {1, 2, 3, 4, 5, 6}, i.e., the faces of a die, and thereby determining the chance of a wicket was partly inspired by how a friend of the author handled a similar situation in his implementation of the dice game /Ship, Captain, Crew/. Credits Advice and commentary by Richard Heathfield on comp.lang.c has helped the author and this program greatly. In particular, the code for the team initialization was simplified by him. He recommended using better techniques to reduce the range of the RNG, and also using the Fisher-Yates shuffle for permuting the list of faces of a six-sided die.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.