难得明白
我只有代码,没有论文。。------------------------------import .*;import .*;import .*;class mypanel extends Panel implements MouseListener{ int chess[][] = new int[11][11]; boolean Is_Black_True; mypanel() { Is_Black_True = true; for(int i = 0;i < 11;i++) { for(int j = 0;j < 11;j++) { chess[i][j] = 0; } } addMouseListener(this); setBackground(); setBounds(0, 0, 360, 360); setVisible(true); } public void mousePressed(MouseEvent e) { int x = (); int y = (); if(x < 25 || x > 330 + 25 ||y < 25 || y > 330+25) { return; } if(chess[x/30-1][y/30-1] != 0) { return; } if(Is_Black_True == true) { chess[x/30-1][y/30-1] = 1; Is_Black_True = false; repaint(); Justisewiner(); return; } if(Is_Black_True == false) { chess[x/30-1][y/30-1] = 2; Is_Black_True = true; repaint(); Justisewiner(); return; } } void Drawline(Graphics g) { for(int i = 30;i <= 330;i += 30) { for(int j = 30;j <= 330; j+= 30) { (); (i, j, i, 330); } } for(int j = 30;j <= 330;j += 30) { (); (30, j, 330, j); } } void Drawchess(Graphics g) { for(int i = 0;i < 11;i++) { for(int j = 0;j < 11;j++) { if(chess[i][j] == 1) { (); ((i + 1) * 30 - 8, (j + 1) * 30 - 8, 16, 16); } if(chess[i][j] == 2) { (); ((i + 1) * 30 - 8, (j + 1) * 30 - 8, 16, 16); } } } } void Justisewiner() { int black_count = 0; int white_count = 0; int i = 0; for(i = 0;i < 11;i++)//横向判断 { for(int j = 0;j < 11;j++) { if(chess[i][j] == 1) { black_count++; if(black_count == 5) { (this, "黑棋胜利"); Clear_Chess(); return; } } else { black_count = 0; } if(chess[i][j] == 2) { white_count++; if(white_count == 5) { (this, "白棋胜利"); Clear_Chess(); return; } } else { white_count = 0; } } } for(i = 0;i < 11;i++)//竖向判断 { for(int j = 0;j < 11;j++) { if(chess[j][i] == 1) { black_count++; if(black_count == 5) { (this, "黑棋胜利"); Clear_Chess(); return; } } else { black_count = 0; } if(chess[j][i] == 2) { white_count++; if(white_count == 5) { (this, "白棋胜利"); Clear_Chess(); return; } } else { white_count = 0; } } }for(i = 0;i < 7;i++)//左向右斜判断 { for(int j = 0;j < 7;j++) { for(int k = 0;k < 5;k++) { if(chess[i + k][j + k] == 1) { black_count++; if(black_count == 5) { (this, "黑棋胜利"); Clear_Chess(); return; } } else { black_count = 0; } if(chess[i + k][j + k] == 2) { white_count++; if(white_count == 5) { (this, "白棋胜利"); Clear_Chess(); return; } } else { white_count = 0; } } } } for(i = 4;i < 11;i++)//右向左斜判断 { for(int j = 6;j >= 0;j--) { for(int k = 0;k < 5;k++) { if(chess[i - k][j + k] == 1) { black_count++; if(black_count == 5) { (this, "黑棋胜利"); Clear_Chess(); return; } } else { black_count = 0; } if(chess[i - k][j + k] == 2) { white_count++; if(white_count == 5) { (this, "白棋胜利"); Clear_Chess(); return; } } else { white_count = 0; } } } } } void Clear_Chess() { for(int i=0;i<11;i++) { for(int j=0;j<11;j++) { chess[i][j]=0; } } repaint(); } public void paint(Graphics g) { Drawline(g); Drawchess(g); } public void mouseExited(MouseEvent e){} public void mouseEntered(MouseEvent e){} public void mouseReleased(MouseEvent e){} public void mouseClicked(MouseEvent e){} }class myframe extends Frame implements WindowListener{ mypanel panel; myframe() { setLayout(null); panel = new mypanel(); add(panel); (0,23, 360, 360); setTitle("单人版五子棋"); setBounds(200, 200, 360, 383); setVisible(true); addWindowListener(this); } public void windowClosing(WindowEvent e) { (0); } public void windowDeactivated(WindowEvent e){} public void windowActivated(WindowEvent e){} public void windowOpened(WindowEvent e){} public void windowClosed(WindowEvent e){} public void windowIconified(WindowEvent e){} public void windowDeiconified(WindowEvent e){}}public class mywindow{ public static void main(String argc []) { myframe f = new myframe(); }}
楼上翻译得真好玩。尤其赞“I Wuziqi games”这句,这年头google的翻译还是信不过的。
分条写:课题做到突出中心思想,条理清晰,结构合理,观点正确,具有较好的连续性等。完成相关的XXXX。 第一步:课题适应的岗位名称; 第二部:课题背景; 第三步,
我只有代码,没有论文。。------------------------------import java.awt.*;import java.awt.even
时光匆匆,我们在忙碌中奔走,一段时间的工作已告一段落,我们的工作又将迎来新的任务和目标,是不是要好好写一份策划书了。策划书怎么写才合适呢?以下是我收集整理的大学
可以的!之所以叫BP网络,是因为使用了反向传递算法,这是一种结果导向的自学习方法,用在五子棋上是可以的。因为五子棋的游戏方法正是很明显的结果导向的过程。简单说这