{"id":15103704,"url":"https://github.com/luozero-world/arithcard","last_synced_at":"2026-01-18T20:32:34.400Z","repository":{"id":199719694,"uuid":"703541576","full_name":"LuoZero-World/ArithCard","owner":"LuoZero-World","description":"算数卡牌对战游戏，CS模式","archived":false,"fork":false,"pushed_at":"2023-12-14T13:19:46.000Z","size":1282,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-12-15T12:43:31.875Z","etag":null,"topics":["javafx","netty"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LuoZero-World.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-10-11T12:41:53.000Z","updated_at":"2023-12-20T16:03:32.577Z","dependencies_parsed_at":"2023-12-20T16:03:26.754Z","dependency_job_id":null,"html_url":"https://github.com/LuoZero-World/ArithCard","commit_stats":null,"previous_names":["luozero-world/arithcard"],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuoZero-World%2FArithCard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuoZero-World%2FArithCard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuoZero-World%2FArithCard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LuoZero-World%2FArithCard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LuoZero-World","download_url":"https://codeload.github.com/LuoZero-World/ArithCard/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247335607,"owners_count":20922465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javafx","netty"],"created_at":"2024-09-25T19:41:33.118Z","updated_at":"2026-01-18T20:32:34.394Z","avatar_url":"https://github.com/LuoZero-World.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ArithCard\n\n### 项目背景\n\n大三协议设计原理，课程设计作业\n\nNetty+JavaFX\n\n### 项目介绍\n\n\u003e 自定义了一套卡牌对战规则，规则如下：\n\n- **牌型**\n  \n  数字牌：`1`、`2`、`3`…`13`，每张牌各**六张**\n\n  运算牌：`+`**八张**，`-`**四张**；`*`**八张**，`/`、`%`**两张**；`\u0026`、`|`、`^`**三张**；`\u003c\u003c`、`\u003e\u003e`**两张**\n\n- **玩法**\n  \n  凑24点：将手牌分为数字牌(1-13)，和运算牌，利用现有牌进行运算获得新的点数(超过24自动取余)，当得到24点时便可以**攻击/防御。**\n  \n  pvp：回合制游戏，每轮结束后对玩家状态进行运算，决定玩家扣除的血量；另外设置伤害制造器，固定回合对玩家造成部分伤害；直至一方玩家血量为0，游戏结束。\n\n\u003e 自定义协议\n\n![image](https://github.com/LuoZero-World/ArithCard/assets/99077678/ef2f01ea-261a-4120-91c4-cbbe9332d1ff)\n\n还有勉勉强强的卡牌UI，在`src/main/img`路径下就可以看到\n\n### 部署\n\n**服务端**\n\n先把服务端拉起来：启动类路径：`com.llq.server.CardServer`\n\n默认服务器IP：127.0.0.1\t端口18000\n\n然后拉客户端\n\n**客户端**\n\n启动类路径：`com.llq.client.CardClientStartUp`\n\n目前**只能登陆**，不能注册，其中账号信息以`Map`形式存储于内存中，其在项目中的位置`com.llq.server.service.UserService`\n\n客户端登录，进入游戏大厅：可创建对局，或加入现有对局(用JavaFX写的界面就这么样了，美化界面太搞了...orz)\n\n\u003cimg width=\"448\" alt=\"1697032199588\" src=\"https://github.com/LuoZero-World/ArithCard/assets/99077678/937f4147-bdfe-409e-8904-6380eaec4682\"/\u003e\n\n\u003cimg width=\"449\" alt=\"1697032220669\" src=\"https://github.com/LuoZero-World/ArithCard/assets/99077678/84e77a99-8193-4968-a871-4c48893934bf\"/\u003e\n\n### 亮点\n以下功能均为本人自认为还不错的实现，学生视角~\n- **断线保护**\n\n  当有玩家断线时，服务器识别并为之分配一个机器人线程接管断线玩家继续对局；若双方都断线则游戏结束\n\n- **多线程**\n\n  UI线程和Netty监听线程隔离管理\n\n- **网络间传递任务**\n\n  通常网络间的任务传递使用`Runnable`实现，但我在项目中采用`获取-反射执行`的方式，每个消息都有`executeIt`方法，里面表示获取该消息后应该执行的操作\n  具体细节见`com.llq.message.MessageService`中的`execMessage方法`\n\n- **消息有序**\n\n  虽然传输层使用了TCP，但因为客户端是另起了一个线程接收消息并执行相关操作，传过来的消息虽然有序，但在渲染到界面上时可能乱序\n  所以我直接将需要发送的消息收集为`List`，然后一起发送\n\n- **策略模式**\n\n  序列化有两种策略可以选择：Java原生序列化和Json序列化(Gson)\n\n- **单例模式**\n\n  `enum`实现单例\n\n### 未来计划\n1. 实时显示剩余牌数量\n2. 加入后端，springboot+mysql+MybatisPlus\n3. 完善出牌机器人的策略\n4. 观战功能\n\n### 联系\nQQ：1276602269\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluozero-world%2Farithcard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fluozero-world%2Farithcard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fluozero-world%2Farithcard/lists"}