C语言代写 | DPST1091 Introduction to Programming 19T2 Assignment1 You Chew

这是一篇澳洲的关于C语言代写的作业案例分享，以下是作业详细内容

Aims

This assignment aims to give you practice in:

• developing a solution to a problem
• developing a C program that is an implementation of your solution
• writing a properly documented C program that adheres to the course Style Guide
• Devising tests to test your solution
• programming using arrays.
• breaking a problem down into smaller functions
• Maintaining a blog of the work you do

Contents

IntroductionThe RulesBlogAssessmentSubmission

Introduction

Your task in this assignment to write a C program which does the scoring for little known game of You ChewYou Chew is a game played by packs of celebrities who are living in various jungles and desert islands around the world. The winner of You Chew gets to eat a 3 course meal for dinner, while the rest of the players are forced to forage for food or starve.

You Chew is played by rolling five 9-sided dice. The dice have the integers 1 to 9 on their faces.

The player who can come up with the maximum score from the dice roll first, using valid rules only, is the winner.

Your program will be given one and only one line of input. This line of input will specify a You Chew dice roll. In other words the line of input should contain 5 integers between 1 and 9 inclusive.

Your program should produce one and only one line of input. This line of output should describe the best You Chew possible score for the input dice roll. There is one and only one correct output line for every input line and you must output it exactly down to the last character.

A reference implementation is available which provides the correct output line for any input line.

The Rules

The score for a You Chew dice roll is calculated using these rules:

Pre-Condition Score Formula Example Example
Score
Example Description
Any throw Sum of dices faces 9,3,4,3,6 25 sum
2+ dice showing the same face 14 + 2 * face 1,3,4,3,6 20 pair of 3’s
3+ dice showing the same face 15 + 3 * face 7,9,9,4,9 42 three 9’s
4+ dice showing the same face 16 + 4 * face 1,1,8,1,1 20 four 1’s
5 dice showing the same face 17 + 5 * face 6,6,6,6,6 47 five 6’s
2+ dice showing the same face and 2+ other dice showing the same face 13 + 2 * face1 + 2 * face2 3,3,5,4,5 29 pair of 3’s and a pair of 5’s
3 dice showing the same face and 2 other dice showing the same face 15 + 3 * face1 + 2 * face2 8,1,8,1,8 41 three 8’s and a pair of 1’s
4 sequential dice faces 25 + highest face in sequence 3,1,1,4,2 29 short sequence 1..4
5 sequential dice faces 37 + highest face in sequence 6,3,4,7,5 44 long sequence 3..7

In You Chew the highest scoring rule that can be applied is chosen.

Occasionally multiple rules will produce the same score. In this case the rule with the alphabetically first description is used. There is always a unique correct output for any input line.

You should check your understanding of these rules using the reference implementation. The reference implementation should always produce the correct output for any input. You should match its behaviour EXACTLY.

Although its good practice to print a prompt before reading input your program should not print anything before reading its input. Your program should read its input (5 numbers) and it should produce exactly one line of output exactly as in the example below. If you program is named youChew it should behave EXACTLY as below.

```./youChew
8 8 8 8 8
You Chew score is 57: five 8's.
./youChew
5 6 4 8 3
You Chew score is 31: short sequence 3..6.
./youChew
2 2 9 2 2
You Chew score is 24: four 2's.
./youChew
1 2 1 3 1
You Chew score is 18: three 1's.
./youChew
7 9 7 8 7
You Chew score is 38: sum.
./youChew
5 4 3 9 9
You Chew score is 32: pair of 9's.
./youChew
5 4 3 9 4
You Chew score is 25: sum.
./youChew
5 4 3 6 4
You Chew score is 31: short sequence 3..6.
./youChew
5 7 3 1 9
You Chew score is 25: sum.
./youChew
5 7 3 apple
Invalid input: 5 integers 1..9 must be supplied.
./youChew
5 7 3 1 -9
Invalid input: 5 integers 1..9 must be supplied.
./youChew
5 7 3 1
Ctrl^d
Invalid input: 5 integers 1..9 must be supplied.
```

Your C program should be placed in a single file named youChew.c

Assumptions

Like all good programmers, you should make as few assumptions about your input as possible.You may assume you are given exactly one line of input.

You can assume this line contains at most 1024 characters.

Most testing will be on legal input lines but your program may be tested on invalid input.

If you use scanf in the obvious way your program will accept mutliple lines of input – for example reading the numbers if each is on a separate line. This is fine – but your program will only be tested with a single line of input.

Hints

You should follow discussion about the assignment in the course forumQuestions about the assignment should be posted there so all students can see the answer. If you need an urgent reply also e-mail Aarthi.

Use an array to store the 5 input integers.

Use scanf to read the 5 input integers.

Don’t panic! Get the easiest rules working first. Don’t worry about the inputs your program can’t handle. You’ll get marks for every input it can handle.

Start with the sum rule. Then try the pair rule.

Remember your program is going to be automatically marked so be careful to produce exactly the desired output.

Submit early so you can see the results of the submission auto tests in case they reveal problems.

Blog

You must keep notes on your blog every time you work on this assignment.

How to Blog

1. Go to the course Webcms Home Page
3. Click on the speech bubble icon at the bottom of the side navigation panel near your name.
4. Click on “Create Post”

Your blog should include

• The amount of time you spent
• Whether you were reading and understanding, designing, coding, debugging or testing.
• What you learnt or achieved
• Mistakes you made and how you could try to avoid or minimise them next time

Hints:

• Be specific and include concrete examples of what you did. Only tutors can read your blog so you can include code snippets
• Don’t panic if English is your second language or if you are not a ‘great’ writer. We understand and we do not expect the next great novel of our time.

Assessment

Assignment 1 is worth 15 Marks. Your submission will be assessed in the following way:

• Automarking: 12 Marks
• Programming style: 3 Marks
• Assignment blog: – 1 Mark for trivial or missing blogs

We’ll test performance by running your program on a range of inputs (test cases).Note: We do not just use the same tests as the submission autotests. We test on a whole batch of unknown test cases. Passing all the submission tests is a great start, but does not guarantee you will pass all of our test cases.

Here is an indicative marking scheme.

 100% all inputs handled correctly, beautiful C code 90% most inputs handled correctly, very readable code 80% 7 rules applied correctly, very readable code 70% 5 rules applied correctly, readable code 55% 2 rules applied correctly, tried to make code readable

The lecturer may vary the assessment scheme after inspecting the assignment submissions but it will remain broadly similar to the description above.

Submission

Remember your program is going to be automatically marked so be careful to follow the desired output.

Submit early so you can see the results of the submission autotests in case they reveal problems.

The bonus part of the assignment should be submitted separately to the standard part.

Submit the standard part of the assignment using this give command:

```give dp1091 assign1 assign1.c
```

To just run the automarking tests without submission run

```~dp1091/bin/autotest assign1 assign1.c
```

You can find the test cases for the autotests here

```ls ~dp1091/public_html/19T2/assignments/assign1/autotest
```

If your assignment is submitted after this date, each hour it is late reduces the maximum mark it can achieve by 1%. For example if an assignment worth 76% was submitted 5 hours late, the late submission would have no effect. If the same assignment was submitted 30 hours late it would be awarded 70%, the maximum mark it can achieve at that time.