<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                合規國際互聯網加速 OSASE為企業客戶提供高速穩定SD-WAN國際加速解決方案。 廣告
                **《357游戲的“必勝算法"》 Linux C++ 語言實現** 下面在 Linux C++ 編譯通過180901 能Run能運行…… (待優化……) ----Author: TerryDeng(1809) **博弈論雖然可以歸為數學……; 原則上歸為科學就更恰當……。 我們用通俗的語言去描述博弈…… 一、所有的 **零和博弈 **原則上 只有 一條 道路 通向 成功(的王冠); (如果假設參與 博弈的人 都是 絕頂理性、絕頂并無限智慧的智者…… 的話)那么 只有 一條 唯一 理性(并且正確的道路)通向 成功! 二、通向成功的道路也許在 先下手的 所謂“先手”手中,也有可能是 在 “后手”手中…… 三、如果 持有 先機的 人(或曰 持有 權柄的人)…… 一直 按照 必勝 算法 的策略去行事…… ;(另外的一方)不具備 權柄的 人 ,是沒有機會 獲得 贏的 “權柄”(或贏的機會的)…… 他(無權柄者們)只能 想辦法 拖延失敗、以 等待 當權者 失誤, 以便 有機會 抓到 “權柄”。** ~~~ #include<iostream> #include<stdlib.h> using namespace std; //int a , b , c, a1 , b2 , l; // int indexabc(int &a,int &b, int &c) { int tmpnum; if(b<a) { tmpnum=a; a=b; b=tmpnum; } //1、此處是交換 a,b ,下同... if(b>c) {tmpnum=b;b=c;c=tmpnum;} //2、比a 大的 b... if(b<a) {tmpnum=a;a=b;b=tmpnum;} //3、原來的c,現在在b,也許比a小,還得換...想想:為啥 兩次(第2次) 比較 a 和b? ( 1、2只保證 最大的數 放c , 3、保證 最小的數 比如原來的 c ==1\2\3 等 放 a! // if(a<b && b<c) {get357bb(a,b,c); } // else cout<<"program Wrong12!"; } int get111bak01a(int a=1,int b=1,int c=1) { // if(1==a,1==b,1==c) { a=1-1; int b=1;int c=1; cout << a<<b<<c<<" do you know?...Computer will Lost!"; } indexabc(a,b,c); if(1==a,1==b,1==c) { a=1; int b=1;int c=1; cout<<a<<b<<c<<"Victory algorithm:[111 type]...you know? U will win...!\r\n/r/n"; return 1;} return 0; } int get123a(int a=1,int b=3,int c=2) { indexabc(a,b,c); if(1==a,2==b,3==c) { cout<<a<<b<<c<<"Victory algorithm:[123type]...you know? U will win...!"; return 1; } return 0; } int get145a(int a=1,int b=4,int c=5) { indexabc(a,b,c); // 強行排序 int tmpn=0; if(a>b) {tmpn=a;a=b;b=tmpn;} if(b>c){tmpn=b;b=c;c=tmpn;} if(a>b){tmpn=a;a=b;b=tmpn;} if(1==a,4==b,5==c) { cout<<a<<b<<c<<"Victory algorithm:[type145]...you know or not? U will win...!"; return 1; } if(1==a,5==b,4==c) { cout<<a<<b<<c<<"Victory algorithm:[type154]...you know or not? U will win...!"; return 1; } return 0; } int get111a(int a=1,int b=1,int c=1) { indexabc(a,b,c); if(1==a,1==b,1==c) { cout<<a<<b<<c<<"Victory algorithm:[111type]...you know? U will win...!"; return 1; } return 0; } // int ans(int a,int b,int c) { cout<<"\r\nAnwser is:"; cout<<a<<b<<c<<endl; } int get357bb(int a=3,int b=5,int c=7) { // indexabc(a,b,c); //此排序函數(由于局部變量問題,)排序無效 // 強行排序 int tmpn=0; if(a>b) {tmpn=a;a=b;b=tmpn;} if(b>c){tmpn=b;b=c;c=tmpn;} if(a>b){tmpn=a;a=b;b=tmpn;} int i,j,ic; //三級檢測 if(3==a&&5==b&&6==c) { a=a-1; ans(a,b,c); goto lableEnd9990;} //356 回256 //被迫回156者應該是 實屬無奈,應回154/145 // 因 被持有(拿到)123 必死 ,拿到145也必死 if(3==a&&4==b&&6==c) { a=a-1; ans(a,b,c); cout<<"I can send you to death with 246!"<<endl; goto lableEnd9990;} //256 回246I can send you to death with 246! // if(2==a&&5==b&&6==c) { b=b-1; ans(a,b,c); cout<<"I can send you to death with 246!"<<endl; goto lableEnd9990;} //256 回246I can send you to death with 246! //被迫回156者應該是 實屬無奈,應回154/145 // 因 被持有(拿到)123 必死 ,拿到145也必死 if(1==a&&5==b&&6==c) { c=4; ans(a,b,c); goto lableEnd9990;} //被迫回156者應該是 實屬無奈,應回154/145 // 因 被持有(拿到)123 必死 ,拿到145也必死 if(1==a&&4==b&&6==c) { c=5; ans(a,b,c); goto lableEnd9990;} //被迫回146者也屬無奈,回145 // 因 被持有(拿到)123 必死 ,拿到145也必死 if(1==a&&3==b&&4==c) { c=2; ans(a,b,c); goto lableEnd9990;} //被迫回134者也屬無奈! 應回123 // 因 被持有(拿到)123 必死 ,拿到145也必死 if(1==a&&3==b&&5==c) { c=2; ans(a,b,c); goto lableEnd9990;} //被迫回135者也屬無奈! 應回132\即123 // 因 被持有(拿到)123 必死 ,拿到145也必死 if(1==a&&4==b&&5==c) { b=3; ans(a,b,c); goto lableEnd9990;} //拿到 145,不好處理(其實基本已輸), 回144肯定100%蠢(會100%輸),所以只好回 143(/134---- 其實(即便被迫)回了134\143,對方回應對,還是會輸……此處為無奈之選(以圖蒙混過關而已,對手按必勝算法形式則必勝…… if(2==a&&4==b&&7==c) { c=6; ans(a,b,c); cout<<"I can send you to death with 246!"<<endl; goto lableEnd9990;} //得到245,只能回 246(必勝算法?) //246的應對: if(2==a&&4==b&&6==c) { if(0==rand()%4 ) c=3; //回243\234 else if( 1==( rand()%4 ) ) {a=1;} //回146 屬(中等)無奈,希望對手不懂回145(145有力\必勝) else c=5;//回245的情況要好些,因為 不是高手有時不懂 回必勝(有力)的 145 ans(a,b,c); goto lableEnd9990; } //得到246是死局面(敗泥潭)!,可以無奈的回 245(等死一),也可以 回243 等死二;所以選擇隨機數,等死的狀態隨機!(為游戲者增加一點難道 或 增一點趣味……) if(2==a&&4==b&&5==c) { a=1; ans(a,b,c); goto lableEnd9990;} //得到245, 只能回145(必勝算法) if(2==a&&3==b&&7==c) { c=1; ans(a,b,c); goto lableEnd9990;} //得到236, 只能回231/即123(必勝算法) if(2==a&&3==b&&6==c) { c=1; ans(a,b,c); goto lableEnd9990;} //得到236, 只能回231/即123(必勝算法) if(2==a&&3==b&&5==c) { c=1; ans(a,b,c); goto lableEnd9990;} //得到235, 只能回231/即123(必勝算法) if(2==a&&3==b&&4==c) { c=1; ans(a,b,c); goto lableEnd9990;} //得到234, 只能回231/即123(必勝算法) // if(2==a&&3==b&&3==c) { c=1; ans(a,b,c); goto lableEnd9990;} //得到233, 可以回 033 或回231/即123(必勝算法) //一級檢測; 0==a if(0==a) { if (1<b &&b==c) { ans(0, b-1, c); cout<<"你(無奈)給出非必勝答案,U stupid?,Computer will win!"<<endl; goto lableEnd9990; } else if(b<c) {ans(0,b,b); goto lableEnd9990;} else {ans(0,c,c); goto lableEnd9990; }// c<b and 0==a } //檢測 xxY型號 并 0nn 型號 //檢測當 0!=a 時候 “將來 會形成的0nn”型號 if( 1<a && a==b ) {cout<<"Type_`xxY` Victory algorithm!型號必勝"<<endl; c=0; cout<<a<<b<<c<<endl; ans(0,a,b); goto lableEnd9990; } //if(1==get0nn1(a-i,b,c) ) goto lableEnd9990; if( 1<b &&b==c ) {cout<<"Type0xx_`0nn`Victory algorithm!型號必勝"<<endl; a=0; cout<<a<<b<<c<<endl; ans(0,b,c); goto lableEnd9990; } //if(1==get0nn1(a-i,b,c) ) goto lableEnd9990; //二級檢測、檢測 2xy型 5==x 時 if(2==a) { //if2a if(5==b) { //if5b // for(i=0;i<=5;++i) { if(5==b&&7==c) { a=a-1;c=c; cout<<a<<b<<c;} else if(6==c) {a=a; b=b-1; cout<<a<<b<<c; cout<<"I can send you to death with 246!"<<endl;} else { for(j=7;j<0;--i) { a=2;b=5;c=c-j; cout<<a<<b<<c<<"win25x?"<<endl; } } // } }//if5b goto lableEnd9990; }//if2a //檢測 0nn 型號 2、3、4、5==n 時 //失效?? // for(i=1;i<=c;++i) { if(1==get0nn1(a,b,c-i) ) {ans(a,b,c-i) ;goto lableEnd9990;} } // for(i=1;i<=b;++i) { if(1==get0nn1(a,b-i,c) ) {ans(a,b-i,c) ; goto lableEnd9990;} } //四級檢測 //檢測 011型 //失效! // for(i=1;i<=c;++i) { if(1==get011a(a,b,c-i) ) {ans(a,b,c-i) ;goto lableEnd9990;} } // for(i=1;i<=b;++i) { if(1==get011a(a,b-i,c) ) {ans(a,b-i,c) ;goto lableEnd9990; } } // for(i=1;i<=a;++i) { if(1==get011a(a-i,b,c) ) {ans(a-i,b,c) ;goto lableEnd9990; } } //檢測 111型 有效 for(i=1;i<=c;++i) { if(1==get111a(a,b,c-i) ) {ans(a,b,c-i) ;goto lableEnd9990;} } for(i=1;i<=b;++i) { if(1==get111a(a,b-i,c) ) {ans(a,b-i,c) ;goto lableEnd9990;} } for(i=1;i<=a;++i) { if(1==get111a(a-i,b,c) ) {ans(a-i,b,c) ;goto lableEnd9990;} } //檢測123型 for(i=1;i<=c;++i) { if(1==get123a(a,b,c-i) ) {ans(a,b,c-i) ;goto lableEnd9990; } } for(i=1;i<=b;++i) { if(1==get123a(a,b-i,c) ) {ans(a,b,c-i) ;goto lableEnd9990;} } for(i=1;i<=a;++i) { if(1==get123a(a-i,b,c) ) {ans(a,b,c-i) ;goto lableEnd9990;} } //檢測145型 for(i=1;i<=c;++i) { if(1==get145a(a,b,c-i) ) {ans(a,b,c-i) ;goto lableEnd9990; } } for(i=1;i<=b;++i) { if(1==get145a(a,b-i,c) ) {ans(a,b,c-i) ;goto lableEnd9990;} } for(i=1;i<=a;++i) { if(1==get145a(a-i,b,c) ) {ans(a,b,c-i) ;goto lableEnd9990;} } // cout<<"Type145:"; // cout<<a<<b<<c<<endl; // //goto lableEnd9990; //檢測167型(可省略) // for(i=1;i<=7;++i) { if(1==get167a(a,b,c) ) goto lableEnd9990; } // for(i=1;i<=5;++i) { if(1==get167a(a,b,c) ) goto lableEnd9990;} // for(i=1;i<=3;++i) { if(1==get167a(a,b,c) ) goto lableEnd9990;} lableUnknow990: cout<<"no anwser990"<<endl; lableEnd9990: // cout<<"End9990"<<endl; cout<<"!!"<<endl; return 0; } int get357a(int a=3,int b=5,int c=7) { indexabc(a,b,c); //此處排序,不生效,有待改進…… if(3==a&&5==b&&7==c) { cout <<"start?:"; a=a-1; cout<<a<<b<<c <<endl; } //2==a : 257 else get357bb(a,b,c); } int main() { cout << "Game 357: Please input the Number,for exam: 2 5 7 OR 3 5 6 with EnterKey...Input 000 Exit!"<< endl; //請輸入三個正整數...GCD:請輸入兩個正整數,計算它們的最大公約數:" << endl ; int a , b , c, ans; int firstbackhand=0; int inputn=0; // cin >> a >> b >> c; do { // for (int ii0=0;ii0<15;++ii0) {//forii0 ++firstbackhand; if(1== (firstbackhand%2) ) { cout<<"First:"<<firstbackhand<<"Human?"<<endl; /*firstbackhand=0;*/} //此處先后手可為乒乓鍵 else { cout<<"Backhand"<<firstbackhand<<"Computer?"<<endl; /*firstbackhand=1;*/} cin>>inputn; if ( inputn<001 ) { cout<<"the Number is too small! 輸入太小了!"<<endl; return 0;} if ( inputn>010 ) { c=inputn%10; b=(inputn/10)%10; a=inputn/100;} else {a=0;b=0;c=1;} // for(int i=15;i>=1;++i) { if ( 1==a && 0==b && 0==c) {goto lable110computerlost1;} if ( 0==a && 1==b && 0==c) {goto lable110computerlost1;} if ( 0==a && 0==b && 1==c) {goto lable110computerlost1;} // } get357a(a,b,c); //循環判斷 對策, 找到所謂“必勝對策” //}//forii0 } while (inputn>000); goto labelEnd; lable110computerlost1: cout << "You(inputer) win! computer be bombed!Computer lost and die!" <<endl; labelEnd: return 0; } //口訣: 一0雙 、二111、三123、四145、五246 (所以先手有必勝算法(簡稱先手必勝)! 可選257、356 或347 //后手必可以被gived雷炸(簡稱原則必敗)...比如遇到257 回256(會死于246的…“暗”雷區); 比如遇356 回156(其實會死于145之雷) ; 347 回346(會死于246)……等,后手者(或不具備先機者、不當權者) 會被智慧的(永不犯錯才可被稱智慧的)先手 推入(敗輸的)泥潭... //1、零和博弈必有必勝策略(或稱必勝算法); //2、必勝策略在于 先手者 或先機者(的手中)…… //3、游戲的核心 為 搶得先機(然后按必勝策略行事......這在圍棋里面稱為“棄子爭先、舍地取勢等”)... 而搶得先機的核心 就是 規避 雷區(規避明雷: 0xx, 111 123還要規避 暗雷:246 145等) 都屬(總結出的)雷區,又叫“(不力)的定式”……圍棋當中的“定式”就是這個道理…… //獲得“定式”……加以練習會成智者(或高手) ~~~ 下面是(357游戲 必勝算法 的 c++程序) 運行結果 截圖: ![](https://box.kancloud.cn/46921d801ced96ba564cefb718345c71_942x914.png) 246雷區 246的下一個雷區是: 1、257 2、356 3、347 所以: 357 游戲的 要領就是 357先手有先機, 上來就把后手 推入 雷區 359游戲呢?……一樣 推入 356 397游戲呢?……推入347 957游戲呢?……推入257 399游戲 傻啊? 099 389游戲? 387 ->347 輸 386 ->356輸 379游戲 == 397 搞過了 3-7-11 游戲: 3-7-11 3-7-10 374輸 5-7-11游戲: 5-7-10 257 輸 所以 5-7-11 等 游戲 (開局后)馬上 會 塌縮: 塌縮 為 (類似)357游戲 這種……
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看