EE308 Lab2-2

The Link Your Classhttps://bbs.csdn.net/forums/MUEE308FZU202201?typeId=519086
The Link of Requirement of This Assignmenthttps://bbs.csdn.net/topics/608859318
MU STU ID and FZU STU ID20124104_832001205
Teammate’s MU STU ID and FZU STU ID20124058_832001227
Teammate’s blog linkhttps://bbs.csdn.net/topics/609140194
GitHub linkhttps://github.com/anasappp/TeamBobing
Video demo linkhttps://www.bilibili.com/video/BV1w14y1W7TD/

请添加图片描述

Key functions and programming thinking

Basic page switching
  • key function:By setting control-button, the function of entering the corresponding interface of the application when clicking the button is realized.
  • programming thinking
    请添加图片描述
  • code:
<Button
        android:id="@+id/button"
        android:layout_width="264dp"
        android:layout_height="165dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:layout_marginLeft="78dp"
        android:layout_marginBottom="39dp"
        android:background="#00000000"
        android:text=""
        tools:ignore="MissingConstraints" />
public class startgame extends AppCompatActivity {
    Button button;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.startgame);
        button = (Button)findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent();
                intent.setClass(startgame.this, choooooose.class);
                startActivity(intent);
            }
        });
    }
}
The number of people playing multiplayer
  • key function: When a multiplayer room is created, the number of throws in a round is generated based on the number entered by the user.
  • programming thinking:
    请添加图片描述
  • code:
    <EditText
        android:id="@+id/edt_test"
        android:layout_width="wrap_content"
        android:layout_height="60dp"
        android:layout_alignParentLeft="true"
        android:layout_alignParentBottom="true"
        android:layout_marginLeft="118dp"
        android:layout_marginBottom="276dp"
        android:hint="@string/edt_test"
        android:inputType="number"
        android:textSize="18sp" />
EditText num = findViewById(R.id.edt_test);
int number = Integer.parseInt(et_age.getText().toString());
Automatically generate random results
  • key function: Each cast of six dices produces a random result (there are 6^6 results in total). Corresponding results will be generated automatically for each throw, such as: zhuangyuan (hongliubo), tanhua, bangyan and so on.
  • programming thinking:
    请添加图片描述
  • code:
        rollButton.setOnClickListener(new View.OnClickListener(){
            public void onClick(View v){

//                产生随机数
                Random rand = new Random();
                int randNumber1 = rand.nextInt(6)+1;

                int randNumber2 = rand.nextInt(6)+1;
                int randNumber3 = rand.nextInt(6)+1;
                int randNumber4 = rand.nextInt(6)+1;
                int randNumber5 = rand.nextInt(6)+1;
                int randNumber6 = rand.nextInt(6)+1;

//                获取对ImageView对象的引用
                ImageView diceImage1 = findViewById(R.id.dice_1);
                ImageView diceImage2 = findViewById(R.id.dice_2);
                ImageView diceImage3 = findViewById(R.id.dice_3);
                ImageView diceImage4 = findViewById(R.id.dice_4);
                ImageView diceImage5 = findViewById(R.id.dice_image5);
                ImageView diceImage6 = findViewById(R.id.dice_6);

                int drawableResource1,drawableResource2,drawableResource3,
                        drawableResource4,drawableResource5,drawableResource6;
//                将随机数与对应的图片资源联系起来
                switch (randNumber1){
                    case 1: drawableResource1 = R.drawable.dice_1; break;
                    case 2: drawableResource1 = R.drawable.dice_2; break;
                    case 3: drawableResource1 = R.drawable.dice_3; break;
                    case 4: drawableResource1 = R.drawable.dice_4; break;
                    case 5: drawableResource1 = R.drawable.dice_image5; break;
                    case 6: drawableResource1 = R.drawable.dice_6; break;
                    default:
                        throw new IllegalStateException("Unexpected value: " + randNumber1);
                }
Result list
  • key function: Multiplayer games produce a result list based on the number of players in a round after all players have cast their dice.
  • programming thinking:
    请添加图片描述
  • code:
    <TextView
        android:id="@+id/array"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#e0000000"
        android:textColor="#FAFAF9"
        android:textSize="70dp"
        android:layout_gravity="center"
    />
                TextView tv = (TextView)findViewById(R.id.array);//获取一个TextView
                String ct = "";//定义一个字符串
                String s = "历史记录\n";

                if (round == N){

                    for (int m=0;m<N;m++){
                        for(int j=0;j<2;j++){
                            ct = ct + list[m][j];//数组拼接成字符串
                            if (j == 0){
                                ct = ct +"\u0020\u0020";
                            }
                        }
                        ct = ct + "\n";
                    }
                    round = 0;
                    ct = s +ct;
                }

                tv.setText(ct);//在TextView中显示数组内容

                round = round + 1;

Photo showing pair working

在这里插入图片描述

Experience in pair programming

  • Time Planning: Individual activities take time to plan, and so does working in pairs. The two of you should list your free time within the project cycle, then choose overlapping periods and plan your progress within these periods.
  • Communication: Communication is definitely one of the most important aspects of pairing. First of all, timely communication can avoid a lot of unnecessary rework. Secondly, the information collected by both parties can be effectively used in the communication. At the same time, we need to distribute work equally through communication.

Big events

  • Preliminary preparation: Since we were developing software for the first time, we first had to download the appropriate tools. The main tools we use this time are: android studio, jdk, SDK and so on. These tools are not downloadable like normal apps, they must be configured correctly when installed before they can be used later. So, after spending a lot of time looking for tutorials on how to configure these tools, we finally came to the conclusion that we should look for tutorial videos of the same version of the tool online and learn step by step if we need to, even if there is a mistake, the tool may not work in the end.
  • Implement different random results to produce the corresponding prize or not winning: We know that the six dices produce 6^6 results in a random situation, so it is impossible to enumerate each result with the corresponding awards. So we choose to use the if-else statement and count the number of times that the number “four” occurs in the result. But the logic is still complicated, and we spent a lot of time figuring it out.
  • Duplication of work due to miscommunication: In the stage of combining materials of this cooperation project, due to inappropriate file name, a lot of time was spent on modifying the name of the sub-project. What I mean is that even some seemingly insignificant things without effective communication will magnify their adverse effects in cooperation. Therefore, we should pay attention to every detail in cooperation.

PSP

Personal Software Process StagesEstimated Time/minutesCompleted Time/minutes
Planning3040
Estimate12401770
Development120150
Analysis120110
Design Spec3040
Design Review2040
Coding Standard1020
Design4050
Coding360720
Code Review60100
Test100300
Reporting100120
Test Report2030
Size Measurement1020
Postmortem&Process Improvement2030
total12401770

GitHub link and commit record

https://github.com/anasappp/TeamBobing

请添加图片描述

Video

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值