JAVA黑白棋 毕业设计论文
- 格式:pdf
- 大小:442.75 KB
- 文档页数:26
摘要目前,随着计算机网络的发展,以计算机技术和网络技术为核心的现代网络技术已经在现实生活和生产中得到了广泛的使用,休闲类网络游戏集趣味性,娱乐性,互动性和益智性于一体,已经成为多数人群的休闲方式,也为多数人所喜好。
本设计收集了关于JAVA基础的书籍,着重收录了关于SOCKET编程的内容,找到了五子棋概述和规则的资料,查阅了网络通信技术的相关论文,同时也参考了很多关于五子棋实现的程序资料以及关于JAVA开发工具的介绍的文档。
在期间,作者学习了多线程技术、数据传输技术、SOCKET编程技术,研究了网络通信原理、JAVA编写原理等一系列的原理。
开发了五子棋网络对战的代码,实现了网络聊天、联机对战、网络通信、界面组织如:棋盘、建立服务器、连接到服务器等功能。
通过对以上技术的学习和研究,利用SOCKET编程,能服务器与客户端之间的连接,利用多线程技术完成了服务器端与客户端之间的数据传输、网络通信,使得两个客户端能够同步的进行处理。
关键词: JAVA 多线程 SOCKET 五子棋AbstractAt present , with the development of computer networks , computer and network technology as the core of modern network technology has been widely used in real life and production, the casual game set interesting , entertaining, interactive and puzzle in one, has become the majority population of leisure, but also for the majority of people have preferences.The design of the collection of books on the JAVA -based , focusing on the collection of content SOCKET programming , found the data overview and backgammon rules , access to the network communication technology related papers also refer to a lot of information on backgammon program implementation as well as on document describes the JAVA development tools . In the meantime, I learned the multi-threading technology, data transmission technology , SOCKET programming technique to study the principle of network communication , JAVA write a series of principles such as the principle . Developed backgammon online play code implements online chat , online gaming, network communications, interface organizations such as : the board , establish a server , connect to the server and other functions. Through the above technical study and research , the use SOCKET programming, connections between the server and client can use multi-threading technology to complete the data transfer between the client and the server , and network communication , so that both the client can synchronize for processing.Keywords:JAVA multithreading SOCKET Gobang目录1 绪论 (1)1.1 背景及意义 (1)1.2 选题的目的 (1)1.3 五子棋介绍 (2)1.4 主要完成内容 (2)2 开发环境及工具介绍 (3)2.1 开发环境及运行环境 (3)2.1.1 开发环境 (3)2.1.2 运行环境 (3)2.1.2 开发工具 (3)2.2 Java 简介 (3)2.2.1 Java的起源和发展 (3)2.2.2 Java特点 (4)2.3 Java Socket网络编程简介 (5)2.3.1 Java Socket 网络编程基础 (5)2.3.2 Socket编程的实现 (6)2.4 Java 图形编程 (7)2.5多线程机制 (7)3 需求分析和总体设计 (9)3.1 需求分析作用 (9)3.1.1 界面需求分析 (9)3.1.2 软件需求分析 (9)3.2 总体设计 (9)3.2.1 系统设计思想 (10)3.2.2 系统总体设计 (10)3.3 功能模块及流程 (11)3.3.1 系统主要模块 (11)3.3.2服务器端作用 (12)3.3.3客户端作用 (13)4 详细设计及实现 (15)4.1 系统主流程 (15)4.2 如何判断输赢 (16)4.3 开发环境的搭建 (19)4.4 功能模块的界面实现 (20)5 软件的测试 (23)5.1 软件测试的方法 (23)6 总结语 (25)参考文献 (26)1 绪论1.1 背景及意义1.背景随着经济社会的迅速发展,人们生活水平有了很大的提高,人们的生活观念也发生了巨大的改变。
1引言随着计算机技术的不断发展,网络技术的普及范围越来越广,网络能够提供的服务多样、便捷,已经成为人们生产生活中不可缺少的重要组成部分。
如今网络休闲游戏发展迅速,它凭借健康、方便、互动性强、益智等诸多优点,成为大部分现代人休闲娱乐的首选。
网络五子棋游戏是使用Java语言开发的一款游戏。
它使用SOCKET建立连接,多线程处理数据,以及可嵌入网络浏览器的APPLET作为客户端,这些特点使这款游戏无论是服务器还是客户端的实现都相对容易。
通过对该软件的编写,还可以巩固学生对以上各种知识的掌握和理解。
2 JAVA语言概述2.1 JAVA简介JAVA是Sun Microsystem公司开发的编程语言,是一个简单,面向对象,分布式,解释性,强壮,安全,与系统无关,可移植,高性能,多线程和动态的语言。
2.1.1 JAVA的基本特点(1) 简单性Java与C++语言非常相近,但Java比C++简单,它抛弃了C++中的一些不是绝对必要的功能,如头文件、预处理文件、指针、结构、运算符重载、多重继承以及自动强迫同型。
Java实现了自动的垃圾收集,简化了内存管理的工作。
(2) 面向对象Java提供了简单的类机制和动态的构架模型。
对象中封装了它的状态变量和方法,很好地实现了模块化和信息隐藏;而类则提供了一类对象的原型,通过继承和重载机制,子类可以使用或重新定义父类或超类所提供的方法,从而既实现了代码的复用,又提供了一种动态的解决方案。
(3) 多线程多线程使应用程序可以同时进行不同的操作,处理不同的事件。
在多线程机制中,不同的线程处理不同的任务,他们之间互不干涉,不会由于一处等待影响其他部分,这样容易实现网络上的实时交互操作。
(4) 分布性Java是面向网络的语言。
通过它提供的类库可以处理TCP/IP协议,用户可以通过URL地址在网络上很方便的访问其他对象。
(5) 体系结构中立Java是一种网络语言,为使Java程序能在网络的任何地方运行,Java解释器生成与体系结构无关的字节码结构的文件格式。
南开大学滨海学院本科生毕业论文(设计)中文题目:JA V A五子棋外文题目:JA V A Backgammon作业名称:JA V A五子棋学号:12990147、12990187姓名:黄宇、徐相如年级:2012 级系别:计算机科学系专业:数字媒体技术(数字影视动画技术与运用方向)完成日期:2015年1月12日指导教师:刘嘉欣南开大学滨海学院本科论文(设计)诚信声明本人郑重声明:所呈交的毕业论文(设计),题目《JA V A五子棋》是本人在指导教师的指导下,独立进行研究工作所取得的成果。
对本文的研究做出重要贡献的个人和集体,均已在文中以明确方式注明。
除此之外,本论文不包含任何其他个人或集体已经发表或撰写过的作品成果。
本人完全意识到本声明的法律结果。
毕业论文(设计)作者签名:黄宇、徐相如日期:2015年1月12日JA V A五子棋摘要五子棋是一种两人对弈的纯策略型棋类游戏,是起源于中国古代的传统黑白棋种之一。
发展于日本,流行于欧美。
容易上手,老少皆宜,而且趣味横生,引人入胜;不仅能增强思维能力,提高智力,而且富含哲理,有助于修身养性。
如今,JAVA以其独特的可移植性,跨平台性,程序体积小等多个特点成为现今网络上最流行的脚本语言。
Java的跨平台性使它应用于无线手持设备、通讯终端、信息家电等多种热门领域。
Java在多种行业的备受推崇使Java悄然融入日常生活的每一角落。
为了熟悉五子棋的规则以及技巧,与同学,电脑之间进行相互的博弈,决定用JAVA制作一个能实现局域网对战,人机对战功能的五子棋对战程序。
使用JAVA语言开发的五子棋游戏程序,将五子棋游戏移植到网络中更符合现代人娱乐理念,实现单机和双人对战的游戏模式,也可以在游戏当中进行聊天,便于用户实时进行信息交流。
关键字:JAVA游戏,局域网对战,人机对战,聊天,五子棋。
JA V A BackgammonAbstractsBackgammon is a two games on pure strategy board games originated in ancient China's traditional Othello. Development in Japan, popular in Europe and the United States. Easy to use, all ages, amusing, fascinating; not only enhance the thinking ability, intelligence, and rich in philosophy, and to help self-cultivation. Today, JAVA its unique portability, cross-platform, the program, small size and other characteristics become the most popular scripting language on the network today. Java's cross-platform so that it applied to wireless handheld devices, communication terminals, information appliances, and other hot areas. Java in a variety of industries highly respected Java quietly into every corner of daily life. Familiar with the rules and skills of backgammon, Between students with each other or a computer game, decided to create a LAN Battle and man-machine war Backgammon Battle program with JAVA. Backgammon games using JAVA language development program, the backgammon game ported to the network more in line with the concept of modern entertainment, stand-alone and double play against the game mode, you can also chat in the game, whisper chat features such as user-friendly real-time exchange of information.Key words:JAVA games, LAN gaming, human-computer gaming,chat, algorithm目录摘要 (3)Abstracts (4)第一章绪论 (7)背景 (7)第二章开发工具与语言简介 (8)2.1 Java简介 (8)2.2 Eclipse开发环境简介 (9)2.3 JAVA的优缺点 (10)第三章程序的源代码与实现 (12)3.1 界面 (12)3.1.1 按钮 (12)3.1.2 棋盘与棋子实现 (12)3.1.3 文本框代码 (14)3.1.4 布局 (14)3.2 按钮功能实现 (16)3.2.1 监听 (16)3.2.2 连接 (17)3.2.3 认输 (17)3.2.4 新游戏 (19)3.2.5 悔棋................................ 错误!未定义书签。
黑白棋游戏摘要本课题设计一个黑白棋游戏系统,游戏通过相互翻转对方的棋子,最后以棋盘上谁的棋子多来判断胜负。
它的游戏规则简单上手很容易,但是它变化又非常复杂。
我选择这个题目做设计,一方面是巩固和提高以前所学C语言知识,另一方面是因为这可能是我第一次完成一个软件的系统设计,选择一个中等难度且相对成熟的软件来设计既易于实现又留有一定的上升空间,符合我的实际情况。
我所设计的这种黑白棋游戏有几个特点:程序短小精悍简洁明了,游戏界面美观,功能丰富容易操作,趣味性强。
关键词: 程序设计;C语言;黑白棋;两人对弈The black and white chess(Department of electronic and Information Engineering Ankang university)Directed by Chen ShoumanAbstract:This topic is to design a Reversi game system. The game flips through each other's game pieces. And last the people who has more chess pieces than the other, will win. The game rules are simple and easy to use. But It changes very complex. I choose this topic to do the design, one is the consolidation and improvement of previously learned C language knowledge, on the other hand, is because it is my first time to complete a software system design. Selection of a medium difficulty and relatively mature software design is easy to implement and have certain ascendant space. It’s fit in with my actual situation. I designed this game has several characteristics: Dappering procedures concise. The game interface aesthetics. The function is rich and easy to operate.Much interesting.Key word:Program design. C language. The black and white chess. Chess1 引言我国是棋文化的发祥地之一,上古的尧时代围棋就在我国诞生了,在随后的几千年长河里,我国人民不断以自己的聪明才智创造出深受人们喜爱的棋类游戏,像中国象棋、五子棋、军棋等等一直是在民间很流行的棋类项目。
大连科技学院Java课程设计报告题目黑白棋小游戏学生姓名专业班级指导教师职称讲师所在单位教研室主任目录1.总体设计 (1)1.1功能要求 (1)1.2 系统性能要求 (1)2.总体设计 (1)2.1系统功能模块划分 (1)3.详细设计与实现 (4)3.1 测试分析 (4)附录1 软件源程序 (5)课程设计实践总结: (17)1.总体设计1.1功能要求本系统按课程设计指导书提供的课题,要求学生在自行完成各个操作环节,并能实现且达到举一反三的目的,完成一个项目解决一类问题。
要求学生能够全面、深入理解和熟练掌握所学内容,并能够用其分析、设计和解答类似问题;对此能够较好地理解和掌握,能够进行简单分析和判断;能编写出具有良好风格的程序;掌握JA V A程序设计的基本技能和面向对象的概念和方法;了解多线程、安全和网络等编程技术。
同时培养学生进行分析问题、解决问题的能力;培养学生进行设计分析、设计方法、设计操作与测试、设计过程的观察、理解和归纳能力的提高。
1.2 系统性能要求能够完整完成黑白棋游戏的对弈2.总体设计2.1系统功能模块划分为了实现黑白棋游戏的开发,通过流程图的分析,计划采用以下几大模块。
1、绘图模块:本模块用来负责主界面的绘制,包括棋盘、棋子、棋子个数的显示、以及其它需要显示的部分。
2、人机模块:人机模块是本程序得以运行的基础,并通过规则模块决定能否下子。
3、规则模块:本模块主要负责判断下棋是否符合规则。
4、按键模块:本模块通过判断用户按键的位置,判断出该坐标所处棋盘中响应位置。
2.2 游戏流程图图2.2-1落棋位置判图2.2-2输出成绩图2.2-3胜利结果3.详细设计与实现3.1 测试分析程序运行结果图3.1-1 开始界面图3.1-2 结束界面T参考文献[1] 王克宏编著JA V A语言入门清华大学出版社1996[2] 旭日工作室编著Java 1.1使用大全电子工业出版社1998[3][美]Cay S.Horstmann 程峰等译JA V A2核心技术机械工业出版社2003.6[4] Horstmann C S,Cornell G著Java2核心技术机械工业出版社2008.10[5] 马凡李璠编著JavaScript实例应用中国铁道出版社2001.01[6]朱喜福JA V A程序设计(第二版)上海:人民邮电出版社2007.3[7] 林胜利王坤茹JA V A优化编程(第二版)北京:电子工业出版社2008.10[8] 马军JA V A完全自学手册北京:机械工业出版社2006.5[9] 袁海燕王文涛编著JAVA实用程序设计上海:人民邮电出版社2009.11[10] 刘宝林程序设计与案例上海:高等教育出版社2004.6[11] 马凡李璠编著JA V A核心技术北京:机械工业出版社2000.8[12] 王克宏编著JA V A语言Applet编程技术北京:清华大学出版社2005.3[13] 施霞萍Java程序设计教程第2版机械工业出版社2006-6[14] 宛延闿实用Java程序设计教程机械工业出版社2006-1[15] 陈国君Java2程序设计基础清华大学出版社2006-8附录1 软件源程序import java.awt.*;import java.awt.event.*;import java.io.*;import .*;import javax.swing.*;import java.util.*;import java.awt.Font;public class Main{public static void main(String args[]){BlackAndWhiteDesign b = new BlackAndWhiteDesign();}}class BlackAndWhiteDesign extends Frame implements Runnable{ Go Background = new Go();boolean stepColor = true;int PORT;Socket sendSocket;//主动连接SocketPrintWriter writer;//用来发送messageboolean stopFlag;boolean isInitiative;Point messagePoint;Panel panel1 = new Panel();Panel panel2 = new Panel();Panel panel3 = new Panel();CheckboxGroup checkboxGroup1 = new CheckboxGroup();Checkbox checkbox1 = new Checkbox();Checkbox checkbox2 = new Checkbox();Label label1 = new Label();TextField textField1 = new TextField(10);Panel PtextField1 = new Panel();Button button1 = new Button();Label label2 = new Label();Choice choice1 = new Choice();Button button2 = new Button();Button button3 = new Button();BorderLayout borderLayout3 = new BorderLayout();Panel panel4 = new Panel();Panel panel4_1 = new Panel();Panel panel4_2 = new Panel();Panel panel4_3 = new Panel();Label label3 = new Label("黑棋");Label label4 = new Label("白棋");JTextArea BlackNumber = new JTextArea("02"); //定义并初始化黑棋计数板JTextArea WhiteNumber = new JTextArea("02"); //定义并初始化白棋计数板BlackAndWhiteDesign(){try{bwInit();}catch(Exception e){e.printStackTrace();}}private void bwInit() throws Exception{this.setTitle("网络黑白棋作者:刘茂龙");new Thread(this).start();//启动监听线程this.PORT = 1976;this.isInitiative = false;//是否主动连接this.stopFlag = false;//是否继续监听的标志this.messagePoint = new Point();choice1.setBackground(new Color(236, 190, 98)); this.choice1.addItem("黑");this.choice1.addItem("白");this.setBackground(new Color(236, 190, 98)); this.setSize(580,565);this.setResizable(false);this.setVisible(true);checkbox1.addMouseListener(new MouseAdapter() {public void mouseClicked(MouseEvent e){checkbox1_mouseClicked(e);}});panel1.setLayout(new BorderLayout()); checkbox1.setCheckboxGroup(checkboxGroup1); checkbox1.setLabel("单机");checkbox2.addMouseListener(new MouseAdapter() {public void mouseClicked(MouseEvent e){checkbox2_mouseClicked(e);}});checkbox2.setCheckboxGroup(checkboxGroup1); checkbox2.setLabel("联机");label1.setText("对方地址");button1.setBackground(new Color(236, 190, 98)); button1.setLabel("连接");button1.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e){button1_actionPerformed(e);}});label2.setText(" ");button2.setBackground(new Color(236, 190, 98)); button2.setLabel("开始");button2.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e){button2_actionPerformed(e);}});button3.setBackground(new Color(236, 190, 98)); button3.setLabel("重新开始");this.button3.setEnabled(false);button3.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent e){button3_actionPerformed(e);}});Background.addMouseListener(new MouseAdapter() {public void mouseClicked(MouseEvent e){Background_mouseClicked(e);}});this.addWindowListener(new WindowAdapter() {public void windowClosing(WindowEvent e){this_windowClosing(e);}});panel3.setLayout(new GridLayout(9, 1));panel3.setBackground(new Color(236, 190, 98)); panel3.add(checkbox1);panel3.add(checkbox2);panel3.add(label1);PtextField1.add(textField1);panel3.add(PtextField1);panel3.add(choice1);panel3.add(button1);panel3.add(button2);panel3.add(button3);panel3.add(label2);panel4.setLayout(new GridLayout(1, 3));label3.setFont(new Font("h",15,30));panel4_1.add(label3);BlackNumber.setFont(new Font("h",15,30));BlackNumber.setEditable(false);panel4_1.add(BlackNumber);label4.setFont(new Font("h",15,30));panel4_2.add(label4);WhiteNumber.setFont(new Font("h",15,30));WhiteNumber.setEditable(false);panel4_2.add(WhiteNumber);panel4.add(panel4_1);panel4.add(panel4_2);panel4.add(panel4_3);this.panel1.add(this.Background,BorderLayout.CENTER);this.panel1.add(panel3, BorderLayout.EAST);this.panel1.add(panel4, BorderLayout.SOUTH);this.add(panel1, BorderLayout.CENTER);this.disableLink();//废掉控件this.checkboxGroup1.setSelectedCheckbox(this.checkbox1);this.centerWindow();this.Background.setEnabled(false);this.setVisible(true);}void checkbox1_mouseClicked(MouseEvent e){this.button2.setEnabled(true);this.disableLink();//disable联机时用的控件void disableLink(){this.textField1.setBackground(new Color(236, 190, 98));this.textField1.setEnabled(false);this.choice1.setEnabled(false);this.button1.setEnabled(false);}void checkbox2_mouseClicked(MouseEvent e){this.enableLink();}void enableLink(){this.textField1.setBackground(Color.white);this.textField1.setEnabled(true);this.choice1.setEnabled(true);this.button1.setEnabled(true);this.button2.setEnabled(false);}void button1_actionPerformed(ActionEvent e){this.stopFlag = false;this.goToLink(this.textField1.getText().trim(),this.PORT);this.button2.setEnabled(true);//开始void button2_actionPerformed(ActionEvent e){if(e.getActionCommand().equals("开始")){this.stopFlag = false;this.disableLink();this.button3.setEnabled(true);this.checkbox1.setEnabled(false);this.checkbox2.setEnabled(false);this.button2.setLabel("退出");if(this.isSingle())this.Background.setEnabled(true);//判断类型boolean isSingle(){return this.checkbox1.getState();}void button3_actionPerformed(ActionEvent e){if (isSingle()){int Choose;Choose=JOptionPane.showConfirmDialog(null, "您确定要重新开始吗?", "提示", JOptionPane.YES_NO_OPTION);if (Choose == JOptionPane.YES_OPTION){this.Background.Restart();String s1, s2;if (this.Background.BlackNumberc<=9) s1="0"+Integer.toString(this.Background.BlackNumberc);else s1 = Integer.toString(this.Background.BlackNumberc);if (this.Background.WhiteNumberc<=9) s2="0"+Integer.toString(this.Background.WhiteNumberc);else s2 = Integer.toString(this.Background.WhiteNumberc);this.BlackNumber.setText(s1);this.WhiteNumber.setText(s2);this.button1.setEnabled(false);this.button2.setLabel("开始");this.button3.setEnabled(false);this.checkbox1.setEnabled(true);this.checkbox2.setEnabled(true);this.clearMyColor();this.Background.setEnabled(false);this.stepColor = true;}}else this.writer.println("clear");}//显示错误信息void showError(String errorMessage){Graphics g=this.getGraphics();g.setColor(new Color(236,190,98));g.fillRect(10,10,300,15);g.setColor(Color.red);g.drawString(errorMessage,22,20);g.fillOval(10,10,10,10);}private void bwInit() throws Exception{this.setBackground(new Color(236, 190, 98));}}class Listen extends Thread{Socket socket;BlackAndWhiteDesign BlackAndWhiteDesign;public Listen(Socket socket,BlackAndWhiteDesign BlackAndWhiteDesign){this.socket=socket;this.BlackAndWhiteDesign=BlackAndWhiteDesign;}public void run(){try{this.activeListen(this.socket);}catch(IOException ioe){this.BlackAndWhiteDesign.Background.showError("意外中断");} }void activeListen(Socket socket) throws IOException{BufferedReader reader=new BufferedReader(new InputStreamReader(socket.getInputStream()));String message;while(true){message=reader.readLine();this.BlackAndWhiteDesign.doMessage(message);}}}课程设计实践总结:课程设计总结:通过这次毕业设计,对很多东西有了新的认识和新的见解,认识问题的和思考解决办法有了本质上的进步,特别是对一个游戏开发的模式有了更深的认识,对专业技能的运用更熟练。
毕业设计基于安卓系统的黑白棋游戏的设计与实现学院:专业:学号:学生姓名:指导教师:2016.4.18黑白棋游戏的设计与实现摘要随着技术的发展,手机越来越普遍,安卓智能平台越来越完善,成为手机的主流系统。
千元智能机的出世,智能机替代传统功能机的趋势将日益明显,安卓系统则占领了主导地位。
该文描述了在安卓模拟器下实现实现了黑白棋游戏的功能。
关键词安卓;安卓系统;游戏;黑白棋;安卓开发The design and implementation of the black and white chess game Abstract with the development of technology, mobile phones are becoming more and more common, Android intelligent platform is becoming more and more perfect, and become the mainstream of the mobile phone system. Thousands of intelligent machines was born, intelligent machines replace the traditional features of the trend will become increasingly apparent, Android system has occupied the dominant position. This paper describes the realization of the function of the black and white chess game in Android simulator.Keywords Android; Android system; game; black and white chess; Android development前言2007年11月,Google推出了一种由操作系统,中间件,用户友好应用软件组成的智能手机平台安卓。
本文部分内容来自网络整理,本司不为其真实性负责,如有异议或侵权请及时联系,本司将立即删除!== 本文为word格式,下载后可方便编辑和修改! ==黑白棋实验报告篇一:黑白棋程序设计实验报告C++版海南大学课程论文课程名称:数据结构课程设计题目名称:黑白棋姓名:学号:评阅教师:201X年 12月 17 日目录一、黑白棋简介 (2)二、程序设计思路及实现界面图 (3)三、程序设计算法性能分析 (6)四、实验总结 (6)五、实验代码 (7)一、黑白棋简介黑白棋,又叫反棋(Reversi)、奥赛罗棋(Othello),苹果棋,翻转棋。
黑白棋的棋子和围棋类似。
但它的下法与围棋的很不相同。
黑白棋是由黑方和白方两人进行的益智游戏。
棋盘为N×N方格,黑白棋总共使用N个棋子,每个棋子分正反两面,分别是黑色和白色。
轮到一方下棋时,必须把棋下在与对方棋子相邻的空位上,要求所下的棋子和原有的已方棋子夹住对方的至少一个棋子(横竖斜夹均可),然后把被夹住的子变成己方的颜色(也叫吃子)。
下棋过程中,任何棋子既不会从棋盘上拿走,也不会从一个格子移到另一个格子,吃子时,不会发生连锁反应,吃进的棋子不能再夹吃其他的子。
当双方都无棋可下,或者方格全部占满后,棋局结束,子多的一方为胜方。
2二、程序设计思路及游戏实现界面1、设计初始化棋盘函数2、复制棋盘函数3、显示棋盘函数4、选择下棋类型4、计算可落子的位置个数,及该位置落子后翻过的棋子的个数5、设置棋子的稳定性(计算得分的依据),空白处除外6、评价棋手得分游戏开始选择类型和棋子:打印棋盘棋手开始下棋输入下棋的位置:游戏结束,统计棋数并分出胜负:篇二:C语言-黑白棋实验报告福建工程学院计算机与信息科学系实验报告12345篇三:黑白棋课程设计报告惠州经济职业技术学院计算机专业课程设计报告课题名称:关于黑白棋游戏的设计专业:班级:组长: XXX小组成员:二O一O年十二月摘要中国最早出现黑白棋是在80年代的任天堂游戏机和苹果II个人电脑游戏里,但从那时一直玩到现在的人已经寥寥可数了,我们只能说,从那时起,中国第一次出现了黑白棋;然后就是1990年的Windows 3.0的推出,当时Windows自带的游戏就是黑白棋,由于当时电脑还比较少,没等到黑白棋传开,Windows 3.1推出,把自带游戏换成现在大家见到的踩地雷和接龙;让大量人认识黑白棋的是文曲星,文曲星的黑白棋棋力很低,一个人下了几盘以后就可以轻易把它打败,棋力之低简直可以说是误人子弟的地步,让人一叶障目,不见森林,以为黑白棋不过尔尔;在90年代中期流行的任天堂Gameboy当中也有一款黑白棋游戏,棋力甚为不错,比起以上提及的游戏强很多。
JAVA黑白棋程序设计文档计算机科学与技术0303 陈和福 3032112078计算机科学与技术0302 陈涛 3032112041计算机科学与技术0301 毛华坚 3032112016Contents1.确定需求: (3)2.分析和分解: (3)3.详细设计: (3)3.1主要功能3.2 实现方法4. 安装(部署)方法 (8)5. 合作的说明各成员分工 (8)本程序是一个用JA V A写的黑白棋小游戏,用Jcreator 编译后可以运行。
运行时的操作系统为Microsoft 的 Windows 系列,内存要求32M以上。
运行时要求该机器安装了JA V A 虚拟机。
1.确定需求:根据老师对期末程序提交的要求,该程序须为一个C/S结构的JA V A小程序。
根据这一要求,我们所做的主要工作是写了一个可以用于网络连机对战的黑白棋程序。
该程序很好的实现了在网络平台下的连机对战。
2.分析和分解:由于该程序是我们三个人共同开发的一个小游戏,为了方便程序间的更好连接,我们采用了各个模块的设计,在设计过程中并没有直接使用绝对坐标。
该程序包含了用于画棋盘的ChessBPanel 类以及用于记录和显示棋子的ChessBoard 类,一个用于提醒时间的Clock类,一个用于提示当前棋盘棋子个数的Message类和一个用于定义各种类型的Type类。
程序的main() 方法定义在BWChess类中,程序主要通过BWChess类实现。
3.详细设计:3.1:主要功能:该黑白棋游戏主要可以实现黑白棋网络平台的对战,同时附加了聊天功能,在游戏的过程中也可以显示对战双方的当前的棋子个数,提醒对战双方的时限。
同时,该游戏还具有悔棋和认输的功能。
作为该游戏的扩展,我们考虑了人机对战,以及设置了观战模式。
同时,为了使游戏的更人性化,我们特别添加了听音乐的控件。
但由于时间紧迫,这些扩展功能我们并没有能去实现,只是在我们的程序中提供了这些扩展功能的接口。
基于Java的五子棋游戏的设计摘要五子棋作为一个棋类竞技运动,在民间十分流行,为了熟悉五子棋规则及技巧,以及研究简单的人工智能,决定用Java开发五子棋游戏。
主要完成了人机对战和玩家之间联网对战2个功能。
网络连接部分为Socket编程应用,客户端和服务器端的交互用Class Message定义,有很好的可扩展性,客户端负责界面维护和收集用户输入的信息,及错误处理。
服务器维护在线用户的基本信息和任意两个对战用户的棋盘信息,动态维护用户列表。
在人机对弈中通过深度搜索和估值模块,来提高电脑棋手的智能。
分析估值模块中的影响精准性的几个要素,以及提出若干提高精准性的办法,以及对它们搜索的节点数进行比较,在这些算法的基础上分析一些提高电脑AI方案,如递归算法、电脑学习等。
算法的研究有助于理解程序结构,增强逻辑思维能力,在其他人工智能方面也有很大的参考作用。
关键词:深度搜索;估值;电脑AI;五子棋;算法Gobang Java-based games designAbstractAs a sport, gobang is very popular in civil, in order to become familiar with gobang rules and techniques, and the study of simple artificial intelligence, I decide to use the Java to develope gobang games and complete the two functions including man-machine war and man-man war. Network Connection is Socket Programming for some applications, client and server interaction is definited by Class Message, which is a very good scalability, Client interface is responsible for the collection and maintenance of user input information, and error handling. Server users maintain online basic information and arbitrary two-time users of the chessboard of information, dynamic maintenance user list. During the man-machine players, it improves intelligence of the computer players through depth search and valuation module. Analyzes Module valuation of the precise elements, as well as a number of increased precision, and compares their search for nodes, which raises some computer AI programs on the basis of analysis, such as recursive algorithm, computer learning. Algorithm of procedures contribute to the understanding of the structure, logical thinking ability, In other areas of artificial intelligence has great references..Key words:Search depth; Valuation; Computer AI; Gobang ; Algorithm目录论文总页数:23页1 引言 (1)1.1课题背景 (1)1.2本课题研究的意义 (1)1.3本课题的研究方法 (2)2 课题相关基础 (2)2.1五子棋 (2)2.1.1棋盘和棋子 (2)2.1.2规则及解释 (3)2.1.3五子棋常用术语 (4)2.1.4五子棋攻防 (7)3 JA V A (8)3.1J AVA简介 (8)3.2J AVA开发环境 (9)4 课题详细研究方法 (10)4.1程序结构说明 (10)4.2棋盘及棋子的类 (11)4.2.1棋盘 (11)4.2.2棋子 (13)4.3胜负判断条件 (13)4.4网络对战 (15)4.5电脑AI (17)结论 (21)参考文献............................................................................................................错误!未定义书签。