1 / 10

数値解析  

数値解析  . 大富豪. 佐藤玲子 堀智恵実 高山明秀 西田直毅 春田常典. 大富豪. インターネットから大富豪のプログラ「 dohin 」 を入手し、土台とした。その後ゲームのプログラムの解析を行い、ゲーム上でコンピュータの出す手に変更を加えた。. Dohin. 大富豪のルール. 大富豪では、合計 5 2枚のトランプカードを使用する。

claude
Télécharger la présentation

数値解析  

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 数値解析   大富豪 佐藤玲子 堀智恵実 高山明秀 西田直毅 春田常典

  2. 大富豪 インターネットから大富豪のプログラ「dohin」 を入手し、土台とした。その後ゲームのプログラムの解析を行い、ゲーム上でコンピュータの出す手に変更を加えた。

  3. Dohin

  4. 大富豪のルール 大富豪では、合計52枚のトランプカードを使用する。 親の出したカードと同じ枚数で、自分よりひとつ前に出した人のカードよりも、大きい数のカードを出す。カードが出せない時はパスをする。メンバー全員が出せない時は、最後にカードを出した人が親になる。カードを出す、「場」に全部カードを出し切り、最初にあがると「大富豪」というランクが与えられる。さらに、2番目にあがったプレーヤーには「富豪」、3番目にあがったプレーヤーには「貧民」、そして最下位となった4番目のプレーヤーには「大貧民」というランクが与えられる。

  5. コンピュータのカードの出し方 改良前 If(PlayerNo==PPLY) {if(hands[PlayerNo][0]>=0) {wn=(int)hands[PlayerNo][0]/SUITS; wc=1;for(i=1;i<MAX_HAND;i++){ if(hands[PlayerNo][i]>=0) {n=(int)hands[PlayerNo][i]/SUITS; if(n==wn){wc++;}}} putCard(PlayerNo,wn,wc);} ☆コンピュータが親のとき 親の一枚目が0以上の時、一番 左を出す。二枚目、三枚目と、 一枚目と同じ数字が続くときは、 同時にそれも出す。 if(hands[PlayerNo][i]>=0) {n=(int)hands[PlayerNo][i]/SUITS; if(n>PNUM){ if(n==wn){wc++;} else{wn=n;wc=1;} if(wc==PCNT) {putCard(PlayerNo,wn,wc); changeturn();return;}}}} messages[PlayerNo]= "Pass";}changeturn();} ☆コンピュータが親ではないとき 場の数字よりも大きく、場の枚数と同じ枚数のカードが出せるとき出す。 場の数字よりも小さい数しかない ときや、場の数字よりも大きいカー が場の枚数に足りないときは、パス する。

  6. 場のカード 改良前 6 6 コンピュータの手持ちのカード 7 7 7 10 J

  7. 改良後 6 6 場 コンピュータ 場の枚数と同じ枚数 あるカードがない! 7 7 7 10 Q J

  8. 改良後 6 6 場 コンピュータ 8 8 7 7 7

  9. 変更のためのアルゴリズム public void computers(int PlayerNo){int i,c,n,wn=(-1),wc=1,cn=(-1);if(PlayerNo==PPLY){ if(hands[PlayerNo][0]>=0){wn=(int)hands[PlayerNo][0]/SUITS;wc=1;for(i=1;i<MAX_HAND;i++){if(hands[PlayerNo][i]>=0){ n=(int)hands[PlayerNo][i]/SUITS;if(n==wn){wc++;}}}putCard(PlayerNo,wn,wc);}}else{for(i=0;i<MAX_HAND;i++){ if(hands[PlayerNo][i]>=0)n=(int)hands[PlayerNo][i]/SUITS; if(n>PNUM){if(n==wn){wc++; }else{wn=n; wc=1;}if(wc==PCNT && (int)hands[PlayerNo][i+1]/SUITS!=n){putCard(PlayerNo,wn,wc); changeturn();return;} if(wc==PCNT && (int)hands[PlayerNo][i+1]/SUITS==n){ cn=1; wc=1; } }}} if(cn==1){for(i=0;i<MAX_HAND;i++){if(hands[PlayerNo][i]>=){n=(int)hands[PlayerNo][i]/SUITS;if(n>PNUM){if(n==wn){ wc++;}else{ wn=n;wc=1; }if(wc==PCNT){putCard(PlayerNo,wn,wc);changeturn();return;}}}}}messages[PlayerNo]="Pass"; }changeturn();}

  10. fin

More Related