A mini-programming project Brand Development INNOVATIVE THINKING AND CREATIVITY Talent Creation and Development Our Industry at …

FIND A SOLUTION AT Academic Writers Bay

CSP2151 Assignment 2: A mini-programming project
General Information:
This assignment is an extension of the Workshops you have been doing during the semester.
Where appropriate, the standards set out in previous workshops should be followed and the
code must make good use of arrays, structures, and control flows, etc.
Assignment type: individual work (i.e., not a group assignment)
The tasks:
Design and implement (in C) the following tasks to complete and manage the robot combat
Your program should first load the information of up to 10 robots from a file, named “Robot.txt”,
and store the information in an array of (structure of) robots. Use a variable, say robot_count, to
keep track of the number of robots stored in the array of robots.
To create a structure of robot for the robot combat simulation, you may refer to the structure of a robot that
you used in your Workshop 3, with an additional field, Best_score, that stores the highest score the robot has
ever achieved during a series of robot combat simulations. For example, you may define a new robot
structure with at least 6 fields, Robot_number, Robot_name, Year_manufactured, Top_speed, Mass,
Best_score. The Best_score field should be initialised 0.0 for all robots to indicate that no simulation has ever
been done to the individual robot. You may add any extra field/s as needed. The value of Best_score field
might be updated after any robot combat simulation.
The program then displays all available robot information stored in the array of robot (using a
tabular format). It then displays a Menu that allows the user to navigate through and execute
the following options:
1. Simulate a robot against a human opponent
2. Display simulation results
3. Display winners
4. Search a robot by robot_number or by robot_name
5. Input/update robot information
6. Save all results
7. Save robot information
8. Exit
Menu design/implementation requirement:
Create one function for each menu item (i.e., to implement its feature/s). If any of these functions was
not implemented as required in the final submission, use a dummy function that prints the following
statement only:
“<menu item name> feature has not been completed yet.”
For example, if the “Save all results” feature was not completed at submission, the function should
print the following statement only:
“Save all results feature has not been completed yet.”
The “Simulate a robot against human opponents” feature should allow the user to select ONE
robot from the array of robots, and then simulate a robot combat against human opponents.
This feature can also be named “robot test”. The simulation result should be stored in the array
of structure created for the simulation result. The structure of the simulation results and of
robot simulation task are described in Section (1) and (2), see details in the next page).
The “Display simulation results” feature should allow the user to choose a robot by robot name
and display all simulation results of the robot (if any). If the robot has not yet been tested (i.e.,
no simulation was recorded), the program should display an error message, informing the user
that they must test that robot before displaying any results of the robot. If multiple robots have
the same name (e.g., each with a different robot number), all simulation results for robots with
that name should be displayed.
As a special case, if the robot name entered is “all”, the program should display the simulation
results of all robots that have been tested. If none of robots have been tested, an error message
should be displayed.
The “Display winners” feature should display an error message if no robot has been tested.
Otherwise it should display the top one robot in speed (one with highest speed), the top one
robot in strength and the top one robot in combat-effectiveness (i.e., a total of 3 results) of all
robots that have been tested.
The “Search a robot by robot_number or by robot_name” feature should allow the user to choose
to search for information of a robot either by Robot_number or by robot_name, say, by
providing a sub-menu:
1. Search by robot number
2. Search by robot name
In case the user chooses to search robots by robot number, the program searches the robot
from the array of robots based on value of the Robot_number field. If found successfully, the
information stored in the related entry/entries in the robot array will be displayed. Otherwise,
an error message should be displayed. As a special case, if the robot number entered is -1, it
displays information for all robots.
On the other hand, if the user chooses to search robots by robot name, the program does a
similar search, but it searches robot information by Robot_name field instead of Robot_number.
As a special case, if the robot name entered is “all”, it displays information for all robots.
The “Input/update robot information” feature allows the user to input or update information of
ONE robot. It prompts the user input a Robot_number. If the Robot_number entered matches an
existing robot, the information entered is used to update the information of the robot stored in
the array of robots. Otherwise a new entry should be created in the array of robots and
information be stored in the new entry (and the total number of robots should be increased).
The “Save all results” feature should display an error message if no robot has been tested.
Otherwise it creates a file, named “Results.txt”, and save the test results for all robots that have
been tested to that file.
The “Save robot information” feature should extract all robot information stored in the robot
array and save them back to the “Robot.txt” file for possible future tests. For simplicity, only the
first (up to) 10 pieces of information of robots are required to save.
(1) The data structures for robot simulation result
To save the robot simulation result, you should create an array of structure for the simulation
results and use it to save all simulations results. The simulation structure may have the following
fields (you may add extra fields as needed):
• Test ID
• Robot_number // or Robot_name?
• Finish_line_distance //Test conditions starts here
• Finish_line_time;
• Strength
• Test_score //combat_effectiveness -the test results
(2) Robot combat simulation
This task simulates a robot test scenario, completing calculations on various data items,
updating simulation results, and displaying test result.
At the start, the function/program prompts the user to choose ONE robot from the available
robots. It then prompts user to enter a variety of test conditions (including the
finish_line_distance, finish_line_time, and strength, of the robot ) for the robot
A simulation of a robot combat simulation can be much more complicated in the real-world scenario,
as there would be many more variables to consider when designing such a system. We will only
design and implement a simplified version of such a system in this assignment.
Robot combat simulation can be done automatically (i.e., under random conditions: test data and
conditions are randomly generated within a reasonable value range), or manually (i.e., by entering a
set of test data or condition), or in a hybrid case (i.e., in a weighted combination of the above two
cases). – Due to time and workload constraints, we only perform a simulation manually in this
assignment (that is, simulation data and/or conditions are entered manually).
The test conditions are set as follows and must comply with the listed restrictions:
The test conditions are set as follows and must comply with the listed restrictions:
• finish_line_distance
o Measured in meters
o Must be in float data type, with value greater than or equal to 0.0
• finish_line_time
o Measured in second
o Must be in float data type, with value greater than 0.0
• strength
o Is the number of objects the robot can lift
o Must be in int data type, with value in the range from 0 to 100
If the user enters an invalid value for any test condition, the program should print an error
message, together with the data entered, and continue to prompt user again until a valid value is
Based on the information entered, the simulation calculates various data items, including speed
and combat_effectiveness of the robot participating the simulation. The simulation is done the
same way as that described in Workshop 2, plus the following additional task/s: Once completed
the simulation calculation, it then compares the current combat_effectiveness value with the
value stored in the Best_score field in the related entry of the robot array. If the current
combat_effectiveness value is greater than that entry value, it offers an opportunity for the user
to accept (thus to replace the Best_score of relevant robot/s) or discard the result.
Finally, it displays simulation result (together with test conditions) in a properly designed table.
An example table may look like:
Robot Test Result
Test ID (optional):
Robot information:
? ? ? ? ? ?
Test conditions:
Simulation result:
where a question mark (“?”) is the value calculated (entered or taken from relevant array/s).
The program then offers the option of saving this output to the results array before starting
a new simulation or quitting.
(3) Some technical requirement for file I/O
File I/O should only be used when necessary. For example, file I/O should only be used in
the code part of implementing menu items 6 (i.e., Save all results) and 7 (i.e., Save robot
information), and at the very beginning when the program loads robot information into the
robot array. All other simulation operations should be done using value/s of variables,
arrays and/or structures in memory.
Bonus Mark (up to 4 marks):
Additional work and effort to improve the program and make it more useful can be worth bonus
marks. Bonus marks are not required and will not improve your grade above 100%. – Please do not
attempt tasks for bonus mark before you’ve attempted all required tasks of the assignment.
Examples of features that may be worth bonus marks:
• Advanced search features (search for all simulation/test results above a threshold value,
e.g., an input value)
• Use multiple files effectively with appropriate use of header files and good separation of
• Graphical user interfaces, animations, or colours.
• Ask your tutor if you have any other ideas of improvement to the program!
(Note: To obtain the Bonus mark, a new version of C code should be submitted. That is: you need to submit
two versions of codes: one version only completed the required Assessable tasks without any work for Bonus
mark, and the other version serves as an advanced version that includes the work for the required Assessable
tasks together with the work for the bonus mark. For example, you may name your codes “Assignment2.c”
and “Assignment2_bonus.c”, respectively.)
NOTE: The Workshops have been working up to this point to provide you with a base program of
your own work that should give you the best possible opportunity for completing this assignment.
You should look to how these Workshops have developed your work for a guide on how to structure
your final assessment.
Design and coding requirements:
• The design: For this assignment, you can use either pseudocode or flowchart (but not mixed
using both) to complete the design. Your design file should contain separate designs for each
of your functions.
Please ensure that you include the information such as unit code, Assignment and number,
year and semester, and your name and student number, etc. in the header/footer area (or
somewhere else in the first page) of the Design file.
• The code: Your C code must be consistent with your design.
All printing for robot/s (and searching results etc.) on screen should use tabular format (e.g.,
the top line as a heading line, and lines following the heading line containing data items
This is the major assignment of the unit, assessing your ability to solve problems and your
knowledge/skills in designing and implementing a medium-sized program based on a given
application scenario. You should use correct control structures (sequence, decisions, and
loops, functions, etc.) and appropriate or required data structures (arrays, strings, pointers,
files, etc.) to implement the program. The only Libraries to be used in this assignment are
<stdio.h>, <stdlib.h>, <time.h>, <math.h>, <string.h>, <errno.h>, and <IO.h>, together with
the only head files you created as a part of this assignment work, if any. Other non-standard
or any third-party libraries/packages should not be included/used in the code/s!
Academic Integrity and Misconduct
• This assignment is an individual work (not a teamwork). Your entire assignment must be your
own work (unless quoted otherwise) and produced for the current instance of the unit. Any
use of uncited content that was not created by you yourself constitutes plagiarism and is
regarded as Academic Misconduct. All assignments will be submitted to plagiarism checking
software, which compares your submission version with previous copies of the assignment,
and the work submitted by all other students in the unit (in the current semester or previous
• Never give any part of your assignment to someone else, even after the due date or the
results are released. Do not work on individual assignment with other students. – You can
help someone by explaining concepts, demonstrating skills, or directing them to the relevant
resources. But doing any part of the assignment for them or with them or showing them your
work is inappropriate. An unacceptable level of cooperation between students on an
assignment is collusion and is deemed an act of Academic Misconduct. If you are not sure
about plagiarism, collusion or referencing, simply contact your lecturer or unit coordinator.
• You may be asked to explain and demonstrate your understanding of the work you have
submitted. Your submission should accurately reflect your understanding and ability to apply
the unit content and the skills learnt from this unit.
• Before submitting your assignment 2, make sure you have checked all items in the Academic
Integrity tick-before-submit checklist below and watch the video by clicking the link next to
the checklist image:
Watch this video before submitting your assignment
Indicative Marking Guide:
Design (flow controls, function design, etc.)
System menu and related functions (except for simulation part)
Simulation & calculation, etc.
File I/O
Code Legibility (formatting/indenting, comments, readability, etc.)
Data structures (array of structs, variables, etc.)
Program logic (flow controls, functions, data storage, efficiency)
Executable and outputs
Overall (e.g., submission following Submission requirement, functionality
of the code/s, etc.)
Mark cut (e.g., global variables, breaking scope, use goto statement, etc.)
Assignment Submission Requirements:
• You are required to submit through BB a .zip file containing at least four files:
(i) a design document (in Word or PDF format);
(ii) a C source code/s (in *.c format);
(iii) an executable code (in *.exe format); and
(iv) the text file, Robot.txt, that stores your pre-set robot information.
Your code should load information from this file when it starts running;
An additional C code (e.g., Assignment2_bonus.c), together with its corresponding executable
code, may also be included in the .zip file if you have attempted the work for bonus marks.
Again, unless specifically instructed, email or paper submission is not allowed.
• Please rename your .zip file as
CSP2151_Assignment3_<Your Student ID>_< Your full name>.zip.
and submit the single .zip file only.
• Double check all documents/codes constianed in your submission/zip file and make sure they are the
correct version/s before submitting – It is recommended that you complie and run your code/s again
before submission, to avoid submitting incorrect file versions for marking.
• If you encounter any difficulties when submitting assignment solution through Blackboard, please
contact your tutor (Jitian, via j.xiao@ecu.edu.au or Kan, via k.yu@ecu.edu.au) and briefly explain the
difficulties you experienced (e.g., BB was down, BB doesn’t accept specific type of files, etc.).
• Please keep the copy of the assignment verion you submitted (in case your submission to BB was
corrupted and you may be requested to provide the same copy again).
Not proficient
Low Proficiency
High Proficiency

Design not present or
does not meet
Design has logical flaws or
does not meet all
Design meets some requirements
but not all or has significant
formatting issues
Design meets most
requirements but has
some issues
Design meets all requirements
Menu items &
related functions

Menu/functions not
Two or less Menu
/functions present and are
poorly implemented
Up to four Menu/functions
implemented and work properly
Up to six Menu/functions
implemented and work
All Menu/functions fully
implemented and work

calculation not
Few calculations are
present, but do not work
Simulation calculation
are all present but
contain small errors.
Simulation calculation are
present and work as intended
File I/O

File I/O not present
File I/O not present but not
File I/O present but has
some errors
Functions are present and
work as intended
Code Legibility

Code is very difficult
to read
Code is well written and
highly readable
Data structures

Struct, and array of
structs not used
Structs, array of structs fit to
Program logic

Functions and/or
arrays not present or
program is very
poorly structured
Few functions and/or
arrays are presented, or
program is very poorly
Functions and/or arrays are
presented but program is poorly
Functions and arrays are
present but with some
small issues of program
Program is well structured

Code does not
Code compiles with no
Executable and

Output is incorrectly
formatted, and no
executable code seen
Output is correct but could be
formatted better, executable code is
seen, with running issue
Executable is OK, Output is
correct and formatted

Requirement not
All requirement not followed, and
code functions well
All requirement followed, and
code well functioned

YOU MAY ALSO READ ...  Building a successful social media campaign
Order from Academic Writers Bay
Best Custom Essay Writing Services