Best代写-最专业、靠谱的代写IT&CS | 留学生作业 |编程代写 | Java | Python | C/C++ | PHP | Matlab | Assignment Project Homework代写

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

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

Due Date: Friday 5 July 2019

Marks: 15 marks


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



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.

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-ConditionScore FormulaExampleExample
Example Description
Any throwSum of dices faces9,3,4,3,625sum
2+ dice showing the same face14 + 2 * face1,3,4,3,620pair of 3’s
3+ dice showing the same face15 + 3 * face7,9,9,4,942three 9’s
4+ dice showing the same face16 + 4 * face1,1,8,1,120four 1’s
5 dice showing the same face17 + 5 * face6,6,6,6,647five 6’s
2+ dice showing the same face and 2+ other dice showing the same face13 + 2 * face1 + 2 * face23,3,5,4,529pair of 3’s and a pair of 5’s
3 dice showing the same face and 2 other dice showing the same face15 + 3 * face1 + 2 * face28,1,8,1,841three 8’s and a pair of 1’s
4 sequential dice faces25 + highest face in sequence3,1,1,4,229short sequence 1..4
5 sequential dice faces37 + highest face in sequence6,3,4,7,544long 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.

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

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


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.


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.


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
  2. Log in with your zid and zpass
  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


  • 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.


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.


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.