当前位置:天才代写 > C++/C代写,c语言代写代考-100%安全,包过 > C 语言编程作业代写 COSC2138代写

C 语言编程作业代写 COSC2138代写

2023-04-07 16:00 星期五 所属: C++/C代写,c语言代写代考-100%安全,包过 浏览:477

COSC2138 (CPT220) – Programming in C

Assignment 3 – Word Puzzle Game Part 2

C 语言编程作业代写 This is an extension to assignment 2 but pleas note that if you were not able to get assignment 2 done there will be an alternative pathway to

This is an extension to assignment 2 but pleas note that if you were not able to get assignment 2 done there will be an alternative pathway to complete this assignment – see below for details.

The concepts covered in this assignment include:

  • All concepts covered in assignment 1 and 2
  • Modifying an existing program to add extensions to it.
  • implement use and manage a linked list.

Please ensure that you ask questions early to resolve problems so that you are not wasting time as this assignment for many of you will involve substantial effort although I have tried to make this assignment as simple as possible while still meeting the learning outcome requirements.

Please also note that the discussion board is required reading. The discussions there have an impact upon your marks so if you are not reading then you will miss out on that information.

 

Plagiarism     C 语言编程作业代写

Plagiarism is the act of copying another’s work and representing it as your own. As part of all submissions you make in this course you agree that all work contained therein – other than the start-up code – is your work. Any code included from others must be properly referenced – for the purposes of this course this means providing a comment in your code that outlines what code you have copied, from where (author, url or textbook), and date that it was accessed if it is an online resource. Failure to follow this guideline can result in facing school discipline hearings. We will run automated software to check for plagiarism / similarity. This includes code you have copied from the provided courseware.

For more information, have a look at this guide from MIT:

https://integrity.mit.edu/handbook/writing-code

It is a requirement of submission of all components of this assignment that you agree to the RMIT assessment declaration, available here: https://www.rmit.edu.au/students/student-essentials/assessment-and-exams/assessment/assessment-declaration

Note:

This assignment specification has a lot of detail. This specification is both an assignment specification and documentation of the codebase that I have provided to you. You’ll probably need to read through this a couple of times and ask questions on Canvas to understand the assignment completely. A large part of being a software developer is reading and interpreting documentation. The first thing that course staff will ask is if you have read the specifications, relevant lecture slides and relevant posts from other students and clarifications made by the instructor. If you have not done this, this is the first thing we will ask you to do. Reading is an important part of being a software developer!

 

Compilation Requirements   C 语言编程作业代写

The programs you submit for this course must compile without errors or warnings on the provided servers (jupiter, titan or saturn) using the following command:

gcc -ansi -Wall -pedantic board.c game.c players.c rules-2.c
word_list.c [any additional .c files you create] -o wuzzle-c

Alternatively if you were not able to get assignment 2 working you can compile with the following command:

gcc -ansi -Wall -pedantic word_list.c [any additional files you create] -o wuzzle-c

Finding the startup code

You may find the startup code on the servers (titan, jupiter, saturn) in

~e70949/shared/prog_in_c/assignments/a3

There are only three new files provided – word_list.c and word_list.h and Makefile. word_list.h contains the required linked list to be implemented for assignment 3. word_list.c is mostly blank as you will create the appropriate functions here. Makefile is where you will create the commands that make will use to compile your program.

Please note that on top of the ones provided you will need to create some of your own. In particular you will need to use the clear_buffer() function provided in assignment 1. As with assignment 2, we have provided much more freedom in this assignment but that will require you to take more responsibility for the design of your program.

 

Extensions to assignment 2    C 语言编程作业代写

We are going to add functionality to your wuzzle game to check the spelling of words on each turn. To do this, you are going to implement a linked list is C that holds a collection of alphabetical words. In each turn, when the user enters a word, you will search for that word in the dictionary and if it is found you will allow the move and if not you will reject it. This means on the start of your program you will accept an additional command line argument – the word file to load.

In addition to the spell checking of words, you will implement some additional commands to add and delete words from the linked list and save them to disk.

Please note that if you were not able to implement the assignment 2 to an extent that it gets in the way of implementing assignment 3, you will be given alternate options to avoid this issue.

Data structures

For this assignment, the only new datastructure is the list, defined in word_list.h as:

struct word_node {
    struct word_node * next;
    const char * word;
};
struct word_list {
    struct word_node * head;
    long num_words;
};

This structure is rather similar to the structures we have used in tutorials for a linked list. The main difference really is that the word element of the node itself is a malloced pointer. There will be some issues with this when assigning and freeing the pointer so you might need to fix that with a cast due to the “const” keyword used here.

 

Assignment 3 Implementation Requirements – 80 Marks   C 语言编程作业代写

Please note that while I may specify a function that needs to be implemented, you can (and should) break down the function into smaller parts and put those parts in their own function. Please consider when writing your own functions where a suitable location for such functions might be. There may be small deductions for not doing this. Also note we are not going to be as hard about not modifying the startup code as we were in assignment 1. In assignment 3, there are marks provided as part of this submission for design justifications for any additional files you create and any modifications you make to the provided files. These must be provided in terms of good software design – a justification that you did not understand the startup code will not be accepted as you can always ask for explanation. This means that not all required files are provided as part of the startup code. That’s known and it’s expected that you will create those additional files.

Please also note that most requirements are marked according to a 5 point scale:

  • Excellent: full marks. You have implemented this requirement as we have required.
  • Good: 75% of marks: There are minor issues such not doing proper validation or minor memory problems but it’s still reasonably good. There is often queries from students as to why they have lost 25% of marks for such minor issues. The reason is that these issues matter and by using this same scale for everyone it increases the chance that marking is consistent.
  • OK/Fair: 50% of marks. There are major problems but it does the basic job. So examples of this might be that it sometimes runs correctly but mostly not.
  • Poor: You gave this a try but your solution is very far from what we wanted. Examples of this might be compiler errors or crashing every time or the program freezing.
  • No effort: You did not attempt this requirement or it is the judgement of your marker that no significant effort has been made. Eg: just declaring some variables but not doing any of the work on the required algorithm.

In all cases if you do not get full marks, feedback should be provided explaining what you did wrong and if that is not the case, you are encouraged to email your marker (reply to the results email) to ask follow-up questions.

Requirement 1: Command Line Arguments (3 marks)    C 语言编程作业代写

You are to modify the command line arguments implementation from assignment 2 so that a second argument will be required which is the path to the word file (dictionary) to load. Just like with assignment 2, you should not validate its “file type” but just that it exists. Eg: do not reject a file because it does not end in .txt or is not in the current directory. You should however check that two arguments have been provided to the program. This additional argument is also to be passed into the play_game function so that the words list can be loaded.

Requirement 2: Design and Implement Functions for Managing the Linked List (6 maks)

In the files word_list.h and word_list.c you are to design and implement the interface functions for managing the linked list. Please review tutorial material for the functions we expect you to use. Please consider that we really should not be accessing the internals of a data structure outside of the files that define it.

Requirement 3: Load words file into the provided linked list structure (6 marks)

Load the words in sorted order from a file. I have provided several files in ~e70949/shared/prog_in_c/assignments/a3/words that you can use. The files are in the format of “words[num1]_[num2]”, and each word in the dictionary is on a separate line.

The first number means the length of the longest word listed in that file and the second number is how many words are listed in that file.

Sorted order means that the words that start with ‘A’ will be at the beginning of the list and words that start with ‘Z’ will be at the end of that list. You should modify the game_init() function to call this function to load the words or if you are not using the structure from the game, you must call this function when your program starts to load in the words.

Requirement 4: Check the spelling of the words played (4 marks)    C 语言编程作业代写

During each turn of the game, you must check the word when it is entered to see that it is in the dictionary before accepting input of the coordinates or orientation. If the word is not in the dictionary, it should be rejected. This should be implemented in the function:

BOOLEAN is_in_dictionary(struct word_list* list, const char * word);

Which is in the file word_list.c.

If you are not using the game structure from assignment 2, you must just prompt for a word to be entered and depending on whether the word is in the dictionary or not, output a sentence explaining this fact.

Requirement 5: The command Interface (3 marks)

At the same prompt above where a user may enter a word, you must also allow them to enter a command. A command is of the format of any amount of whitespace followed by a colon (:)

followed by one of the keywords: help, add, delete or save. The commands add, delete and save will also accept an argument as detailed in the requirements below. Any commands that do not match below should be rejected.

Requirement 6: The help command (3 marks)

When the user enters the help command as in “:help”, you should provide one of two sentences explaining how to use the add, delete and save commands, consistent with the descriptions below.

Requirement 7: The add command (6 marks)

When the add command is invoked as:

:add newword

from the prompt for a word (where newword is a contiguous set of alphabetical letters), the word specified must be added to the dictionary after being converted to upper case. Please note that there must be no characters in the word that are not part of the English alphabet as defined in the ascii standard. For these conversions, do not hardcode the letter ranges but rather use the functions provided in the ctype.h library that is part of the ansi C standard.

Requirement 8: The delete command (6 marks)   C 语言编程作业代写

When the delete command is invoked as:

:delete word

where word is a sequence of alphabetic characters (anything else should be rejected). You should convert the input to upper case and search for an exact match. If you find the word, delete the node and free its associated memory.

 

 

Requirement 9: The save command (6 marks)

When the save command is invoked as:

:save filename

Where filename is any valid file on the system including the whole path to that file. You should not reject the saving of files to any path. The only case you need to deal with is if the file operations fail such as opening, writing, etc. All file operations that fail must be handled.

The saving of the linked list to disk will involve iterating through the linked list and saving each word in the order they exist in the linked list.

Requirement 10: quit and save on exit (2 marks)

As with assignment 2, you should quit the program when either player presses ctrl-d. As part of exiting the program, you should invoke the same save functionality invoked as part of solving requirementt 9.

Requirement 11: Timing sections of your code (4 marks)

In order to discover the parts of your program that are taking the longest, we want you to time the various functions of your program.

To do this you will need to use the clock() function from time.h

clock() returns a clock_t variable (long integer) that represents elapsed time.

To time a part of your program you do something like the following:

clock_t start, end;

start = clock();

/* do some things */

end = clock();

double elapsed = ((double)(end-start)/CLOCKS_PER_SEC;

This will give you the number of seconds that the operation you are measuring has taken.

For example, when loading the program, I produce the following output:

loading the score list took 0.000000 seconds.

loading the word listt took 5.810000 seconds.

Please note that valgrind and libasan substantially slow down your code so please don’t use these when running your timing experiments. Please note that I have given you a variety of files with words up to 45 characters long and word lists up to 100000 words.

Requirement 12: Free memory (5 marks)  C 语言编程作业代写

When the game is quit, all memory must be freed such that if I run your program with valgrind such as:

valgrind –track-origins=yes –leak-check=full –show-leak-kinds=all ./wuzzle scoreslist

no leaks or blocks in use should be reported. Please note for any invalid memory accesses, these will be deducted under the section where that particular requirement is assessed. Memory errors in one section may impact upon the marks in other sections that are dependent upon it.

Requirement 13: the Makefile (5 marks)

Write a makfile incrementally builds each .c file into a .o file and then links them all together. The linking must be done with a separate target to compilation.

You must show an understanding of which gcc flags are appropriate in compilation and linking by using the correct flags in each phase.

You must also implement a “clean” target as a phony target that will delete all files created as part o the compilation process.

Report

You are to submit a report in pdf format. It is only expected to be 1-2 pages long and to briefly answer respond to the two requirements here. This will be a separate submission using the tunitin plugin in canvas. In order to avoid problems please ensure that the reported similarity is less than 20%.

Requirement 13: Report – Design Justifications (5marks)

What design decisions did you have to make as part of implementing your assignment? Are there good reasons in terms of good software development practice? What were these – provide your reasons. Please note that if your marker does not find these justifiable, there may be mark deductions in the sections that relate to this discussion.

Requirementt 14: Report – Performance Analysis (5marks)

Using the timing results from the code you have written (try a variety of word lengths and file sizes), what parts of your code took the longest to run? Explain why this is the case with reference to the discussion from the lectures on system architecture.

 

General Requirements    C 语言编程作业代写

These are general requirements that are applicable for all assignments.

General Requirement #1 – Functional Abstraction (6 Marks)

This requirement relates to good program design.

We encourage the use of functional abstraction throughout your code. It is considered to be a good practice when developing software with many benefits. Abstracting code into separate functions reduces the possibility of bugs in your project, simplifies programming logic and eases the process of debugging. We are looking for some evidence of functional abstraction throughout your code.

General Requirement #2 – Buffer handling (5 Marks)

This requirement relates to how well your programs handle “extra input”. As there is no user input required for this assignment, you nevertheless still need to check for buffer overflow and all appropriate code to clear the input buffer when reading from a file. We have provided a modified version of clear_buffer() in io.c to help with this. Please note that if you detect buffer overflow in this case you should treat it as an error and display an error and reprompt for input.

Marks will be deducted for the following buffer-related issues:

Prompts being printed multiple times or your program “skipping” over prompts because leftover

input was accepted automatically. These problems are a symptom of not using buffer overflow code often enough.

General Requirement #3 – Input validation

For functionality that we ask you to implement that relies upon the user entering input, you will need to check the length, range and type of all inputs where applicable.

For example, you will be expected to check the length of strings (e.g., 1-20 characters), the ranges of numeric inputs (e.g., an integer with value 1-7) and the type of data (e.g., is this input numeric?).

Also, some data types can only be allowed to have a limited set of values, for example days of the week or months of the year.

For any detected invalid inputs, you are asked to re-prompt for this input – don’t truncate extra data or abort the function.

Further, you are required to demonstrate correct use of the standard library function:

char *strtok(const char *restrict s1, const char *restrict s2);

where appropriate in your code. The use of alternate methods to achieve similar functionality (such as the use of the scanf family of functions) will result in a deduction. Please note that “correct use” includes appropriate error handling. For example, your error messages displayed to the user should be self-explanatory.

You are also required to use the standard library function:

long strtol(char * str, char **end, int base)

to convert any integers input as strings to the appropriate integer format. You must check that there in no non-numeric data viate this end pointer as demonstrated in the lectures.

General Requirement #4 – Coding conventions/practices   C 语言编程作业代写

Marks are awarded for good coding conventions/practices such as:

  • Avoiding global variables.
  • Avoiding goto statements.
  • Consistent use of spaces or tabs for indentation. We recommend 4 spaces for every level of indentation. Be careful to not mix tabs and spaces. Each “block” of code should be indented one level.
  • Keeping line lengths of code to a reasonable maximum such that they fit in the default terminal screen width (80 characters wide).
  • Commenting (including function header comments).
  • Complete author identification on all files.
  • Appropriate identifier names.
  • Avoiding magic numbers.
  • Avoiding platform specific code such as the use of system() and the avoidance of system specific header files.
  • Checking the return values of important functions such as fopen(), malloc() and so on.
  • General code readability.

What to submit

Submit only the files needed to build your program – that is the files we have provided and any additional files you create. Do not submit for example the provided data files.

You must submit the files either in a zip file or a tar.gz file. No other formats will be accepted. Do not rename an archive compressed by another program as such a corrupt file will not be marked. You must use valid programs to do this compression. Please test your archives on titan prior to submission.

You will lose 10% of available marks for each day late that you submit. This means that if we mark your assignment and you get 55/100 and you submit 2 days late, you will receive 35/100. A day late is simply submitting after the deadline for that day. So submitting one hour late will result in a whole day’s deduction if you have not organised an extension with us.

 

Penalties    C 语言编程作业代写

Marks will be deducted for the following:

  • Compile errors and warnings.
  • Fatal run-time errors such as segmentation faults, bus errors, infinite loops, etc.
  • Files submitted in PC format (instead of Unix format). This can occur when transferring your files from home (PC) to saturn or jupiter (coreteaching01 or coreteaching02) (Unix).

You can remove extra end-of-line characters from PC formatted files using the dos2unix command or tr. Please see the UNIX Survival Guide for details on how to do this.

  • Missing files (affected components get zero marks).
  • Files incorrectly named, or whole directories submitted.
  • Not using startup code or not filling-in the readme file.
  • Not identifying yourself in all files submitted
  • Failure to remove default return values provided in the startup code when you implement the function.
  • Programs with compile errors that cannot be easily corrected by the marker will result in a maximum possible score of 40% of the total available marks for the assignment.
  • Outputting errors to stdout rather than stderr.

Any sections of the assignment that cause the program to terminate unexpectedly (i.e., segmentation fault, bus error, infinite loop, etc) will result in a maximum possible score of 40% of the total available marks for those sections. Any sections that cannot be tested as a result of problems in other sections will also receive a maximum possible score of 40%.

It is not possible to resubmit your assignment after the deadline due to mistakes.

 

General Submission Information    C 语言编程作业代写

Canvas is used for submission of all assignments. Assignments are not accepted by any other means (any attempts to submit via email will specifically be ignored).

You will be informed via the Canvas discussion board when Canvas submissions are opened. If you are unsure how to use Canvas for submissions, please ask your instructor – not knowing how to submit is no grounds for consideration. Don’t panic and leave it to the last minute!

Extensions of Time

You may apply for an extension of time by emailing the instructor at least one week before the due date but please note that I will only give extensions for extenuating circumstances.

Common requests for extensions such as “My hard disk crashed and I lost all my work.” won’t be accepted and we advise you to keep an up to date backup of all relevant source files. Likewise, applications for extensions based on working overtime or having a heavy study load will not be granted.

When/how do I get my marks?    C 语言编程作业代写

Assignment marks will be made available within 10 working days of the final submission deadline. An announcement will be made on Canvas when marks are available. An announcement will also be made with regards to what you need to do if there are any mistakes in your marks. You will also receive an email to your student email address explaining what you did well and how you could improve.

Help!   

Please utilise the following with regards to getting help for your assignments:

  • For general assignment questions, please use the Canvas discussion board. That way all students can see all questions once.
  • Please do not post large pieces of code to the Canvas discussion board for plagiarism reasons. Show your code to your lab assistant / tutor instead.
  • You are generally welcome to bring assignment-related questions to class.
  • If you are having problems that may prevent you from completing your assignment on time, please talk to someone as early as possible.

If you find any problems with the assignment specifications, please post your queries to the Canvas discussion board.

C 语言编程作业代写
C 语言编程作业代写

 

 

更多代写:cs代做功课  gre线上代考  英国英文写手招聘   英文论文写作  毕业论文英文  正规business代写

合作平台:essay代写 论文代写 写手招聘 英国留学生代写

 

天才代写-代写联系方式