LAB 2-2 Bobing mini-program

DIMOO 2022-11-18 23:12:30

img

The Link Your Classhttps://bbs.csdn.net/forums/MUEE308FZU202201
The Link of Requirement of This Assignmenthttps://bbs.csdn.net/topics/608859318
MU STU ID and FZU STU IDFZU:832001117_MU:20123141
Teammate's MU STU ID and FZU STU IDFZU:832001130_MU:20124805
Teammate's blog linkhttps://bbs.csdn.net/topics/609330339
GitHub linkhttps://github.com/DIMOOOOOOO/Bobing-mini-program
Video demo linkhttps://www.bilibili.com/video/BV1824y127Dc/?vd_source=ef92c6ecb7127b4dfb22909cc083771c

catalogue

  • 1 . PSP Form
  • 2 . Learning Process Bar
  • 3 . Programming Thinking and Key Functions
  • - 3.1 Programming Thinking
  • - 3.2 Key and difficult functions
  • 4 . Three major revenue events.
  • - 4.1 Thoughts on the implementation logic of Bo Bing program.
  • - 4.2 Writing key parts of the code.
  • - 4.3 Understanding of view layer and learning JS language to finish UI interface
  • 5 . The Pair Programming Photos & Experience
  • - 5.1 Pair Programming Experience
  • - 5.2 Pair Programming Photos
  • 6 . Final results
  • 7 . Commit History
  • Summary

1 . PSP Form

Personal Software Process StageEstimated Time/minutesActual Time/minutes
Planning6090
Estimate3060
Development5040
Analysis4590
Design Spec--
Design Review--
Coding Standard120180
Design6060
Coding10801600
Code Review Planning180180
Test7201180
Test Report2020
Size Measurement1010
Postmortem&Process Improvement3030
total24053540

2 . Learning Process Bar

DayNew Code
(Line)
Cumulative code
(Line)
Learning time this week
(hours)
Total Learning time
(hours)
Important
growth
15455456.06.0Have a preliminary understanding and understanding
of the experimentand begin to write the code
267512207.513.5Learned adapted page buttons and designed them
388021001124.5Write key parts of the function code
432024204.529.0Improve the code of all parts of the applet to ensure the
normal implementation of all functions of the applet
559330136.535.5Refine the code for the functional part of the applet and beautify the page
619432073.036.5Test and debug the code and complete the last step: Publish the applet

3 . Programming Thinking and Key Functions

- 3.1 Programming Thinking

  Since it is the first time for both of our teams to create a fully functional software, after reviewing a lot of information on this topic, we feel that without basic knowledge, it is difficult for us to achieve a complete front-end and back-end software within a week. We learned that the WeChat applet development framework is relatively easy to get started, so we decided to use the WeChat applet developer tool as the development tool.
 
  First of all, we started to follow the teaching videos on the learning website to learn the use of wechat development tools and the code specifications and grammar styles of different files, and gradually completed the front-end page through continuous experiments and exploration. (In the process, I asked myself for the umpteenth time "Are we too stupid? Why is it so difficult?" 😭😭😭 )
 
  Then, the endless pain began. 💔For the backend database interface and data store construction, we used open source templates in POSCMS. To be honest, due to time constraints, we were unable to master the backend development and could only implement some basic functions. We will continue to refine and improve these features over time.💪
 
  During the experiment to improve the function of the mini program, we encountered the following difficulties:
  1.Dice rotation ,judgment of results and recording of Bobing results.
  2.Value transfer between pages.
  3.Adaptation of page button positions, button function jumping;

- 3.2 Key and difficult functions

  • ①Award level based on dice results —— “random" function
     
    Because the final result of Bobing will generate a lot of awards, which leads to the complexity of Bobing's rules and the confusion of coding logic. In the process of sorting out the logic rules step by step, we will continue to modify, experiment and modify. We will show some code here.
/*
基于六个骰子点数的博饼结果的判断语句
设置一个名为strarr的字符串数组,并直接用push的方法推入结果,可以实现多次博饼
*/
if (four === 1 && one + two + three + four + five + six != 21 && one < 4 && two < 4 && three < 4 && five < 4 && six < 4) {
      this.data.strarr.push("一秀")          
    }
    if (four === 2 && one < 4 && two < 4 && three < 4 && five < 4 && six < 4) {
      this.data.strarr.push("二举")          
    }
    if (four === 3) {
      this.data.strarr.push("三红")
    }
    if (two === 4 || three === 4 || one === 4 || five === 4 || six === 4) {
      this.data.strarr.push("四进")
    }
    if (one == 1 && two == 2 && three == 1 && four == 2 && five == 1 && six == 2) {
      this.data.strarr.push("对堂")
    }
    if (four === 4 && one !== 2) {
        this.data.strarr.push("状元")
    }
    if (five == 5 || three == 5 || two == 5 || one == 5 || six == 5) {
      this.data.strarr.push("五子登科")
    }
    if (four == 5) {
      this.data.strarr.push("五红")
    }
    if (six == 6 || five == 6 || three == 6 || two == 6) {
      this.data.strarr.push("六杯黑")
    }
    if (one == 6) {
      this.data.strarr.push("遍地锦")
    }
    if (four == 6) {
      this.data.strarr.push("六杯红")
    }
    if (four == 4 && one == 2) {
      this.data.strarr.push("金花")
    }
    if (four == 0 && one < 4 && two < 4 && four < 4 && five < 4 && six < 4 && three < 4) {
      this.data.strarr.push("谢谢参与")
    }


onLoad: function (options) {
    var
      a = Math.floor(Math.random() * 6) + 1,
      b = Math.floor(Math.random() * 6) + 1,
      c = Math.floor(Math.random() * 6) + 1,
      d = Math.floor(Math.random() * 6) + 1,
      e = Math.floor(Math.random() * 6) + 1,
      f = Math.floor(Math.random() * 6) + 1;
}//    使用简单的自带函数即可,注意应该在onLoad(){}中写这段代码,使得载入本页面

  • ②Realize multiplayer pancake game in traditional form —— "random1" function.
     
    On the basis of equation 1, we can achieve single person multiple times of pancakes and carry out results statistics and awards.
    However, if we want to achieve multi person and multi time forum,we need additional functions to count the forum results and issue rewards. This is not easy for us."random1" is used to realize this complex function.
//每次按下摇骰子按钮就会唤起这个函数
/*
    这个函数时我们js逻辑层的主函数,其中通过调用我们自己编写的函数来实现传统的博饼游戏对局
*/
reload() {
    //重新摇色子
    this.random()
    
    var bobing = this.Def_bobing();//计算博饼大小的函数,逻辑和function一样
   
    this.judge(this.data.Gamernum, bobing)//这个函数用来判断
    
    this.countbing(bobing)//传统博饼中有奖池,这个函数计算奖池中剩余的奖项
    
    
    //终结逻辑
    if (this.sumbing() != 0) {
      // 玩家更替的逻辑
      if (this.data.Gamernum < this.data.Gamernumc) {
        var temp = this.data.Gamernum + 1
        this.setData({
          Gamernum: temp,
        })
      } else {
        this.setData({
          Gamernum : 1
        })
      }
    } else {//将得到的结果储存在本地gamerarr系列的数组
      this.data.score1 = this.bingNum(this.data.gamerarr1)//利用bingNum()统计每个人收获的饼
      this.data.score2 = this.bingNum(this.data.gamerarr2)
      this.data.score3 = this.bingNum(this.data.gamerarr3)
      this.data.score4 = this.bingNum(this.data.gamerarr4)
      this.data.score5 = this.bingNum(this.data.gamerarr5)
      this.data.score6 = this.bingNum(this.data.gamerarr6)
      this.setData({
        score1 : this.bingNum(this.data.gamerarr1),
        score2 : this.bingNum(this.data.gamerarr2),
        score3 : this.bingNum(this.data.gamerarr3),
        score4 : this.bingNum(this.data.gamerarr4),
        score5 : this.bingNum(this.data.gamerarr5),
        score6 : this.bingNum(this.data.gamerarr6),
        recode: false
      })
    }
 
  },
  to_index(){
    wx.navigateTo({
      url: '../index/index',
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      Gamernumc: app.globalData.People,
    })
    
  },

  • ③Realize multiplayer pancake game in traditional form —— "random1" function.
     
      The other is some page image adaptation and action jumping, need to think about the logic is relatively small but because of the first time to use the WeChat mini program development framework, in the code specification we still spent a lot of time constantly debuging, and constantly improve.

4 . Three major revenue events.

- 4.1 Thoughts on the implementation logic of Bo Bing program.

  • How to generate random numbers.
  • Where to store after generation.
  • How to call after saving.
  • How does it correspond to the same map .
  • How to make the map appear in the same position .
  • How to judge the result by six random numbers .
  • How to record the information of each player .
  • How to push information to players .
  • How to test the main function of Bo Boing .

I think that after completing the logic understanding of this small program, my logic understanding ability has been greatly improved.

- 4.2 Writing key parts of the code.

 The most critical part of the Bobing mini-program is determining the player's winning result based on the number of dice .. In this section, we need to determine the number of dice, of which there are six, and the total number of dice, which adds another layer of difficulty to our coding. This is the most logical and complex part of the code. It was hard, but we did it .. When this part of the code is done, we'll have a lot to learn.

- 4.3 Understanding of view layer and learning JS language to finish UI interface

 The previous week, we handled the UI page.Our page design is beautiful enough, but it is also very complex. Therefore, this week it affects our page coding accordingly, bringing us some difficulties.
 In order to complete the UI page we designed, we need to have a good understanding of view layers, and we need to be more proficient in the JS language. For this reason, we have been striving to improve our logic understanding, view understanding, and JS language programming capabilities since the beginning of the experiment; We have paid a lot of effort and effort, and similarly, we have gained a lot.


5 . The Pair Programming Photos & Experience

- 5.1 Pair Programming Experience

 This experiment made me realize that writing software alone is a very difficult task. I think every software on the market today has a strong R&D team behind it, which shows the importance of teamwork. This pairing exercise made me realize that working and learning together can be more productive, while the collision of thoughts and ideas can make everyone on our team make faster progress.😜
 We didn't do pair programming for the first two weeks, and after last week, we have some experience with pair programming. This week's programming task was more difficult and complex than last week's, giving us a special experience, and we were better able to divide the parts that needed to be done individually and the parts that needed to be done together. We were also able to better respect each other's ideas in the face of arguments and not let them take up a lot of time. We were able to
better control and plan our work
, which made it easier for us to complete our programming tasks more efficiently and with greater completion.🙂

- 5.2 Pair Programming Photos

img


6 . Final results


7 . Commit History

img


Summary

 Through this experiment, I learned that if you want to develop a piece of software, from the initial concept to the main design, from the logical implementation of the function to the construction of the code, plus the final testing and performance optimization, each step will take a lot of time. Communication and collaboration with partners can make things easier to get done. In this experiment, we achieved all the functions expected in the prototype design, but in order to be beautiful and smooth, we had to compromise: give up some image and functional perfection. In addition, due to the limitation of time and ability in the experiment, we have not further improved some functions and there are shortcomings. I hope to further explore and improve these abilities in the following research. At the same time, we hope that in the future, we can develop more interesting and more complete mini-program.😇


That's all,thanks for broswing!🌺

img

...全文
403 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复
内容概要:本文介绍了如何利用 GitHub Copilot 辅助进行程序调试与 Bug 分析,强调 Copilot 不仅可用于代码生成,更是强大的代码分析与调试工具。文章详细阐述了 Copilot 在调试复杂问题、老旧项目维护和难以复现 Bug 场景下的优势,提出了“先分析、再修改”的四步流程:分析原因→评估风险→提出方案→修改代码,并推荐结合错误日志、用户操作等信息精准提问,提升 AI 回答质量。同时展示了如何通过 Copilot 增强调试能力,如自动加日志、异常保护、生成测试数据和性能分析。最后通过游戏拾取系统的实际案例,说明如何结构化描述问题以获得有效反馈。; 适合人群:具备一定开发经验,正在参与项目调试或维护工作的程序员,尤其是面对复杂逻辑、历史代码或难复现 Bug 的 1-3 年开发者;也适合希望提升 AI 协作能力的技术人员。; 使用场景及目标:①快速定位偶发性崩溃、数据异常等问题根源;②理解无文档或结构混乱的老代码模块;③优化调试流程,借助 AI 生成诊断建议、修复方案与测试用例;④构建更具健壮性的程序,提前发现潜在缺陷。; 阅读建议:学习者应结合自身项目中的真实问题,按照文中提供的结构化提问模板实践,逐步训练与 Copilot 的协作能力,重视问题描述的完整性与准确性,避免直接要求修改代码,优先通过分析提升对系统的理解。
内容概要:本文针对高精度电流控制下的永磁同步电机(PMSM)参数辨识难题,提出一种基于粒子群优化算法(PSO)的多参数辨识模型,并在Simulink环境中完成系统级仿真实现。研究旨在克服传统控制中因电机参数(如定子电阻、交直轴电感、永磁磁链等)随温度、负载变化而失配所导致的电流控制性能下降问题。通过构建以电流跟踪误差为核心的适应度函数,利用PSO算法全局寻优能力强的特点,实现对关键电机参数的在线或离线精确辨识。文中详述了PSO算法的实现机制、参数初始化策略、收敛判据设计以及与PMSM矢量控制系统的集成方法,验证了该方案在不同运行工况下的辨识精度、收敛速度与鲁棒性,显著提升了电流环的动态响应品质与稳态控制精度。; 适合人群:具备电机驱动控制、现代控制理论及优化算法基础,熟悉MATLAB/Simulink仿真平台,从事高性能PMSM控制系统研发的研究生、高校科研人员及自动化、电力电子领域的工程师;特别适合正在开展参数自适应、智能控制算法应用等相关课题的研究者。; 使用场景及目标:①应用于高端制造装备、电动汽车驱动系统、精密伺服系统等对电流控制精度要求严苛的场合;②解决实际工程中因电机温升、老化等因素引发的参数漂移问题,提升系统长期运行稳定性;③作为智能优化算法与电机控制深度融合的教学案例,帮助理解PSO在复杂非线性系统参数辨识中的应用逻辑与实现路径。; 阅读建议:建议读者结合提供的Simulink仿真模型进行复现实验,重点剖析PSO算法模块与电机控制模型的接口设计、适应度函数的构建原则及参数敏感性分析方法,可进一步尝试引入其他先进优化算法(如GWO、HHO)进行性能对比,以深入掌握不同智能算法在工程辨识问题中的适用性与优劣。

285

社区成员

发帖
与我相关
我的任务
社区描述
福州大学 梅努斯国际工程学院 软件工程(2022秋) 教学
软件工程 高校
社区管理员
  • LinQF39
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧