GithubHelp home page GithubHelp logo

gobangbattlesystem's Introduction

五子棋对战系统(课设)

🎉基于Java GUI开发的五子棋对战系统

github地址:https://github.com/cocochimp/GobangBattleSystem

⚠⚠

近期发现有很多无良商家没有征得我的同意,私自盗取我的开源项目作为毕设、课设以及论文去高价卖!!!

如果有需要可以留言我并说明用意,如果有毕设项目、毕业论文、课设的用途,请私聊我

📚页面展示📚

进入大厅

当以有双方玩家进入游戏大厅后,第三个玩家进入游戏大厅,可以看见前面的玩家的座位信息和头像、姓名信息:

image-20230420110527315

image-20230420110535853

游戏对战页面

当对位存在对手时,一方点击“开始游戏”后,双方进入游戏对战界面

image-20230420110549069

image-20230420110556858

image-20230420110603112

聊天室

聊天室中,双方可实现聊天

image-20230420110610589

游戏过程

当双方点击“开始游戏”后,进入游戏模式

image-20230420110618429

胜利

当某方胜利时,对战双方客户端弹出弹窗

image-20230420110624989

认输

(6)当有一方在游戏过程中点击“认输”按钮后,出现弹窗“xxx认输,游戏结束”(和棋同理)

image-20230420110632224

响应逻辑

在五子棋界面中,主要有两个事件要将数据传入服务器进行处理并返回相应的信息给客户端进行响应:

1、当自己和对手都点击“开始游戏”按钮后,双方五子棋面板(客户端)与服务器进行“三次握手”,实现连接。服务器会随机给予一名玩家“棋权”,该玩家可下黑棋,下好棋后,将该点坐标存入相应数组(值为1),服务器通过遍历数组将所有点的坐标传回给自己与对手的客户端,客户端接收到坐标后通过画板将棋子位置绘制下来,然后交换“棋权”,并更换下棋颜色(白棋数组值为2);

2、在服务器中编写一个“判断五子棋胜利”的算法,通过遍历数组中的数据进行判断,当赢得游戏后,将该玩家的姓名传回给自己和对手,然后将服务器储存棋子坐标的数组全部设置为0,最后在自己和对手的客户端显示“xxx,赢得比赛”的弹窗,结束比赛。

gobangbattlesystem's People

Contributors

cocochimp avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.