EE308 lab4

zzy 2021-10-09 11:01:02
The Link Your Classhttps://bbs.csdn.net/forums/MUEE308FZ?category=0&typeId=17692
The Link of Requirement of This Assignmenthttps://bbs.csdn.net/topics/601188617
The Aim of This AssignmentDevelop a BoBing software
MU STU ID and FZU STU ID19103328 - 831902203
Teammate's MU STU ID and FZU STU ID 19105886 - 831902204
Teammate's blog link https://bbs.csdn.net/topics/601385432
GitHub linkhttps://github.com/zyq-zzy/lab4
Video demo linkhttps://www.bilibili.com/video/BV1jq4y1d7GL/

 

Catalogue

1.PSP From

2.learning progress bar

3.Assumption description

4.Difficult functions and programming thinking:

5.Pair programming experience.

6.The 3 events 


1.PSP From

PSP StagesEstimated Time/minutesCompleted Time/minutes
Planning6060
Time Estimation4040
Development--
Requirement Analysis100100
Design Documents--
Design Review--
Code Specification100100
Specific Design400400
Specific Coding15002000
Code Review120120
Test600800
Presentation6060
Test Report--
Calculation Workload2020
Summary&Improvement6090
Total30004200

2.learning progress bar

N dayNew code (line)Cumulative code (line)Learning time this week (hours)Total Learning Time (hours)Important growth
110010055Familiar with js, HTML, CSS
2100200510Familiar the js, HTML, CSS
3100300515master the js, HTML, CSS
4100400520Familiar the websocket

 Github address:

https://github.com/zyq-zzy/lab4

video address:

https://www.bilibili.com/video/BV1jq4y1d7GL/

3.Assumption description

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 

4.Difficult functions and programming thinking:


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("启动")

})

5.Pair programming experience.

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.

 

6.The 3 events 

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.

 

 

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

183

社区成员

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

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