在这一页
取消投注系统分析器的源代码
简介
以下程序是用 C++ 编写的。它非常简单,任何有一点 C++ 经验的人都应该能够理解它的工作原理。抱歉,文档不足,但只要遵循其逻辑,应该不难理解它是怎么回事。
// // 取消系统分析器 // 1998年10月19日 // #include <iostream.h> #include <stdlib.h> #include <string.h> #包括<math.h> #包括<时间.h> #包括 <stdio.h> 无效 tenbet(); int main() { 字符 ch; 做 { 滕贝特(); cerr << "再玩一次?"; cin >> ch; } while ((ch == 'y') || (ch == 'Y')); 返回 0; } 无效 tenbet() { int maxloss,num,bet[1000],lpt,rpt,i,j,curbet,bank,result[2],randwin,g; 长投注,旋转; cerr << "输入最大损失"; cin >> maxloss; cerr << "输入试验次数 "; cin >> num; cerr << "轮盘赌(1) 还是掷骰子(2)? "; cin >> g; 结果[0] = 0; 结果[1] = 0; 投注 = 0; 旋转=0; 如果(g == 1) { 兰德温 = 32767 * 18/38; } 别的 { 兰德温 = 32767 * 244 / 495; } 对于(i = 1;i <= num;i++) { 银行=0; lpt=1; rpt=10; 对于(j = 1;j <= 10;j++) { 赌注[j] = 1; } 做 { 如果(rpt == lpt) { curbet = 赌注[rpt]; } 别的 { curbet = 赌注[lpt] + 赌注[rpt]; } while ((maxloss+bank < curbet)&&(maxloss+bank > 0)) { 旋转++; 如果(最大损失 + 银行 >= 赌注[lpt]) { totbet += 赌注[lpt]; 如果(rand()<= randwin) { 银行 += 赌注[lpt]; lpt++; } 别的 { 银行-=赌注[lpt]; 赌注[lpt] *= 2; } } 别的 { totbet += (最大损失 + 银行); 如果(rand()<= randwin) { 赌注[lpt] -= (最大损失 + 银行); 银行 += (最大损失 + 银行); } 别的 { 银行 -= (最大损失 + 银行); } } 如果(rpt == lpt) { curbet = 赌注[rpt]; } 别的 { curbet = 赌注[lpt] + 赌注[rpt]; } } 如果(最大损失 + 银行 > 0) { totbet+=curbet; 旋转++; 如果(rand()<= randwin) { lpt++; rpt--; 银行+= curbet; } 别的 { rpt++; 赌注[rpt] = curbet; 银行 -= 路缘; } } } while ((lpt <= rpt) && (maxloss + bank > 0)); 如果(最大损失+银行==0) { 结果[1]++; } 别的 { 结果[0]++; } 如果(i%100000 == 0) { cerr << i << "\n"; } } cerr << "最大损失:" << maxloss << "\n"; cerr << "损失概率:" << (float)(result[1])/(float)(num) << "\n"; cerr << "平均旋转次数:" << (float)(spins)/(float)(num) << "\n"; cerr << "平均赌注:" << (float)(totbet)/(float)(num)<<"\n"; cerr << "胜利:" << result[0]<<"\n失败:"<<result[1]<<"\n"; cerr << "总投注:" << totbet<<"\n"; cerr << "总赢/输: " << (result[0]*10)-(result[1]*maxloss) << "\n"; cerr << "总旋转次数:" << 旋转 << "\n"; cerr << "净亏损:" << (float)((result[0]*10)-(result[1]*maxloss))/(float)totbet << "\n"; }