Windows Mobile 5Windows Mobile 6Windows MobileVisual Studio 2008.NET 3.5C# 2.0初学者C# 3.0开发Visual Studio.NETC#
Windows Mobile 版 Duckworth Lewis 计算器
一个适用于Windows Mobile和.NET 3.5的 Duckworth Lewis 计算器。
引言
这是一个对 Duckworth Lewis 方法计算受降雨影响的板球分数的解释。
背景
此代码中的公式归功于 Active State 网站上的 David Holland:http://code.activestate.com/recipes/334728/。 我已将其解释为 C# 并在 Windows Mobile 中使用。
由于某种原因,ICC 不会发布确切的公式; 相反,他们发布一组不准确的查找表,这些表与一级板球赛中实际的 DL 目标不符。 因此,此处的公式需要进行一些调整,因为会进行更新。 但这是一个开始,并且遵循 DL 方法的原则。
使用代码
//Array of constants
double[,] dlewisdict1 = { { 293.8, 241.93, 217.21, 173.32, 142.84, 102.94, 81.705,
51.471, 26.708, 17.995 }, { 0.033468, 0.043685, 0.044921,
0.059491, 0.071912, 0.10011, 0.12843,
0.21507, 0.41548, 0.26668 } };
//Get the number of Wickets lost
int wicksremain = 10 - (int)InnsWicks2nd.Value;
int wicksremain2 = 10 - (int)InnsWicks1st.Value;
double w = dlewisdict1[1, wicksremain] * (double)innOvers2nd.Value;
double v = dlewisdict1[1, wicksremain] * (double)innOvers1st.Value;
double d1 = 1-System.Math.Exp(-v);
d1 = d1 * dlewisdict1[0, 0];
double d = 1-System.Math.Exp(-w);
d = d * dlewisdict1[0, wicksremain];
double x = ((d1 / 235) * 100);
double y = ((d / 235) * 100);
d = ((double)innScore1st.Value / x) * y;
d = Math.Round(d);
textBox1.Text = d.ToString();