分工
蒋梦迪:UI,博客
王德钊:AI,网络接口
PSP表格
PSP2.1 | Personal Software Process Stages | 预估耗时(分钟) | 实际耗时(分钟) |
---|---|---|---|
Planning | 计划 | 30 | 30 |
· Estimate | · 估计这个任务需要多少时间 | 30 | 30 |
Development | 开发 | 930 | 1110 |
· Analysis | · 需求分析 (包括学习新技术) |
240 | 300 |
· Design Spec | · 生成设计文档 | 90 | 90 |
· Design Review | · 设计复审 | 30 | 40 |
· Coding Standard | · 代码规范 (为目前的开发制定合适的规范) |
30 | 20 |
· Design | · 具体设计 | 90 | 60 |
· Coding | · 具体编码 | 360 | 480 |
· Code Review | · 代码复审 | 30 | 30 |
· Test | · 测试 (自我测试,修改代码,提交修改) |
60 | 90 |
Reporting | 报告 | 90 | 95 |
· Test Repor | · 测试报告 | 60 | 60 |
· Size Measurement | · 计算工作量 | 10 | 5 |
· Postmortem & Process Improvement Plan |
事后总结, 并提出过程改进计划 | 20 | 30 |
-- | 合计 | 1050 | 1235 |
解题思路
原本是打算用python或者其他语言实现,但是都没用过,重头学有点慢,所以想着用Unity3D来做,因为之前用过,而且UI和代码的对接比较方便。
算法的话,最简单的就是列举所有情况,用贪心算法暴力搜索。但是肯定不能止步于此,这样的话只保证后墩最大,中墩前墩其次,但是可能中前墩过小,赢不了牌,综合分数低。经过一番查询,觉得设置权重的方法比较靠谱。把每种牌型设置一个权重,然后综合考虑三墩,用权重和最大的一组牌作为最终结果。
网络接口
程序用Unity3D编写,使用U3D自带的UnityWebRequest
类实现网络接口的调用。此类有Get
和Post
方法,实现HTTP请求。举例如下:
using UnityEngine; using UnityEngine.Networking; using System.Collections; public class Example : MonoBehaviour { void Start() { //示例正确地址 StartCoroutine(GetRequest("https://www.example.com")); //错误地址(测试用) StartCoroutine(GetRequest("https://error.html")); } IEnumerator GetRequest(string uri) { using (UnityWebRequest webRequest = UnityWebRequest.Get(uri)) { //发送请求 yield return webRequest.SendWebRequest(); string[] pages = uri.Split('/'); int page = pages.Length - 1; if (webRequest.isNetworkError) { //发出错误提示 Debug.Log(pages[page] + ": Error: " + webRequest.error); } else { //输出收到的信息 Debug.Log(pages[page] + ":\nReceived: " + webRequest.downloadHandler.text); } } } }
代码实现
待补充...
遇到的困难
- HTTP请求完全没用过