EE308_Lab4

Huang_Junqi 2021-10-09 22:57:59

Innovation points

Although we only completed the local version, we strictly reproduced the rules of the traditional Xiamen Bo Bing. We use a mobile phone or an iPad to enjoy the happiness of Bo Bing on the table, experience the rich emotions brought by Bo Bing, and finally record the size of the cake obtained by each player. You can distribute the prepared prizes in advance. This is much more interesting than a simple Bo Bing!!!!!
And 10 local Bo Bing chances can be used to measure “European gas” ~, which is necessary to buy lottery tickets!!

1.Basic information of this lab

The Link Your Class https://bbs.csdn.net/forums/MUEE308FZ?category=0
The Link of Requirement of This Assignment https://bbs.csdn.net/topics/601188617
MU STU ID and FZU STU ID19105169_831901316
Teammate's MU STU ID and FZU STU ID19105185_831901317
Teammate's blog link https://bbs.csdn.net/topics/601428155
GitHub link https://github.com/1615639948/lab4
Video demo link 福大作业博饼小程序_哔哩哔哩bilibili https://www.bilibili.com/video/BV1GL4y167bb/

2. Key and difficult functions and programming ideas

2.1 Function 1: Important "random" section

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(){}中写这段代码,使得载入本页面


/*
博饼结果大小的判断语句
设置一个名为strarr的字符串数组,并直接用push的方法推入结果,可以实现多次博饼
*/
if (four === 1 && one < 4 && two < 4 && three < 4 && five < 4 && six < 4) {
      if (one == 1 && two == 1 && three == 1 && four == 1 && five == 1 && six == 1) {
        this.data.strarr.push('对堂')
      }else{
        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 (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('谢谢参与')
    }
    this.setData({
      strarr: this.data.strarr
    })
  },

2.2 Function 2: 以传统形式实现博饼游戏

//每次按下摇骰子按钮就会唤起这个函数
/*
    这个函数时我们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,
    })
    
  },

3. Photos of me working with my little partner

4. Experience in pair programming

1. In dealing with version management:

​ we have communicated some brief shorthand signs in advance, which has greatly improved the speed of programming. After updating the code, you'd better add detailed comments to facilitate your peers to keep up with your ideas, otherwise it will bring a very large learning cost to each other, and the structure of the code will gradually move in the direction in which you two are uncertain.
​ You can assign some modules before writing the code, and provide some interfaces for these modules. The two people write modules with high similarity to improve efficiency. Finally, the two people jointly synthesize the modules into main functions. It is best to spare some time to introduce each other's code ideas, which can achieve twice the result with half the effort.

2. In learning new knowledge:

​ when communicating, it's best to spare some time to explain new knowledge to their peers. The two people need to constantly improve their ability of expression and teaching, which can improve the speed of coding and learning new knowledge, and avoid repeated learning.

5. Three major revenue events

5.1 Use of GitHub:

​ Before using GitHub, due to the path dependence, we tried to use the version manager provided by wechat. It may be due to our limited ability and our shallow understanding of GIT instructions, which made it difficult for us to manage the version. After an hour of research, we switched back to using GitHub, and sure enough, everything ran naturally.

img

5.2 Understanding of logic layer and view layer and learning JS language:

​ From the beginning of searching materials, we have always been in the state of learning while doing. The blog written by "big man" often has many terms and hides a lot of details, so it wastes most of our learning time.

​ In this process, I deeply realize the importance of "hidden rules" after domain segmentation - if you don't understand the industry conventions, you will often make some very low-level mistakes, but it is inevitable for beginners.

​ Many blogs copy each other and follow the same pattern after fuzzy search.

​ In order to understand the blog written by the boss, I spent a lot of time browsing relevant or irrelevant materials and gradually summed up how to blur the knowledge needed for search. This process is very difficult. But it has summed up some vague experience in learning new things.

​ Some commonalities of embedded programming are explored: page loading, monitoring and control events in wechat applet programming are packaged in one method, which is similar to configuring watchdog and interrupt in embedded programming

​ The logic of various controls, the transfer of pages, the level of maps and controls, the attributes of various labels, the APIs and various methods provided by wechat.

​ This process took us about 15 hours. Although the time for purely obtaining information accounted for only about 5 hours, the process of practice and attempt took the remaining 10 hours. It is the process of practice and trial and error that turns the learned knowledge into ability.

5.3 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 博饼大小 by six random numbers

How to record the information of each Bo cake

How to push information to players

How to test the main function of Bo Boing

​ We discussed with each other and repeated coding. After solving each problem, we reviewed and reflected, and found that the code is very lengthy. However, since this process is promoted while learning, it is impossible to reconstruct the logic of this function implementation in time. From this point of view, we have deeply realized how important the framework of software engineering is. The continuous delay in the preparation of software should also be due to the continuous emergence of code and bugs in the development process and with the advancement of testing.

6. PSP and learning progress bar

weekNew code (line)Cumulative code (line)Learning time this week (hours)Cumulative learning time (hours)Important growth
week 6400040003030Preliminarily mastered JS programming, web page design, and deeply experienced pair programming

Personal Software Process StagesEstimated Time/minutesCompleted Time/minutes
Planning3030
Estimate2020
Development6060
Analysis2020
Design Spec3030
Design Review5050
Coding Standard3030
Design6060
Coding5001000
Code Review Planning10001000
Test100500
Reporting120240
Test Report--
Size Measurement1010
Postmortem&Process Improvement2020
total20503070

img

7. Summary

Through this experiment, I learned that if I want to develop a 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 cooperation with partners can make things easier to complete. We only reduce the lab3 prototype image. Due to the relationship between image size and resolution, we can't reduce it 100%. In order to be beautiful and smooth, we have to compromise some images and functions. Due to the limitations of time and ability in the experiment, I hope I can further explore these abilities in the next study.

...全文
162 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

183

社区成员

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

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