183
社区成员
发帖
与我相关
我的任务
分享| The Link Your Class | https://bbs.csdn.net/forums/MUEE308FZ?category=0&typeId=17692 |
| The Link of Requirement of This Assignment | https://bbs.csdn.net/topics/601188617 |
| The Aim of This Assignment | Develop a BoBing software |
| MU STU ID and FZU STU ID | 19103328 - 831902203 |
| Teammate's MU STU ID and FZU STU ID | 19105886 - 831902204 |
| Teammate's blog link | https://bbs.csdn.net/topics/601385432 |
| GitHub link | https://github.com/zyq-zzy/lab4 |
| Video demo link | https://www.bilibili.com/video/BV1jq4y1d7GL/ |
4.Difficult functions and programming thinking:
5.Pair programming experience.
| PSP Stages | Estimated Time/minutes | Completed Time/minutes |
| Planning | 60 | 60 |
| Time Estimation | 40 | 40 |
| Development | - | - |
| Requirement Analysis | 100 | 100 |
| Design Documents | - | - |
| Design Review | - | - |
| Code Specification | 100 | 100 |
| Specific Design | 400 | 400 |
| Specific Coding | 1500 | 2000 |
| Code Review | 120 | 120 |
| Test | 600 | 800 |
| Presentation | 60 | 60 |
| Test Report | - | - |
| Calculation Workload | 20 | 20 |
| Summary&Improvement | 60 | 90 |
| Total | 3000 | 4200 |
| N day | New code (line) | Cumulative code (line) | Learning time this week (hours) | Total Learning Time (hours) | Important growth |
|---|---|---|---|---|---|
| 1 | 100 | 100 | 5 | 5 | Familiar with js, HTML, CSS |
| 2 | 100 | 200 | 5 | 10 | Familiar the js, HTML, CSS |
| 3 | 100 | 300 | 5 | 15 | master the js, HTML, CSS |
| 4 | 100 | 400 | 5 | 20 | Familiar the websocket |
Github address:
https://github.com/zyq-zzy/lab4

video address:
https://www.bilibili.com/video/BV1jq4y1d7GL/
We have done the UI design in lab3. Through the last experiment we quickly determined the design direction of this software.We decided to use wechat mini program to complete this task. Because wechat small program is more convenient and fast and users do not need to download can be achieved.

This programming task is very difficult for us. In the UI model originally designed, we hoped to realize the practice of room sorting and room ID function in online mode, and to give each user a user number. But after a lot of struggle and effort we could only achieve the simplest online effect. I think this is caused by our lack of self-learning ability, and the ability to read documents needs to be improved. In future assignments, we should pay more attention to the cultivation of self-learning and consulting ability, especially those very useful English documents
In this experimental assignment, we believe that the main function and programming thinking is the judgment of the final result of six random dicers. Due to many situations and considering the priority and weight of the results, this part of the code is very error prone.
First, our thinking direction is to use a simple if else structure to solve the judgment of the result, and after creating six random numbers, we first save them into the array. The position of the array represents the value of the random number, and the number of the value is stored in the array. In this way, we can save a lot of things in judgment. After the array is created, we list the judgment basis and priority of each situation. The highest priority, that is, the higher level, is placed in front of the if else judgment. Here is our code.
<wxs module="m1">
var award = function(q,w,e,r,t,y) {
var list=[];
list.push(q,w,e,r,t,y);
var count=[0,0,0,0,0,0];
for(var i=0;i<6;i++){
count[list[i]]=count[list[i]]+1;
}
if(count[4]==4&&count[1]==2){
return "状元(金花)";
}
else if(count[4]==6){
return "状元(六杯红)";
}
else if(count[1]==6){
return "状元(遍地锦)";
}
else if(count[2]==6||count[3]==6||count[5]==6||count[6]==6){
return "状元(六杯黑)";
}
else if(count[4]==5){
return "状元(五红)";
}
else if(count[1]==5||count[2]==5||count[3]==5||count[5]==5||count[6]==5){
return "状元(五子登科)";
}
else if(count[4]==4){
return "状元(四点红)";
}
else if(count[1]==1&&count[2]==1&&count[3]==1&&count[4]==1&&count[5]==1&&count[6]==1){
return "榜眼(对堂)";
}
else if(count[4]==3){
return "探花(三红)";
}
else if(count[1]==4||count[2]==4||count[3]==4||count[5]==4||count[6]==4){
return "进士(四进)";
}
else if(count[4]==2){
return "举人(二举)";
}
else if(count[4]==1){
return"秀才(一秀)";
}
else{
return"谢谢参与";
}
}
module.exports.award = award;
</wxs>
2.Secondly, there is the problem of online back-end construction. Because we have not contacted the back-end and rarely understand the interface, we have no idea at the beginning. However, after constantly searching CSDN and other major websites, we think it is possible to use websocket to realize this function. After the decision, we began to look for relevant videos on various video websites, and we realized some functions of networking in continuous imitation and testing.
First, in order to build the backend, we installed some dependent instructions as follows
npm nodemon -D
npm i ws -s
npm i express -s
After installing the dependencies and testing them for normal use, we built the following backend. It also realizes the monitoring of the link with the back end, receives and sends back the message, and realizes the broadcast of the message after consulting the document, so that the message can be sent to all users
let express=require("express")
let websocket=require("ws")
let app=express()
let wss=new websocket.Server({port : 3001})
let count=0
wss.on('connection', (ws)=> {
count++
ws.on('message', (message)=>{
//Converts the incoming message to a string, ensuring that the data type passed to the user is normal
let data=Buffer.from(message).toString()
let s=count.toString()
data="?号玩家获得了"+data
//The message is broadcast to all users
wss.clients.forEach((client)=>{
client.send(data)
})
data=''
})
})
//Listening port 3000
app.listen(3000, () => {
console.log("启动")
})
Because two people's code ability is not the same, it brought no small difficulty to group programming, in the process of division of labor and cooperation, we met many difficulties, but when we finished, it improved my communication ability and cooperation ability with my teammates, so that the division of labor and cooperation between us more clear. When we meet with difficulties, we can solve them together, when we meet with problems, we can look up information together instead of finishing our own work as before.
The job also improved my ability to write code. I learned how to use wechat development tools to write small programs and gained some insight into it.
1.One of the things that happened to us was that we didn't have a code specification, which was the easiest thing to overlook, which made the code look ugly when we first worked together, and it was not easy to understand each other's code, which caused a lot of trouble for us. With this experience we also learned that we need to determine the specifications first.
2.After designing the UI, our direction was about the mobile software, but we soon faced the task of which platform should be used to complete such a task. For example # : Unity/Visual Studio, Java: ideahtml, js: vscode/webstorm/ wechat developer tools (do small programs)c++: qt. This has brought us a lot of troubles. After online learning and hints from teaching assistants, we decided to use wechat mini program to complete the design.
3.This difficulty was encountered during the implementation of the applet, because in this process, we suddenly wanted to test and add the multiplayer online function in advance, resulting in a series of bugs, and even some functions were affected, so we had to give up this version. We also learned that we should not do unplanned tasks that would affect the original plan.
