ハルhal
デジタル コンテンツ

pc2

作って学ぶ
ハードとソフト

アルゴリズム
電子回路

 






このサイトはHPです
ブログではありません
要望・意見は
下記の掲示場を利用して
下さいまたブログも見て下さい

 

ロボット・DOSV掲示板兼Blog

懐かしのコンピュータ
Apple II Apple2
PC9801 PC9821

roboto

Topに戻る

ララ Lara
アナログ コンテンツ

Lara座れ
動画で学ぶ
躾と訓練
動画メニュー


工作


集団練習メニュー


しつけ 訓練コラム




最後にララについて

このサイトはHPです
ブログではありません
要望・意見は
下記の掲示場を利用して
下さいまたブログも見て下さい

Laraララの
ブログ

犬のしつけと訓練
掲示板


掲示板の利用規則

 

 

 

 

Lara伏せ
Topに戻る
松本 ワンワンクラブ
わんわんクラブ

 

Visual Studio 2008 Express Edition でトランプゲームを作ろう
8日目 VBAのリストをC++に変換してみよう

フォームを次のようにする
form9

button3クリックして

basicの内容【緑】を次のように変更する【赤】

basic c++

Private Sub CommandButton3_Click()


x = 6
If CheckBox1 = False Then
card(1) = card(x)
x = x + 1
End If
If CheckBox2 = False Then
card(2) = card(x)
x = x + 1
End If
If CheckBox3 = False Then
card(3) = card(x)
x = x + 1
End If
If CheckBox4 = False Then
card(4) = card(x)
x = x + 1
End If
If CheckBox5 = False Then
card(5) = card(x)
x = x + 1
End If

Call disp

Rem yaku no kaiseki
Rem flash no kaiseki
TextBox1 = "役なし"
clab = 0
daiya = 0
hart = 0
supedo = 0
flash = 0
For x = 1 To 5
If card(x) > 0 And card(x) <= 13 Then clab = clab + 1
If card(x) > 100 And card(x) <= 113 Then daiya = daiya + 1
If card(x) > 200 And card(x) <= 213 Then hart = hart + 1
If card(x) > 300 And card(x) <= 313 Then supedo = supedo + 1
Next x
If clab = 5 Then
TextBox1 = "クラブのフラッシュ"
flash = 1
tokuten = tokuten + 509
End If

 

 

If daiya = 5 Then
TextBox1 = "ダイヤのフラッシュ"
flash = 1
tokuten = tokuten + 509
End If

If hart = 5 Then
TextBox1 = "ハートのフラッシュ"
flash = 1
tokuten = tokuten + 509
End If

If supedo = 5 Then
TextBox1 = "スペードのフラッシュ"
flash = 1
tokuten = tokuten + 509
End If

Rem ペアーの解析
For x = 6 To 10
keta(x) = 0
Next x
For x = 1 To 5
y = card(x)
Cells(x, 3) = y
If card(x) > 100 Then y = card(x) - 100
If card(x) > 200 Then y = card(x) - 200
If card(x) > 300 Then y = card(x) - 300
Cells(x, 4) = y
keta(x) = y
Next x
For x = 1 To 5
yaku(x) = 0
For w = 1 To 5
If keta(x) = keta(w) Then yaku(x) = yaku(x) + 1
Next w
Cells(x, 5) = yaku(x)
Next x
twopai = 0
threepai = 0
For x = 1 To 5
If yaku(x) = 2 Then twopai = twopai + 1
If yaku(x) = 3 Then threepai = 1
If yaku(x) = 4 Then
TextBox1 = "フォーカード"
flash = 1
tokuten = tokuten + 4165
End If

Next x
If twopai = 2 Then
TextBox1 = "ワンペアー"

tokuten = tokuten + 3
End If

If twopai = 4 Then
TextBox1 = "ツーペアー"
tokuten = tokuten + 21
End If

If threepai = 1 Then
TextBox1 = "スリーカード"
tokuten = tokuten + 47
End If

If threepai = 1 And twopai = 2 Then
TextBox1 = "フルハウス"
tokuten = tokuten + 694
End If

Rem ストレートの解析
For x = 1 To 5
For y = 1 To 5
If keta(x) < keta(y) Then
oitoku = keta(x)
keta(x) = keta(y)
keta(y) = oitoku
End If
Next y
Next x

For x = 1 To 5
Cells(x, 6) = keta(x)
Next x

If keta(1) = 1 And keta(5) = 13 Then
For x = 1 To 5
If keta(x) = x Then
keta(x + 5) = keta(x) + 13
Cells(x + 5, 7) = keta(x) + 13
End If
Next x
End If
flag = 0
For x = 1 To 9
If keta(x) = keta(x + 1) - 1 Then flag = flag + 1Next x

If flag >= 4 Then
TextBox1 = "ストレート"
tokuten = tokuten + 255
If flash = 1 Then
TextBox1 = "ストレートフラッシュ"
tokuten = tokuten + 72193 - 255
End If
End If
If flag >= 4 And keta(1) = 1 And keta(5) = 5 And flash = 1 Then
TextBox1 = "ロイヤルストレートフラッシュ"
tokuten = tokuten + 649740 - 72193
End If
TextBox2 = tokuten

End Sub

 

private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
if(start_flag==2){
int x,y,w,oitoku;
int flash=0;
int flag=0;
char buf[80];
x = 6;
if( checkBox1->Checked ){}else{
card[1] = card[x];
x = x + 1;
}
if( checkBox2->Checked ){}else{
card[2] = card[x];
x = x + 1;
}
if( checkBox3->Checked ){}else{
card[3] = card[x];
x = x + 1;
}
if( checkBox4->Checked ){}else{
card[4] = card[x];
x = x + 1;
}
if( checkBox5->Checked ){}else{
card[5] = card[x];
x = x + 1;
}
for(x=1;x<6;x++) DispHai(card[x],x);

 

// yaku no kaiseki
// flash no kaiseki
String^ string1;
string1 = "役なし";
textBox1->Text=string1;
int clab = 0;
int daiya = 0;
int hart = 0;
int supedo = 0;
flash = 0;
for( x = 1 ; x<= 5; x++){
if( card[x] > 0 && card[x] <= 13 ) clab = clab + 1;
if( card[x] > 100 && card[x] <= 113 ) daiya = daiya + 1;
if( card[x] > 200 && card[x] <= 213 ) hart = hart + 1;
if( card[x] > 300 && card[x] <= 313 ) supedo = supedo + 1;
}//Next x
if( clab == 5 ){
string1 = "クラブのフラッシュ";
textBox1->Text=string1;
flash = 1;
tokuten = tokuten + 509;
}//End if

if( daiya == 5 ){
string1 = "ダイヤのフラッシュ";
textBox1->Text=string1;
flash = 1;
tokuten = tokuten + 509;
}//End if

if( hart == 5 ){
string1 = "ハートのフラッシュ";
textBox1->Text=string1;
flash = 1;
tokuten = tokuten + 509;
}//End if
if( supedo == 5 ){
string1 = "スペードのフラッシュ";
textBox1->Text=string1;
flash = 1;
tokuten = tokuten + 509;
}//End if

//Rem ペアーの解析
for( x = 6 ; x<= 10;x++){
keta[x] = 0;
} //Next x
for( x = 1 ; x<= 5;x++){
y = card[x];
//Cells(x, 3) = y
if( card[x] > 100 ) y = card[x] - 100;
if( card[x] > 200 ) y = card[x] - 200;
if( card[x] > 300 ) y = card[x] - 300;
//Cells(x, 4) = y
keta[x] = y;
} //Next x
for( x = 1 ; x<= 5;x++){
yaku[x] = 0;
for( w = 1 ; w<= 5;w++){
if( keta[x] = keta[w] ) yaku[x] = yaku[x] + 1;
} //Next w
//Cells(x, 5) = yaku[x)
} //Next x
int twopai = 0;
int threepai = 0;
for( x = 1 ; x<= 5;x++){
if( yaku[x] == 2 ) twopai = twopai + 1;
if( yaku[x] == 3 ) threepai = 1;
if( yaku[x] == 4 ){
string1 = "フォーカード";
textBox1->Text=string1;
flash = 1;
tokuten = tokuten + 4165;
}
} //Next x
if( twopai == 2 ){
string1 = "ワンペアー";
textBox1->Text=string1;
tokuten = tokuten + 3;
} //End if

if( twopai == 4 ){
string1 = "ツーペアー";
textBox1->Text=string1;
tokuten =tokuten + 21;
} //End if

if( threepai == 1 ){
string1 = "スリーカード";
textBox1->Text=string1;
tokuten =tokuten + 47;
} //End if
if( threepai == 1 && twopai == 2 ){
string1 = "フルハウス";
textBox1->Text=string1;
tokuten =tokuten + 694;
} //End if
//Rem ストレートの解析
for( x = 1 ; x<= 5;x++){
for( y = 1 ; y<= 5;y++){
if( keta[x] < keta[y] ){
oitoku = keta[x];
keta[x] = keta[y];
keta[y] = oitoku;
} //End if
} //Next y
} //Next x

//for( x = 1 ; <= 5;x++){
//Cells(x, 6) = keta[x)
//}//Next x

if( keta[1] == 1 && keta[5] == 13 ){
for( x = 1 ; x<= 5;x++){
if( keta[x] == x ){
keta[x + 5] = keta[x] + 13;
//Cells(x + 5, 7) = keta[x) + 13
} //End If
} //Next x
} //End If
flag = 0;
for( x = 1 ; x<= 9;x++){
if( keta[x] == keta[x + 1] - 1 ){ flag = flag + 1;}
} //Next x

if( flag >= 4 ){
string1 = "ストレート";
textBox1->Text=string1;

tokuten = tokuten + 255;
if( flash = 1 ){
string1 = "ストレートフラッシュ";
textBox1->Text=string1;
tokuten = tokuten + 72193 - 255;
} //End if
} //End if
if( flag >= 4 && keta[1] == 1 && keta[5] == 13 && flash == 1 ){
string1 ="ロイヤルストレートフラッシュ";
textBox1->Text=string1;

tokuten = tokuten + 649740 - 72193;
}
sprintf_s(buf,80," %10d ",tokuten);
string1=gcnew String(buf);
textBox2->Text=string1;
start_flag=0;
}// End if

}

};
}

参考


void DispHai( int nohai,int xx){

Graphics^ gr=this->CreateGraphics();
int X0=10,Y0=1;
String^ filename;
filename="c:\\card\\1_sp.gif";
if(nohai==0 ) filename="c:\\card\\0_r1.gif" ;
//Pen^ pen1=gcnew Pen(col);
if(nohai>0 && nohai<14) filename="c:\\card\\"+nohai+"_sp.gif" ;
if(nohai>100 && nohai<114 ){nohai=nohai-100;
filename="c:\\card\\"+nohai+"_cl.gif" ;}
if(nohai>200 && nohai<214 ){nohai=nohai-200;
filename="c:\\card\\"+nohai+"_di.gif" ;}

if(nohai>300 && nohai<314){nohai=nohai-300;
filename="c:\\card\\"+nohai+"_he.gif" ;}
//原画像を左上に描画する
if(xx==1){
Bitmap^ bmap1; //bmap1の確保
bmap1=gcnew Bitmap(filename);
gr->DrawImage(bmap1,X0,Y0);
}
if(xx==2){
Bitmap^ bmap2; //bmap2の確保
bmap2=gcnew Bitmap(filename);
gr->DrawImage(bmap2,X0+100,Y0);
}
if(xx==3){
Bitmap^ bmap3; //bmap3の確保
bmap3=gcnew Bitmap(filename);
gr->DrawImage(bmap3,X0+200,Y0);
}
if(xx==4){
Bitmap^ bmap4; //bmap4の確保
bmap4=gcnew Bitmap(filename);
gr->DrawImage(bmap4,X0+300,Y0);
}
if(xx==5){
Bitmap^ bmap5; //bmap5の確保
bmap5=gcnew Bitmap(filename);
gr->DrawImage(bmap5,X0+400,Y0);
}
}


private: System::Void Form1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
Graphics^ gr=e->Graphics;
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if(start_flag ==0){ //一度通過したら度目を禁止する
int amax,xrand,nohai;
int xx,yy,y;
char buf[80];
Graphics^ gr=this->CreateGraphics();
String^ string1;
Brush^ brush=gcnew SolidBrush(Color::Black);
System::Drawing::Font^ font=gcnew System::Drawing::Font("MS ゴシック",10);

Random^ rand=gcnew Random(); //で乱数randを生成しておき、
//2) 以上int amax未満の乱数を発生したい場合には、

amax=52;
for(xx=1;xx<54;xx++) card[xx]=0;
yy=1;
while(yy<20){
xrand=rand->Next(amax)+1;
int flag=0;
for(xx=1;xx<53;xx++) {if(card[xx]==xrand) flag=1;}
if(flag==0){ card[yy]=xrand;
//文字で確認
sprintf_s(buf,80," %3d ",xrand);
string1=gcnew String(buf);
gr->DrawString(string1,font,brush,(float)16*yy,(float)300);
//文字で確認終了
yy++;}
}
for(y=1;y<53;y++){
if( card[y] > 13 && card[y] <= 26) card[y] = card[y] + 100 - 13;
if( card[y] > 26 && card[y] <= 39) card[y] = card[y] + 200 - 26;
if( card[y] > 39 && card[y] <= 52) card[y] = card[y] + 300 - 39;
} //end for y

for(xx=1;xx<6;xx++){
DispHai(0,xx);
}
hoji1=0;
hoji2=0;
hoji3=0;
hoji4=0;
hoji5=0;

start_flag=1; //一度通過したら度目を禁止するフラッグ
}//end if start_flag=1;一度通過したら度目を禁止する

 

}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
int xx;
for(xx=1;xx<6;xx++){
DispHai(card[xx],xx);
}


実際のsample

#pragma once
static int card[55];
//static int hai[12];
static int keta[12];
static int yaku[12];
static int start_flag=0;
static int tokuten=0;

namespace basictoc {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Form1 の概要
///
/// 警告: このクラスの名前を変更する場合、このクラスが依存するすべての .resx ファイルに関連付けられた
/// マネージ リソース コンパイラ ツールに対して 'Resource File Name' プロパティを
/// 変更する必要があります。この変更を行わないと、
/// デザイナと、このフォームに関連付けられたローカライズ済みリソースとが、
/// 正しく相互に利用できなくなります。
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: ここにコンストラクタ コードを追加します
//
}

protected:
/// <summary>
/// 使用中のリソースをすべてクリーンアップします。
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::Button^ button1;
protected:
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Button^ button3;
private: System::Windows::Forms::CheckBox^ checkBox1;
private: System::Windows::Forms::CheckBox^ checkBox2;
private: System::Windows::Forms::CheckBox^ checkBox3;
private: System::Windows::Forms::CheckBox^ checkBox4;
private: System::Windows::Forms::CheckBox^ checkBox5;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::Button^ button4;

private:
/// <summary>
/// 必要なデザイナ変数です。
/// </summary>
System::ComponentModel::Container ^components;
void DispHai( int nohai,int xx){

Graphics^ gr=this->CreateGraphics();
int X0=10,Y0=1;
String^ filename;
filename="c:\\card\\1_sp.gif";
if(nohai==0 ) filename="c:\\card\\0_r1.gif" ;
//Pen^ pen1=gcnew Pen(col);
if(nohai>0 && nohai<14) filename="c:\\card\\"+nohai+"_sp.gif" ;
if(nohai>100 && nohai<114 ){nohai=nohai-100;
filename="c:\\card\\"+nohai+"_cl.gif" ;}
if(nohai>200 && nohai<214 ){nohai=nohai-200;
filename="c:\\card\\"+nohai+"_di.gif" ;}

if(nohai>300 && nohai<314){nohai=nohai-300;
filename="c:\\card\\"+nohai+"_he.gif" ;}
//原画像を左上に描画する
if(xx==1){
Bitmap^ bmap1; //bmap1の確保
bmap1=gcnew Bitmap(filename);
gr->DrawImage(bmap1,X0,Y0);
}
if(xx==2){
Bitmap^ bmap2; //bmap2の確保
bmap2=gcnew Bitmap(filename);
gr->DrawImage(bmap2,X0+100,Y0);
}
if(xx==3){
Bitmap^ bmap3; //bmap3の確保
bmap3=gcnew Bitmap(filename);
gr->DrawImage(bmap3,X0+200,Y0);
}
if(xx==4){
Bitmap^ bmap4; //bmap4の確保
bmap4=gcnew Bitmap(filename);
gr->DrawImage(bmap4,X0+300,Y0);
}
if(xx==5){
Bitmap^ bmap5; //bmap5の確保
bmap5=gcnew Bitmap(filename);
gr->DrawImage(bmap5,X0+400,Y0);
}
}
#pragma region Windows Form Designer generated code
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
void InitializeComponent(void)
{
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox2 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox3 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox4 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox5 = (gcnew System::Windows::Forms::CheckBox());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->button4 = (gcnew System::Windows::Forms::Button());
this->SuspendLayout();
//
// button1
//
this->button1->Location = System::Drawing::Point(43, 210);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(108, 37);
this->button1->TabIndex = 0;
this->button1->Text = L"button1";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(192, 210);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(109, 33);
this->button2->TabIndex = 1;
this->button2->Text = L"button2";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// button3
//
this->button3->Location = System::Drawing::Point(341, 210);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(103, 33);
this->button3->TabIndex = 2;
this->button3->Text = L"button3";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// checkBox1
//
this->checkBox1->AutoSize = true;
this->checkBox1->Location = System::Drawing::Point(12, 154);
this->checkBox1->Name = L"checkBox1";
this->checkBox1->Size = System::Drawing::Size(101, 19);
this->checkBox1->TabIndex = 3;
this->checkBox1->Text = L"checkBox1";
this->checkBox1->UseVisualStyleBackColor = true;
//
// checkBox2
//
this->checkBox2->AutoSize = true;
this->checkBox2->Location = System::Drawing::Point(130, 154);
this->checkBox2->Name = L"checkBox2";
this->checkBox2->Size = System::Drawing::Size(101, 19);
this->checkBox2->TabIndex = 4;
this->checkBox2->Text = L"checkBox2";
this->checkBox2->UseVisualStyleBackColor = true;
//
// checkBox3
//
this->checkBox3->AutoSize = true;
this->checkBox3->Location = System::Drawing::Point(253, 154);
this->checkBox3->Name = L"checkBox3";
this->checkBox3->Size = System::Drawing::Size(101, 19);
this->checkBox3->TabIndex = 5;
this->checkBox3->Text = L"checkBox3";
this->checkBox3->UseVisualStyleBackColor = true;
//
// checkBox4
//
this->checkBox4->AutoSize = true;
this->checkBox4->Location = System::Drawing::Point(360, 154);
this->checkBox4->Name = L"checkBox4";
this->checkBox4->Size = System::Drawing::Size(101, 19);
this->checkBox4->TabIndex = 6;
this->checkBox4->Text = L"checkBox4";
this->checkBox4->UseVisualStyleBackColor = true;
//
// checkBox5
//
this->checkBox5->AutoSize = true;
this->checkBox5->Location = System::Drawing::Point(479, 154);
this->checkBox5->Name = L"checkBox5";
this->checkBox5->Size = System::Drawing::Size(101, 19);
this->checkBox5->TabIndex = 7;
this->checkBox5->Text = L"checkBox5";
this->checkBox5->UseVisualStyleBackColor = true;
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(43, 277);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(287, 22);
this->textBox1->TabIndex = 8;
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(360, 277);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(160, 22);
this->textBox2->TabIndex = 9;
//
// button4
//
this->button4->Location = System::Drawing::Point(466, 317);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(113, 25);
this->button4->TabIndex = 10;
this->button4->Text = L"button4";
this->button4->UseVisualStyleBackColor = true;
this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(8, 15);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(584, 346);
this->Controls->Add(this->button4);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->checkBox5);
this->Controls->Add(this->checkBox4);
this->Controls->Add(this->checkBox3);
this->Controls->Add(this->checkBox2);
this->Controls->Add(this->checkBox1);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Name = L"Form1";
this->Text = L"Form1";
this->Paint += gcnew System::Windows::Forms::PaintEventHandler(this, &Form1::Form1_Paint);
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion
private: System::Void Form1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) {
Graphics^ gr=this->CreateGraphics();
}
private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if(start_flag ==0){ //一度通過したら度目を禁止する
int amax,xrand,nohai;
int xx,yy,y;
char buf[80];
Graphics^ gr=this->CreateGraphics();
String^ string1;
Brush^ brush=gcnew SolidBrush(Color::Black);
System::Drawing::Font^ font=gcnew System::Drawing::Font("MS ゴシック",10);
Random^ rand=gcnew Random(); //で乱数randを生成しておき、
//2) 以上int amax未満の乱数を発生したい場合には、
amax=52;
for(xx=1;xx<54;xx++) card[xx]=0;
yy=1;
while(yy<20){
xrand=rand->Next(amax)+1;
int flag=0;
for(xx=1;xx<53;xx++) {if(card[xx]==xrand) flag=1;}
if(flag==0){ card[yy]=xrand;
//文字で確認
//sprintf_s(buf,80," %3d ",xrand);
//string1=gcnew String(buf);
//gr->DrawString(string1,font,brush,(float)16*yy,(float)300);
//文字で確認終了
yy++;}
}
for(y=1;y<53;y++){
if( card[y] > 13 && card[y] <= 26) card[y] = card[y] + 100 - 13;
if( card[y] > 26 && card[y] <= 39) card[y] = card[y] + 200 - 26;
if( card[y] > 39 && card[y] <= 52) card[y] = card[y] + 300 - 39;
} //end for y
for(xx=1;xx<6;xx++){
DispHai(0,xx);
}
start_flag=1; //一度通過したら度目を禁止するフラッグ
}//end if
}
private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
if(start_flag==1){
int xx;
for(xx=1;xx<6;xx++){
DispHai(card[xx],xx);
} //Next x
start_flag=2;
} // End if
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
if(start_flag==2){
int x,y,w,oitoku;
int flash=0;
int flag=0;
char buf[80];
x = 6;
if( checkBox1->Checked ){}else{
card[1] = card[x];
x = x + 1;
}
if( checkBox2->Checked ){}else{
card[2] = card[x];
x = x + 1;
}
if( checkBox3->Checked ){}else{
card[3] = card[x];
x = x + 1;
}
if( checkBox4->Checked ){}else{
card[4] = card[x];
x = x + 1;
}
if( checkBox5->Checked ){}else{
card[5] = card[x];
x = x + 1;
}
for(x=1;x<6;x++) DispHai(card[x],x);

 

// yaku no kaiseki
// flash no kaiseki
String^ string1;
string1 = "役なし";
textBox1->Text=string1;
int clab = 0;
int daiya = 0;
int hart = 0;
int supedo = 0;
flash = 0;
for( x = 1 ; x<= 5; x++){
if( card[x] > 0 && card[x] <= 13 ) clab = clab + 1;
if( card[x] > 100 && card[x] <= 113 ) daiya = daiya + 1;
if( card[x] > 200 && card[x] <= 213 ) hart = hart + 1;
if( card[x] > 300 && card[x] <= 313 ) supedo = supedo + 1;
}//Next x
if( clab == 5 ){
string1 = "クラブのフラッシュ";
textBox1->Text=string1;
flash = 1;
tokuten = tokuten + 509;
}//End if

if( daiya == 5 ){
string1 = "ダイヤのフラッシュ";
textBox1->Text=string1;
flash = 1;
tokuten = tokuten + 509;
}//End if

if( hart == 5 ){
string1 = "ハートのフラッシュ";
textBox1->Text=string1;
flash = 1;
tokuten = tokuten + 509;
}//End if
if( supedo == 5 ){
string1 = "スペードのフラッシュ";
textBox1->Text=string1;
flash = 1;
tokuten = tokuten + 509;
}//End if

//Rem ペアーの解析
for( x = 6 ; x<= 10;x++){
keta[x] = 0;
} //Next x
for( x = 1 ; x<= 5;x++){
y = card[x];
//Cells(x, 3) = y
if( card[x] > 100 ) y = card[x] - 100;
if( card[x] > 200 ) y = card[x] - 200;
if( card[x] > 300 ) y = card[x] - 300;
//Cells(x, 4) = y
keta[x] = y;
} //Next x
for( x = 1 ; x<= 5;x++){
yaku[x] = 0;
for( w = 1 ; w<= 5;w++){
if( keta[x] = keta[w] ) yaku[x] = yaku[x] + 1;
} //Next w
//Cells(x, 5) = yaku[x)
} //Next x
int twopai = 0;
int threepai = 0;
for( x = 1 ; x<= 5;x++){
if( yaku[x] == 2 ) twopai = twopai + 1;
if( yaku[x] == 3 ) threepai = 1;
if( yaku[x] == 4 ){
string1 = "フォーカード";
textBox1->Text=string1;
flash = 1;
tokuten = tokuten + 4165;
}
} //Next x
if( twopai == 2 ){
string1 = "ワンペアー";
textBox1->Text=string1;
tokuten = tokuten + 3;
} //End if

if( twopai == 4 ){
string1 = "ツーペアー";
textBox1->Text=string1;
tokuten =tokuten + 21;
} //End if

if( threepai == 1 ){
string1 = "スリーカード";
textBox1->Text=string1;
tokuten =tokuten + 47;
} //End if
if( threepai == 1 && twopai == 2 ){
string1 = "フルハウス";
textBox1->Text=string1;
tokuten =tokuten + 694;
} //End if
//Rem ストレートの解析
for( x = 1 ; x<= 5;x++){
for( y = 1 ; y<= 5;y++){
if( keta[x] < keta[y] ){
oitoku = keta[x];
keta[x] = keta[y];
keta[y] = oitoku;
} //End if
} //Next y
} //Next x

//for( x = 1 ; <= 5;x++){
//Cells(x, 6) = keta[x)
//}//Next x

if( keta[1] == 1 && keta[5] == 13 ){
for( x = 1 ; x<= 5;x++){
if( keta[x] == x ){
keta[x + 5] = keta[x] + 13;
//Cells(x + 5, 7) = keta[x) + 13
} //End If
} //Next x
} //End If
flag = 0;
for( x = 1 ; x<= 9;x++){
if( keta[x] == keta[x + 1] - 1 ){ flag = flag + 1;}
} //Next x

if( flag >= 4 ){
string1 = "ストレート";
textBox1->Text=string1;

tokuten = tokuten + 255;
if( flash = 1 ){
string1 = "ストレートフラッシュ";
textBox1->Text=string1;
tokuten = tokuten + 72193 - 255;
} //End if
} //End if
if( flag >= 4 && keta[1] == 1 && keta[5] == 13 && flash == 1 ){
string1 ="ロイヤルストレートフラッシュ";
textBox1->Text=string1;

tokuten = tokuten + 649740 - 72193;
}
sprintf_s(buf,80," %10d ",tokuten);
string1=gcnew String(buf);
textBox2->Text=string1;
start_flag=0;
}// End if

}
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {
card[6]=1;
card[7]=101;
card[8]=201;
card[9]=301;
card[10]=13;
}
};

}

 

 
動画が旨くご覧いただけない場合は最新のFlash Playerをインストールしてください
web ブラウザがインターネットエクスプローラ6(IE6)以下の場合メニューが崩れてしまうことがあります。
インターネットエクスプローラ7、Sleipnir、Mozilla Firefoxをご使用ください。