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

pc2

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

アルゴリズム
電子回路

 






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

 

ロボット・DOSV掲示板兼Blog

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

roboto

Topに戻る

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

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


工作


集団練習メニュー


しつけ 訓練コラム




最後にララについて

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

Laraララの
ブログ

犬のしつけと訓練
掲示板


掲示板の利用規則

 

 

 

 

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

 

Visual Studio 2008 Express Edition でトランプゲームを作ろう
最終確認

Form1の内容


#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 hoji1=0;
static int hoji2=0;
static int hoji3=0;
static int hoji4=0;
static int hoji5=0;
static int tokuten=0;

namespace test3 {

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::CheckBox^ checkBox1;
protected:
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::Button^ button1;
private: System::Windows::Forms::Button^ button2;
private: System::Windows::Forms::Button^ button3;
private: System::Windows::Forms::TextBox^ textBox1;
private: System::Windows::Forms::TextBox^ textBox2;
private: System::Windows::Forms::Button^ button4;
private: System::Windows::Forms::Label^ label1;
private: System::Windows::Forms::Label^ label2;
private: System::Windows::Forms::TextBox^ textBox3;
private: System::Windows::Forms::TextBox^ textBox4;
private: System::Windows::Forms::TextBox^ textBox5;
private: System::Windows::Forms::TextBox^ textBox6;
private: System::Windows::Forms::TextBox^ textBox7;

protected:

 

 

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

Graphics^ gr=this->CreateGraphics();
int X0=10,Y0=10;
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; //bmapの確保
bmap1=gcnew Bitmap(filename);
gr->DrawImage(bmap1,X0,Y0);
}
if(xx==2){
Bitmap^ bmap2; //bmapの確保
bmap2=gcnew Bitmap(filename);
gr->DrawImage(bmap2,X0+100,Y0);
}
if(xx==3){
Bitmap^ bmap3; //bmapの確保
bmap3=gcnew Bitmap(filename);
gr->DrawImage(bmap3,X0+200,Y0);
}
if(xx==4){
Bitmap^ bmap4; //bmapの確保
bmap4=gcnew Bitmap(filename);
gr->DrawImage(bmap4,X0+300,Y0);
}
if(xx==5){
Bitmap^ bmap5; //bmapの確保
bmap5=gcnew Bitmap(filename);
gr->DrawImage(bmap5,X0+400,Y0);
}

}

 

#pragma region Windows Form Designer generated code
/// <summary>
/// デザイナ サポートに必要なメソッドです。このメソッドの内容を
/// コード エディタで変更しないでください。
/// </summary>
void InitializeComponent(void)
{
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->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->button3 = (gcnew System::Windows::Forms::Button());
this->textBox1 = (gcnew System::Windows::Forms::TextBox());
this->textBox2 = (gcnew System::Windows::Forms::TextBox());
this->button4 = (gcnew System::Windows::Forms::Button());
this->label1 = (gcnew System::Windows::Forms::Label());
this->label2 = (gcnew System::Windows::Forms::Label());
this->textBox3 = (gcnew System::Windows::Forms::TextBox());
this->textBox4 = (gcnew System::Windows::Forms::TextBox());
this->textBox5 = (gcnew System::Windows::Forms::TextBox());
this->textBox6 = (gcnew System::Windows::Forms::TextBox());
this->textBox7 = (gcnew System::Windows::Forms::TextBox());
this->SuspendLayout();
//
// checkBox1
//
this->checkBox1->AutoSize = true;
this->checkBox1->Location = System::Drawing::Point(48, 141);
this->checkBox1->Name = L"checkBox1";
this->checkBox1->Size = System::Drawing::Size(48, 16);
this->checkBox1->TabIndex = 4;
this->checkBox1->Text = L"保持";
this->checkBox1->UseVisualStyleBackColor = true;
this->checkBox1->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox1_CheckedChanged);
//
// checkBox2
//
this->checkBox2->AutoSize = true;
this->checkBox2->Location = System::Drawing::Point(136, 141);
this->checkBox2->Name = L"checkBox2";
this->checkBox2->Size = System::Drawing::Size(48, 16);
this->checkBox2->TabIndex = 5;
this->checkBox2->Text = L"保持";
this->checkBox2->UseVisualStyleBackColor = true;
this->checkBox2->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox2_CheckedChanged);
//
// checkBox3
//
this->checkBox3->AutoSize = true;
this->checkBox3->Location = System::Drawing::Point(231, 141);
this->checkBox3->Name = L"checkBox3";
this->checkBox3->Size = System::Drawing::Size(48, 16);
this->checkBox3->TabIndex = 6;
this->checkBox3->Text = L"保持";
this->checkBox3->UseVisualStyleBackColor = true;
this->checkBox3->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox3_CheckedChanged);
//
// checkBox4
//
this->checkBox4->AutoSize = true;
this->checkBox4->Location = System::Drawing::Point(318, 141);
this->checkBox4->Name = L"checkBox4";
this->checkBox4->Size = System::Drawing::Size(48, 16);
this->checkBox4->TabIndex = 7;
this->checkBox4->Text = L"保持";
this->checkBox4->UseVisualStyleBackColor = true;
this->checkBox4->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox4_CheckedChanged);
//
// checkBox5
//
this->checkBox5->AutoSize = true;
this->checkBox5->Location = System::Drawing::Point(407, 143);
this->checkBox5->Name = L"checkBox5";
this->checkBox5->Size = System::Drawing::Size(48, 16);
this->checkBox5->TabIndex = 8;
this->checkBox5->Text = L"保持";
this->checkBox5->UseVisualStyleBackColor = true;
this->checkBox5->CheckedChanged += gcnew System::EventHandler(this, &Form1::checkBox5_CheckedChanged);
//
// button1
//
this->button1->Location = System::Drawing::Point(48, 229);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(93, 34);
this->button1->TabIndex = 9;
this->button1->Text = L"start";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(195, 229);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(102, 31);
this->button2->TabIndex = 10;
this->button2->Text = L"交換";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// button3
//
this->button3->Location = System::Drawing::Point(344, 229);
this->button3->Name = L"button3";
this->button3->Size = System::Drawing::Size(111, 30);
this->button3->TabIndex = 11;
this->button3->Text = L"進む";
this->button3->UseVisualStyleBackColor = true;
this->button3->Click += gcnew System::EventHandler(this, &Form1::button3_Click);
//
// textBox1
//
this->textBox1->Location = System::Drawing::Point(71, 300);
this->textBox1->Name = L"textBox1";
this->textBox1->Size = System::Drawing::Size(272, 19);
this->textBox1->TabIndex = 12;
//
// textBox2
//
this->textBox2->Location = System::Drawing::Point(71, 336);
this->textBox2->Name = L"textBox2";
this->textBox2->Size = System::Drawing::Size(272, 19);
this->textBox2->TabIndex = 13;
//
// button4
//
this->button4->Location = System::Drawing::Point(349, 285);
this->button4->Name = L"button4";
this->button4->Size = System::Drawing::Size(103, 34);
this->button4->TabIndex = 14;
this->button4->Text = L"実験";
this->button4->UseVisualStyleBackColor = true;
this->button4->Click += gcnew System::EventHandler(this, &Form1::button4_Click);
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(35, 307);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(17, 12);
this->label1->TabIndex = 15;
this->label1->Text = L"役";
this->label1->Click += gcnew System::EventHandler(this, &Form1::label1_Click);
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(23, 336);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(29, 12);
this->label2->TabIndex = 16;
this->label2->Text = L"得点";
//
// textBox3
//
this->textBox3->Location = System::Drawing::Point(72, 378);
this->textBox3->Name = L"textBox3";
this->textBox3->Size = System::Drawing::Size(475, 19);
this->textBox3->TabIndex = 17;
//
// textBox4
//
this->textBox4->Location = System::Drawing::Point(70, 414);
this->textBox4->Name = L"textBox4";
this->textBox4->Size = System::Drawing::Size(476, 19);
this->textBox4->TabIndex = 18;
//
// textBox5
//
this->textBox5->Location = System::Drawing::Point(70, 453);
this->textBox5->Name = L"textBox5";
this->textBox5->Size = System::Drawing::Size(475, 19);
this->textBox5->TabIndex = 19;
//
// textBox6
//
this->textBox6->Location = System::Drawing::Point(69, 492);
this->textBox6->Name = L"textBox6";
this->textBox6->Size = System::Drawing::Size(475, 19);
this->textBox6->TabIndex = 20;
//
// textBox7
//
this->textBox7->Location = System::Drawing::Point(69, 534);
this->textBox7->Name = L"textBox7";
this->textBox7->Size = System::Drawing::Size(474, 19);
this->textBox7->TabIndex = 21;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 12);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(584, 563);
this->Controls->Add(this->textBox7);
this->Controls->Add(this->textBox6);
this->Controls->Add(this->textBox5);
this->Controls->Add(this->textBox4);
this->Controls->Add(this->textBox3);
this->Controls->Add(this->label2);
this->Controls->Add(this->label1);
this->Controls->Add(this->button4);
this->Controls->Add(this->textBox2);
this->Controls->Add(this->textBox1);
this->Controls->Add(this->button3);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
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->Name = L"Form1";
this->Text = L"Form1";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
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) {
//int X0=10,Y0=10;
Graphics^ gr=e->Graphics;
//Pen^ pen;
//Color color_src,color_dest;
}

private: System::Void Form1_Load(System::Object^ sender, System::EventArgs^ e) {
}

private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {
if(start_flag ==0){ //一度通過したら2度目を禁止する
int amax,xrand,nohai;
int xx,yy,y;
char buf[80];
Graphics^ gr=this->CreateGraphics();
//文字の用意
String^ string1;
String^ string2;

Brush^ brush=gcnew SolidBrush(Color::Black);
System::Drawing::Font^ font=gcnew System::Drawing::Font("MS ゴシック",10);
//文字の用意終了
Random^ rand=gcnew Random(); //で乱数randを生成しておき、
//2) 0以上int amax未満の乱数を発生したい場合には、
string2="乱数値";
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)450);
string2=string2+string1;
//文字で確認終了
yy++;}
}
//文字で表示
//MessageBox::Show(string2);
textBox3->Text=string2;

string2="変換値";
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++){
hai[xx]=card[xx];
//文字で乱数を確認
sprintf_s(buf,80," %3d ",hai[xx]);
string1=gcnew String(buf);
string2=string2+string1;
//文字で確認終了

}
//文字で表示
textBox4->Text=string2;

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

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

}
private: System::Void checkBox1_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
hoji1=1;
}
private: System::Void checkBox2_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
hoji2=1;
}
private: System::Void checkBox3_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
hoji3=1;
}
private: System::Void checkBox4_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
hoji4=1;
}
private: System::Void checkBox5_CheckedChanged(System::Object^ sender, System::EventArgs^ e) {
hoji5=1;
}
private: System::Void button3_Click(System::Object^ sender, System::EventArgs^ e) {
if (start_flag==2){
int nohai;
int xx;
for(xx=1;xx<6;xx++){
nohai=0;
DispHai(nohai,xx);
}

start_flag=0;
}
}
private: System::Void button4_Click(System::Object^ sender, System::EventArgs^ e) {


card[6]=1;
card[7]=2;
card[8]=3;
card[9]=4;
card[10]=5;

}


private: System::Void button2_Click(System::Object^ sender, System::EventArgs^ e) {
if(start_flag==1){
int nohai;
int xx=6;
int x,y,w;
char buf[80];
/*
テキストボックス入力を読み取るには、
    String^ string1=textBox1- >Text;
テキストボックスに表示するには、
    textBox1- >Text=string1;
*/
String^ string1= "ブタです";
textBox1->Text=string1;

if (hoji1==0){hai[1]=card[xx]; xx++;}
if (hoji2==0){hai[2]=card[xx]; xx++;}
if (hoji3==0){hai[3]=card[xx]; xx++;}
if (hoji4==0){hai[4]=card[xx]; xx++;}
if (hoji5==0){hai[5]=card[xx]; }

for(xx=1;xx<6;xx++){
nohai=hai[xx];
DispHai(nohai,xx);
} //end for
//Rem フラッシュ
int club = 0;
int daiya = 0;
int hart = 0;
int supedo = 0;
int flash = 0;

for(x=1;x<6;x++){
if( hai[x] > 0 && hai[x] <= 13) {supedo = supedo + 1;}
if( hai[x] > 100 && hai[x] <= 113 ) {club=club + 1;}
if( hai[x] > 200 && hai[x] <= 213 ) {daiya = daiya + 1;}
if( hai[x] > 300 && hai[x] <= 313 ) {hart = hart + 1;}
} //Next x
if( club == 5){
string1= "クラブのフラッシュ";
flash = 1;
tokuten = tokuten + 509;
}//End If clab
if (daiya == 5){
string1= "ダイヤのフラッシュ";
flash = 1;
tokuten = tokuten + 509;
}//End If daiya
if( hart == 5 ){
string1= "ハートのフラッシュ";
flash = 1;
tokuten = tokuten + 509;
}//End If hart
if( supedo == 5){
string1= "スペードのフラッシュ";
flash = 1;
tokuten = tokuten + 509;
}//End If supedo
textBox1->Text=string1;
//文字で数を確認
sprintf_s(buf,80,"supedo=%3d club=%3d daiy=%3d hart=%3d",supedo,club,daiya,hart);
string1=gcnew String(buf);
textBox5->Text=string1;
//文字で確認終了

//Rem フラッシュend
//Rem ペアー
int twopai = 0;
int threepai = 0;
int oitoku;
for(x=6;x<11;x++){
keta[x] = 0;
}//Next x
for(x=1;x<6;x++){
y=hai[x];
if(hai[x]>100) y=hai[x]-100;
if(hai[x]>200) y=hai[x]-200;
if(hai[x]>300) y=hai[x]-300;
keta[x]=y;
}//Next x
for(x=1;x<6;x++){
yaku[x] = 0;
for(w=1;w<6;w++){
if( keta[x] == keta[w]) yaku[x] = yaku[x] + 1;
}//Next w
}//Next x

for(x=1;x<6;x++){
if( yaku[x]== 2) twopai = twopai + 1;
if( yaku[x]== 3) threepai = 1;
if( yaku[x]== 4){
string1 = "フォーカード";
tokuten = tokuten + 4165;
}//End if( yaku[x]== 4)
}//Next x

if( twopai == 2 ){
string1 = "ワンペーア";
tokuten = tokuten + 3;
}//End If( twopai == 2 )

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

if( threepai == 1){
string1 = "スリーカード";
tokuten = tokuten + 47;
}//End If( threepai == 1)
if( twopai == 2 && threepai == 1){
string1 = "フルハウス";
tokuten = tokuten + 694;
}//End If

textBox1->Text=string1;
//Rem ペアーend

//Rem ストレート
for(x=1;x<6;x++){
for(y=1;y<6;y++){
if( keta[x] < keta[y]){
oitoku = keta[x];
keta[x] = keta[y];
keta[y] = oitoku;
}//End If
}//Next y
}//Next x
if (keta[1] == 1){
for(x=1;x<6;x++){
if( keta[x] = x) keta[x + 5] = keta[x] + 13;
}// Next x
}//End if (keta[1] == 1)
int flag = 0;
for(x=1;x<10;x++){
if (keta[x] == keta[x + 1] - 1) flag = flag + 1;
}//Next x
if( flag >= 4){
string1 = string1 + " ストレート";
tokuten = tokuten + 255;
if( flash == 1) tokuten = tokuten + 72193 - 255;
if( flash == 1 && flag >= 4 && keta[1] == 1 && keta[5] == 13){
string1 = "ローヤルストレートフラッシュ";
tokuten = tokuten + 649740;
}//End If
//TextBox2 = tokuten
}//End If
textBox1->Text=string1;
//Rem ストレートend
textBox2->Text=tokuten.ToString();//数値から文字列への変換には、
//textBox2->Text=string2;

start_flag=2;
} //end if start_flag==1

}

private: System::Void label1_Click(System::Object^ sender, System::EventArgs^ e) {
}
};
}

 

 

 

 

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