楊佳豪 http://lienyueh.blogspot.com/
葉明樺
http://minghuayeh.blogspot.com/
林哲瑜
www.wretch.cc/blog/warbobobo
林俊德
www.wretch.cc/blog/YFU385
楊維帆
http://fcuwf.twbbs.org/
王偉亦
www.wretch.cc/blog/jerry12386
吳育全
http://gary1424.blogspot.com/
鄭翊甫
www.wretch.cc/blog/ifff
歐明睿
www.wretch.cc/blog/pah2853163kd
林修麒
http://aello00382.blogspot.com/
謝治紘
http://nike791224.blogspot.com/
張豫武
http://mydisboxyworld.blogspot.com/
蕭銘宏
http://sean80221123.blogspot.com/
許晉晏
http://blog.yam.com/bibby0616
劉華瑋
http://alan5820.blogspot.com/
陳閔信
www.wretch.cc/blog/spirit771212
陳立棠
www.wretch.cc/blog/kingki10
劉哲宇
http://nicewintersnow.blogspot.com/
徐靜宜
http://star2897.blogspot.com/
吳筱婷
http://laura2036108037.blogspot.com/
林維聖
http://nweilin.blogspot.com/
王繹涵
www.wretch.cc/blog/luckmeand
陳珮綺
http://peach790520.blogspot.com/
孫子庭
www.wretch.cc/blog/t1357964
吳煒銘
www.wretch.cc/blog/wu19881101
劉子睿
ae00529.blogspot.com
李虹毅
http://responsible10.blogspot.com/
宋嘉軒
www.wretch.cc/blog/ken74185963
吳佩蓉
http://summerday0311.blogspot.com/
郭濟源
http://kax0205.blogspot.com/
許庭碩
www.wretch.cc/blog/cooljdm
郭宗賢
http://kuohome123.blogspot.com/
-------------------------------------------------------------------------------------------------------
11月5日 TicTacToe v1.1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Label Label1;
public Button button1;
System.Windows.Forms.Button[] Buttons;
int bno,nobtpressed=0;
int[] recordbutn=new int[9]{0, 1, 2,3,4,5,6,7,8};
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Buttons = new System.Windows.Forms.Button[9];
for (int i = 0; i < 9; ++i)
{
Buttons[i] = new Button();
Buttons[i].Size=new Size(50, 50);
Buttons[i].Click += new System.EventHandler(Buttons_Click);
this.Controls.Add(Buttons[i]);
if (i <= 2)
Buttons[i].Location = new System.Drawing.Point(10 + i * 80, 0 + 10);
else if (i > 2 && i <= 5)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 3) * 80, 50 + 10);
else if (i > 5 && i <= 9)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 6) * 80, 100 + 10);
Buttons[i].Text = "" + i + "";
}
/*
Label1 = new Label();
Label1.Location = new Point(30, 30);
Label1.Text = "1";
Controls.Add(Label1);
button1 = new Button();
button1.Location = new Point(60, 60);
button1.Size = new Size(60, 60);
button1.Text = "2";
Controls.Add(button1);
button1.Enabled = false;
KeyDown += new KeyEventHandler(Form1_KeyDown);
button1.Click += new System.EventHandler(Button1_Click);
*/
}
public void Buttons_Click(object sender, EventArgs e)
{
// System.Windows.Forms.MessageBox.Show("You have clicked button " +
// ((System.Windows.Forms.Button)sender).Tag.ToString());
String tnum = sender.ToString();
int tlen = tnum.Length;
int temp;
String no = tnum.Substring(tlen - 1);
for (int i = 0; i < 9; i++)
{
if (Buttons[i].Text == no)
bno = i;
}
switch (bno)
{
case 0:
//MessageBox.Show("0");
Buttons[0].Image = pictureBox1.Image;
nobtpressed = nobtpressed + 1;
label3.Text = "" + nobtpressed;
temp = recordbutn[0];
recordbutn[0] = recordbutn[9 - nobtpressed];
recordbutn[9 - nobtpressed] = temp;
//button2_Click(sender, e);
break;
case 1:
//MessageBox.Show("1");
Buttons[1].Image = pictureBox1.Image;
nobtpressed = nobtpressed + 1;
label3.Text = "" + nobtpressed;
temp = recordbutn[1];
recordbutn[1] = recordbutn[9 - nobtpressed];
recordbutn[9 - nobtpressed] = temp;
//button2_Click(sender, e);
break;
case 2:
//MessageBox.Show("2");
Buttons[2].Image = pictureBox1.Image;
nobtpressed = nobtpressed + 1;
label3.Text = "" + nobtpressed;
temp = recordbutn[2];
recordbutn[2] = recordbutn[9 - nobtpressed];
recordbutn[9 - nobtpressed] = temp;
//button2_Click(sender, e);
break;
case 3:
//MessageBox.Show("3");
Buttons[3].Image = pictureBox1.Image;
nobtpressed = nobtpressed + 1;
label3.Text = "" + nobtpressed;
temp = recordbutn[3];
recordbutn[3] = recordbutn[9 - nobtpressed];
recordbutn[9 - nobtpressed] = temp;
//button2_Click(sender, e);
break;
case 4:
//MessageBox.Show("4");
Buttons[4].Image = pictureBox1.Image;
nobtpressed = nobtpressed + 1;
temp=recordbutn[4];
recordbutn[4] = recordbutn[9 - nobtpressed];
recordbutn[9 - nobtpressed] = temp;
label3.Text = "" + nobtpressed;
//button2_Click(sender, e);
break;
case 5:
//MessageBox.Show("5");
Buttons[5].Image = pictureBox1.Image;
nobtpressed = nobtpressed + 1;
label3.Text = "" + nobtpressed;
temp = recordbutn[5];
recordbutn[5] = recordbutn[9 - nobtpressed];
recordbutn[9 - nobtpressed] = temp;
//button2_Click(sender, e);
break;
case 6:
Buttons[6].Image = pictureBox1.Image;
//MessageBox.Show("6");
nobtpressed = nobtpressed + 1;
label3.Text = "" + nobtpressed;
temp = recordbutn[6];
recordbutn[6] = recordbutn[9 - nobtpressed];
recordbutn[9 - nobtpressed] = temp;
//button2_Click(sender, e);
break;
case 7:
//MessageBox.Show("7");
Buttons[7].Image = pictureBox1.Image;
nobtpressed = nobtpressed + 1;
label3.Text = "" + nobtpressed;
temp = recordbutn[7];
recordbutn[7] = recordbutn[9 - nobtpressed];
recordbutn[9 - nobtpressed] = temp;
//button2_Click(sender, e);
break;
case 8:
//MessageBox.Show("8");
Buttons[8].Image = pictureBox1.Image;
nobtpressed = nobtpressed + 1;
label3.Text = "" + nobtpressed;
temp = recordbutn[8];
recordbutn[8] = recordbutn[9 - nobtpressed];
recordbutn[9 - nobtpressed] = temp;
//button2_Click(sender, e);
break;
}
}
void Button1_Click(object sender, System.EventArgs e)
{
MessageBox.Show("button_click");
}
string a="";
void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
a = "";
if (e.KeyCode == Keys.A)
a = a + "A";
if (e.KeyCode == Keys.B)
a = a + "B";
if (e.KeyCode == Keys.C)
a = a + "C";
if (e.KeyCode == Keys.D)
a = a + "D";
if (e.KeyCode == Keys.E)
a = a + "E";
if (e.KeyCode == Keys.F)
a = a + "F";
if (e.KeyCode == Keys.G)
a = a + "G";
if (e.KeyCode == Keys.H)
a = a + "H";
if (e.KeyCode == Keys.I)
a = a + "I";
if (e.KeyCode == Keys.J)
a = a + "J";
if (e.KeyCode == Keys.K)
a = a + "K";
if (e.KeyCode == Keys.L)
a = a + "L";
if (e.KeyCode == Keys.M)
a = a + "M";
if (e.KeyCode == Keys.N)
a = a + "N";
if (e.KeyCode == Keys.O)
a = a + "O";
if (e.KeyCode == Keys.P)
a = a + "P";
if (e.KeyCode == Keys.Q)
a = a + "Q";
if (e.KeyCode == Keys.R)
a = a + "R";
if (e.KeyCode == Keys.S)
a = a + "S";
if (e.KeyCode == Keys.T)
a = a + "T";
if (e.KeyCode == Keys.U)
a = a + "U";
if (e.KeyCode == Keys.V)
a = a + "V";
if (e.KeyCode == Keys.W)
a = a + "W";
if (e.KeyCode == Keys.X)
a = a + "X";
if (e.KeyCode == Keys.Y)
a = a + "Y";
if (e.KeyCode == Keys.Z)
a = a + "Z";
if (e.KeyCode == Keys.Space)
a = a + " ";
if (e.KeyCode == Keys.Enter)
{
Label1.Text = a;
a = "";
}
label2.Text = a;
}
private void button2_Click(object sender, EventArgs e)
{
nobtpressed = nobtpressed + 1;
label3.Text = "" + nobtpressed;
int temp = recordbutn[8];
recordbutn[8] = recordbutn[9 - nobtpressed];
recordbutn[9 - nobtpressed] = temp;
Random rd = new Random();
int rdno = rd.Next(9 - nobtpressed);
label2.Text = "" + recordbutn[rdno];
Buttons[recordbutn[rdno]].Image = pictureBox2.Image;
}
}
}
------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
XNA
-----------------------------------------------------------------------------------------------------------
10月22日
練習排序,必須26步就完成,請自己做並將每一步記錄。
-----------------------------------------------------------------------------------------------------------------------------------------------------
原圖
Step.1
Step.2
Step.3
Step.4
Step.5
Step.6
Step.7
Step.8
Step.9
Step.10
Step.11
Step.12
Step.13
Step.14
Step.15
678位子保留
Step.16
Step.17
Step.18
Step.19
Step.20
Step.21
Step.22
Step.23
Step.24
345678位子保留
Step.25
Step.26
完成
------------------------------------------------------------------------------------------------------------------------------------------------------
賽局中的最佳化決策
五、 Player 1與Player 2一起玩井字遊戲(Tic-Tac-Toe),Player 1使用 ‘0’ 符號,Player 2使用 ‘X’ 符號,並由Player 1先下。
1. 假設此賽局僅能下六子(Player 1與Player 2各下三子),請問Player 1總共有多少種策略(strategies)可供運用? (6%)
2. 假設賽局進行至第六子,狀況如下所示,請為剩餘的賽局繪製搜尋樹(search tree),並計算平手的機率。 (6%)
2. 贏電腦
前三名獎勵
如題,這是一個AI的作業,要自己亂數設定,在用程式自己解出答案,網路上找了很多相關的程式碼以及文章都沒辦法跑,想了好幾天了,希望各位高手能替我解答,謝謝!
4 1 7
3 0 5
6 2 8
零是空白
最後能自己跑成
0 1 2
3 4 5
---------------------------------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
System.Windows.Forms.Button[] Buttons;
System.Windows.Forms.TextBox[] TextBoxs;
int[,] a = new int[4, 4];
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Buttons = new System.Windows.Forms.Button[9];
TextBoxs = new System.Windows.Forms.TextBox[9];
for (int i = 0; i < 9; ++i)
{
Buttons[i] = new Button();
Buttons[i].Click += new System.EventHandler(Buttons_Click);
this.Controls.Add(Buttons[i]);
if (i <= 2)
Buttons[i].Location = new System.Drawing.Point(10 + i * 80, 10+100);
else if (i > 2 && i <= 5)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 3) * 80, 40+100);
else if (i > 5 && i <= 9)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 6) * 80, 70+100);
}
for (int i = 0; i < 9; ++i)
{
TextBoxs[i] = new TextBox();
this.Controls.Add(TextBoxs[i]);
if (i <= 2)
TextBoxs[i].Location = new System.Drawing.Point(10 + i * 100, 10);
else if (i > 2 && i <= 5)
TextBoxs[i].Location = new System.Drawing.Point(10 + (i - 3) * 100, 40);
else if (i > 5 && i <= 9)
TextBoxs[i].Location = new System.Drawing.Point(10 + (i - 6) * 100, 70);
}
TextBoxs[0].Text = "7";
TextBoxs[1].Text = "2";
TextBoxs[2].Text = "4";
TextBoxs[3].Text = "5";
TextBoxs[4].Text = "0";
TextBoxs[5].Text = "6";
TextBoxs[6].Text = "8";
TextBoxs[7].Text = "3";
TextBoxs[8].Text = "1";
}
public void Buttons_Click(object sender, EventArgs e)
{
// System.Windows.Forms.MessageBox.Show("You have clicked button " +
// ((System.Windows.Forms.Button)sender).Tag.ToString());
String tnum = sender.ToString();
int tlen = tnum.Length;
String no=tnum.Substring(tlen-1);
for (int i=0;i<9;i++)
{
if (Buttons[i].Text==no)
bno=i;
}
switch(bno) {
case 0:
MessageBox.Show("0");
break;
case 1:
if (Buttons[4].Text == "0")
{
String temp;
temp = Buttons[4].Text;
Buttons[4].Text =Buttons[1].Text;
Buttons[1].Text = temp;
}
break;
case 2:
MessageBox.Show("2");
break;
case 3:
MessageBox.Show("3");
break;
case 4:
MessageBox.Show("4");
break;
case 5:
MessageBox.Show("5");
break;
case 6:
MessageBox.Show("6");
break;
case 7:
MessageBox.Show("7");
break;
case 8:
MessageBox.Show("8");
break;
}
private void button1_Click(object sender, EventArgs e)
{
//讀入 input
a[1,1]= Convert.ToInt16(TextBoxs[0].Text);
a[1, 2] = Convert.ToInt16(TextBoxs[1].Text);
a[1, 3] = Convert.ToInt16(TextBoxs[2].Text);
a[2, 1] = Convert.ToInt16(TextBoxs[3].Text);
a[2, 2] = Convert.ToInt16(TextBoxs[4].Text);
a[2, 3] = Convert.ToInt16(TextBoxs[5].Text);
a[3, 1] = Convert.ToInt16(TextBoxs[6].Text);
a[3, 2] = Convert.ToInt16(TextBoxs[7].Text);
a[3, 3] = Convert.ToInt16(TextBoxs[8].Text);
//輸出 output
for (int i = 0; i < 9; i++)
{
if (i < 3)
{
Buttons[i].Text = Convert.ToString(a[1, i + 1]);
}
else if (i >= 3 && i < 6)
{
Buttons[i].Text = Convert.ToString(a[2, (i - 3) + 1]);
}
else
{
Buttons[i].Text = Convert.ToString(a[3, (i - 3 * 2) + 1]);
}
}
}
}
}
Creating Control Arrays in Visual Basic .NET and Visual C# .NET
http://msdn.microsoft.com/en-us/library/aa289500(VS.71).aspx
---------------------------------------------------------------------------
10月15日
加分題
1. 題目
三位數,百位大於十和個位。
例:
3 2 1 逆數 123
相減
321-123=198 逆數 891
相加
198+891=1089
試其他三位數滿足條件:百位大於十位。
其結果仍舊 1089
2. 題目:A與B都是 n*n 的矩陣,求相乘結果
wiki matrix multiplication
int[,] a = new int[4, 4];
int[,] b = new int[4, 4];
int[,] c = new int[4, 4];
int m, n;
m = 4;
n = 4;
a[1, 1] = 1;
a[1, 2] = 0;
a[1, 3] = 0;
a[2, 1] = 0;
a[2, 2] = 1;
a[2, 3] = 0;
a[3, 1] = 0;
a[3, 2] = 0;
a[3, 3] = 1;
b[1, 1] = 1;
b[1, 2] = 0;
b[1, 3] = 0;
b[2, 1] = 0;
b[2, 2] = 1;
b[2, 3] = 0;
b[3, 1] = 0;
b[3, 2] = 0;
b[3, 3] = 1;
for (int i = 1; i < m; i++)
{
for (int j = 1; j < n; j++)
{
for (int k = 1; k < m; k++)
{
c[i, j] = c[i, j] + a[i, k] * b[k, j];
}
Console.WriteLine(" c[" + i + ", " + j + "]=" + c[i, j]);
}
}
Console.WriteLine("ans");
Console.Read();
-------------------------------------------------------------
宣告
System.Windows.Forms.Button[] Buttons;
--------------------------------------------------------------
Buttons = new System.Windows.Forms.Button[9];
for (int i = 0; i < 9; ++i)
{
Buttons[i] = new Button();
this.Controls.Add(Buttons[i]);
if (i <= 2)
Buttons[i].Location = new System.Drawing.Point(10 + i * 80, 10);
else if (i > 2 && i <= 5)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 3) * 80, 40);
else if (i > 5 && i <= 9)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 6) * 80, 70);
}
按鈕陣列
% 注意:複製網頁程式會編議譯錯誤是"字形問題
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
// System.Windows.Forms.Button Button1;
System.Windows.Forms.Button[] Buttons;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Button1 = new System.Windows.Forms.Button();
// this.Controls.Add(Button1);
Buttons = new System.Windows.Forms.Button[9];
for (int i = 0; i < 9; ++i)
{
Buttons[i] = new Button();
this.Controls.Add(Buttons[i]);
if (i <= 2)
Buttons[i].Location = new System.Drawing.Point(10 + i * 80, 10);
else if (i > 2 && i <= 5)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 3) * 80, 40);
else if (i > 5 && i <= 9)
Buttons[i].Location = new System.Drawing.Point(10 + (i - 6) * 80, 70);
}
}
}
}
10月8日
作業:
1. A與B都是3*3 的矩陣,求相乘結果
-------------------------------------------------
範例: A與B都是2*2 的矩陣,求相乘結果
-------------------------------------------------
int[,] a = new int[3, 3];
int[,] b = new int[3, 3];
int[,] c= new int[3, 3];
a[1, 1] = 1;
a[1, 2] = 0;
a[2, 1] = 0;
a[2, 2] = 1;
b[1, 1] = 1;
b[1, 2] = 2;
b[2, 1] = 3;
b[2, 2] = 4;
c[1, 1] = a[1, 1] * b[1, 1] + a[1, 2] * b[2, 1];
c[1, 2] = a[1, 1] * b[2, 1] + a[1, 2] * b[2, 2];
c[2, 1] = a[2, 1] * b[1, 1] + a[2, 2] * b[2, 1];
c[2, 2] = a[2, 1] * b[2, 1] + a[2, 2] * b[2, 2];
-----------------------------------------------------------
How to: Convert a string to an int (C# Programming Guide)
----------------------------------------------------------------
int a=0, b=0, c=0;
String output;
a = int.Parse(textBox1.Text);
b=int.Parse(textBox2.Text);
c=a*b;
output = Convert.ToString(c);
textBox3.Text = output;
--------------------------------------------------------------
2.
在Fom1的clsss裡設定一個事件顯示另一個表單Fom2例如
Form2 newform;private void button1_Click(object sender, System.EventArgs e)
{
newform= new Form2();
newform.Show();
}
10月1日
物件: Form, textbox, label, button,
ListBox.
屬性: x.text
作業:
1. 利用 listbox 呈現99乘法表
提示:
' Add items to the ListBox.
listBox1.Items.Add("A")
2.
費波納西數列
等差数列
範例一 等差數列,首相、公差、末項
----------------------------------------------
----------------------------------------------
範例二 等差級數,求等差數列的和
----------------------------------------------
等差數列
----------------------------------------------
表單
//宣告
int a1,an,d,n,sn;
// 輸入
a1 =int.Parse (textBox1.Text);
d = int.Parse(textBox2.Text);
n = int.Parse(textBox3.Text);
//處理
an=a1+(n-1)*d;
sn = (a1 + an) * n / 2;
//顯示
textBox4.Text = ""+an;
textBox5.Text = "" + sn;
----------------------------------------------
9月24日
範例一 終端機畫面輸出
----------------------------------------------
static void Main(string[] args)
{
Console.WriteLine("Hellow");
}
------------------------------------------------
範例二
------------------------------------------------
int sum = 0;
for (int i = 1; i <= 10; i++)
{
sum = sum + 1;
Console.WriteLine("i="+i);
Console.WriteLine("sum=" + sum);
}
-------------------------------------------------
範例三
------------------------------------------------
static void Main(string[] args)
{
int sum = 0;
int[] arr1 = new int[101];
for (int i = 1; i <= 100; i++)
{
sum = sum + i;
Console.WriteLine("i="+i);
Console.WriteLine("sum=" + sum);
arr1[i]=sum;
}
for (int i = 1; i <= 9; i++)
{
for (int j = 1; j <= 9; j++)
{
Console.WriteLine( "i="+i+"j="+j );
}
}
}
------------------------------------------------
二維陣列 99乘法表
static void Main(string[] args)
{
int sum = 0;
int[,] arr1 = new int[10, 10];
for (int i = 1; i <= 9; i++)
{
for (int j = 1; j <= 9; j++)
{
sum = i * j;
arr1[i, j] = sum;
}
}
for (int i = 1; i <= 9; i++)
{
for (int j = 1; j <= 9; j++)
{
Console.WriteLine("i=" + i + ",j=" + j +",i*j="+ arr1[i, j]);
}
}
}
------------------------------------------------
9月17日
YouTube - C# with XNA - Tutorial 1 - Part 1
XNA tutorial for C# programmers
同學網址:
李佩姍 <orange52036@hotmail.com>
張琛詠 <thif456123@hotmail.com>
林宇樑 <david72123@gmail.com>
C語言考試重點