question archive I have an EXTREMELY important assignment in which I need to program a 2D array (more information will be given in photos) using C language

I have an EXTREMELY important assignment in which I need to program a 2D array (more information will be given in photos) using C language

Subject:Computer SciencePrice:28.99 Bought11

I have an EXTREMELY important assignment in which I need to program a 2D array (more information will be given in photos) using C language. STYLING IS EXTREMELY IMPORTANT. Please, I need completely original (no copying from anywhere, no plagiarism please, ill be able to tell due to plagiarism checking software). If possible, it would be much appreciated, thank you!

COMP1511 21T3

CSE Valley

When the fire nation started attacking the COMP1511 Land, citizens were forced to go back to basics. They began farming to meet their daily needs. As an aspiring developer in COMP1511 Land, your first task is to create a simulation called cse_valley, which mimics everyone's environment.

Note: At time of release of this assignment (Week 4), COMP1511 has not yet covered all of the techniques and topics necessary to complete the later stages of the assignment. At the end of Week 3, the course has covered enough content to be able to read in a single command and process that input. However, you have not yet seen two dimensional arrays or be able to handle multiple commands ending in End-of-Input (Ctrl-D). We will be covering these topics in the lectures, tutorials, labs, and a live stream in Week 4. The links for these have been shared in the Week 4 announcement.

Overview

Assignment Livestream

The Assignment Livestream is scheduled for Thursday, Week 4 18:30-19:30. After that time, it will be available here.

The World!

cse_valley is a simple world, basically a grid and everything must occur here. Your job is to act as a farmer to seed, grow, harvest, and trade plants for your wellbeing. The success of your career depends on how you navigate this challenging world.

The image below visualises what this world looks like where you, the farmer, begin your journey!

Provided Structs

You have been provided with 3 existing struct data types to help you with your implementation of this simulation.

These structs and their purposes are shown below.

  • struct land
    • Purpose: To store the state of an individial block of land.
    • Contains:
      • intis_watered - represents if this particular block of land is currently watered.
      • charseed_name - stores the single letter name of the seed currently planted in this block of land.
    • Hint: You should not need to use this struct until Stage 2.
  • struct seeds
    • Purpose: To store information about a single type of seed.
    • Contains:
      • charname - stores the single letter name of this type of seed.
      • intamount - stores the number of available seeds to plant of this type (not including the amount currently planted).
    • Note: name is initialised to NO_SEED and seed can only have lowercase letters (i.e. between 'a' and 'z' inclusive) as its name.
  • struct farmer
    • Purpose: To store the current state of a farmer.
    • Contains:
      • intcurr_col - stores the current column coordinate of the farmer.
      • intcurr_row - stores the current row coordinate of the farmer.
      • intcurr_dir - stores a character representing the direction the farmer is currently facing.
    • Note: curr_dir can only have values of ><v, and ^, representing facing right, left, up, and down respectively.

For the first two stages, you will not need to modify any of the structs we have given you. However, in the later stages, you may need to make changes to the structs we have given you (or specifically, what is inside them).

The Commands

As part of running the simulation, you as the aspiring developer of COMP1511 Land need to allow for commands to be given to your program. These commands are how you will interact with the game. The simulation runs through 2 modes, setup and game.

  • Setup: This is where the user sets the number of and type of seeds initially avaliable to the farmer. This is further explained in Stage 1.1
  • Game: This is the main game mode. Commands are read in indefinitely, until EOF.
  • Each command given to the program will be a combination of char and integers.
  • There could be a large number of lines of input, so you must not store all the commands in an array — you should scan them in individually.
  • Depending on the initial command argument character, you will have to scan in a differing number of additional variables (called "arguments"). For example, in Stage 1.2, the “Printing One Seed” command requires a command argument s, followed by an additional argument that specifies the name of the seed to be printed.
  • The specifics of the commands are detailed in a series of stages below.

You can assume that your program will never be given a non-existent command or command arguments that are not of the right type.

 

Allowed C Features

In this assignment, there are no restrictions on C Features, except for those in the Style Guide.

We strongly encourage you to complete the assessment using only features taught in lectures up to and including Week 4. The only C features you will need to get full marks in the assignment are:

  • int variables
  • char variables
  • if statements, including all relational and logical operators
  • while loops
  • printf and scanf
  • structs
  • arrays, including two dimensional arrays
  • Your own helper functions

Using any other features will not increase your marks (and will make it more likely you make style mistakes that cost you marks).

If you choose to disregard this advice, you must still follow the Style Guide. You also may be unable to get help from course staff if you use features not taught in COMP1511.

Features that the Style Guide strongly discourages or bans will be penalised during marking.

Reference Implementation

To help you understand the proper behaviour of CSE Valley, we have provided a reference implementation. If you have any questions about the behaviour of CSE Valley, you can check them against this reference implementation.

To access the reference Implementation

1511 cse_valley

How To Get Started

There are a few steps to getting started with CSE Valley.

  1. Create a new folder for your assignment work and move into it.
    mkdir ass1
    cd ass1
  2. Download the starter code (cse_valley.c) here or use this command on your CSE account to copy the file into your current directory:

 

cp -n /web/cs1511/21T3/activities/cse_valley/cse_valley.c .
  • Run 1511 autotest to make sure you have correctly downloaded the file.
    1511 autotest cse_valley
  • Spend a few minutes playing with the reference solution -- get a feel for how the assignment works.
    1511 cse_valley
  • Read through Stage 1, which is below.
  • Think about your solution, draw a diagram of thefarm_land to help you get started
  • Start coding!

About the Starter Code

The provided starter code has done some setup for you. This is explained below.

Before the main function, the starter code has:

  1. Imported libraries, defined some initial #define's, and defined the structs described above
  2. Declared some functions, which are used to setup the game. You do not need to use these functions!
  3. Declared aprint_land function which you will have to use in stage 2.

In the main function, the starter code has:

  1. Declared and initialised an instance of a struct farmer called cse_farmer.
    • This sets farmer's curr_col and curr_row to be 0, and curr_dir to be >.
  2. Declared and initialised a 2D array of struct land called farm_land.
    • This will set everyis_watered to be FALSE and every seed_name to be NO_SEED for all elements on the 2D array.
  3. Declared and initialised a regular 1D array of struct seeds called seed_collection.
    • This will set everyamount to be 0 and every name to be NO_SEED for all elements in the array.
  4. This is where you write your code!

Your Tasks

This assignment consists of four stages. Each stage builds on the work of the previous stage, and each stage has a higher complexity than its predecessor. You should complete the stages in order.

  • Stage 1 ???
  • Stage 2 ???
  • Stage 3 ???

Stage 1

Why does this stage exist? This stage tests your ability to scan user input, create while loops, access values in an array, and traverse a one dimensional array. These are core skills in COMP1511 and also specifically in this assignment. You must display a basic understanding of how these work and how they can be applied in your own problem solving. Arrays are a common data structure used to store data on a computer and to help solve problems, which is the reason they form such a vital portion of the course.

Who do we expect to complete this stage? We hope that all students will be able to complete this stage.

What help will tutors provide to students? Tutors can give you a theoretical explanation, and give lots of help with the lab exercises that lead to this assignment. Tutors will be happy to help you debug any issues with your code.

How many marks will I get? Completing this stage, with good style, is worth around a 30% mark.

In this stage, you will implement:

  1. The ability to choose what seed types you would like to start with,
  2. The ability to print out the number of the different seed types that a farmer has,
  3. The ability to print out a specific type of seed and its amount.

1.1: Scanning Different Seed Names

To get everyone started with their farms, all farmers will receive 60 seeds each. As a farmer, you will be able to say how many different seeds you wish to have (from 1 to 5 inclusive) and what their different names are. The 60 seeds will be then split equally amongst the different seed names you have specified.

Invalid Inputs and Clarifications

  • We can assume that the farmer will only enter a number between 1 and 5 (inclusive) as the number of different seeds that they wish to have.
  • We can assume that the farmer will not put in the same seed names.
  • We can assume that the farmer will only put in a lowercase alphabet character for each different seed name.

To ignore possible whitespaces such as a newline, make sure to put a space before the %c when using the scanf function. For more information, please go to Slide 10 of Lecture 3 here .

Currently we have defined seed_collection to be an array of struct seeds. Your job is to modify the array to accommodate the seeds that were given to each farmer. Make sure that the order is right! For example, the first seed name to be scanned in should appear as seed_collection[0] and so on and so forth.

This is the only task that you have to implement on the setup component of the simulation. From this moment on, you will be dealing with the game component.

Example 1.1.1: Scanning in Seeds

1.2: Printing All Seeds

A farmer should be able to find out their seeds inventory. This is done in the simulation using the Printing All Seeds command. This command will print all the current seeds that a farmer has at their disposal, in the order the seeds were initialised.

The Printing All Seeds command is specified by the command argument a. The output should be given in the following format:

  Seeds at your disposal:
  - m seed(s) with the name 'n'
  ...

where m is the amount of seeds with the name n for all seeds that the farmer currently has.

Make sure that you do not print struct seeds that has NO_SEED as their name!

You may have to loop through the array seed_collection to access all the different seeds.

Example 1.2.1: Printing All Seeds

1.3: Printing One Seed

In order to be able to plan their day of seed planting, a farmer needs to be able to find out the amount of seeds of a particular type. This is done through the Printing One Seed command. The command is specified by the character s, followed by the seed_name the farmer wish to find out. The output should be given in the format:

  There are m seeds with the name 'n'

where m is the number of seeds and n is the name of the seed.

Invalid Inputs and Clarifications

  • If the farmer puts in an invalid seed name (i.e. something other than a lowercase letter), your program should give an output of:
      Seed name has to be a lowercase letter
    
  • If the farmer asks you to print out a valid seed name that you do not have in your collection, your program should give an output of:
      There is no seed with the name 'n'
    
    where n is the seed_name.

 

Example 1.3.1: Printing One Seed

Testing & Submission

Are you finished with this stage? If so, you should make sure to do the following:

  • Run 1511 style, and to clean up any issues a human might have reading your code. Don't forget -- 20% of your mark in the assignment is based on style!
  • Autotest for this stage of the assignment by running the autotest-stage command as shown below.
  • Remember -- give early, and give often. Only your last submission counts, but why not be safe and submit right now?
1511 style cse_valley.c
1511 autotest-stage 01 cse_valley 
give cs1511 ass1_cse_valley cse_valley.c

Table of Commands

Summary of All Commands

Stage Command Name Command Argument Additional Arguments
1.2 Printing All Seeds a  
1.3 Printing One Seed s seed_name
2.1 Printing Land l  
2.2a Moving Upwards ^  
2.2b Moving Right >  
2.2c Moving Downwards v  
2.2d Moving Left <  
2.3a Watering an Adjacent Land o w  
2.3b Planting on an Adjacent Land o p seed_name
2.4 Scattering Seeds p seed_name
3.1 Watering a Square w square_size
3.2a Advancing to the Next Day n  
3.2b Harvesting an Adjacent Plant h  
3.3 Trading Seeds t src_name src_amt dst_name
4.1 Expriencing Droughts d d min_num_plants_to_die
4.2 Experiencing Wind Storms d w min_num_plants_to_survive

Assessment

Assignment Conditions

  • Joint work is not permitted on this assignment.

    This is an individual assignment.

    The work you submit must be entirely your own work. Submission of any work even partly written by any other person is not permitted.

    Except, you may use small amounts (< 10 lines) of general purpose code (not specific to the assignment) obtained from a site such as Stack Overflow or other publically available resources. You should attribute clearly the source of this code in an accompanying comment.

    Assignment submissions will be examined, both automatically and manually for work written by others.

    Do not request help from anyone other than the teaching staff of COMP1511, e.g. in the course forum & help sessions.

    Do not post your assignment code to the course forum - the teaching staff can view assignment code you have recently autotested or submitted with give.

    Rationale: this assignment is designed to develop the individual skills needed to produce an entire working program. Using code written by or taken from other people will stop you learning these skills. Other CSE courses focus on the skill needed for work in a team.

  • The use of code-synthesis tools, such as GitHub Copilot, is not permitted on this assignment.

    Rationale: this assignment is intended to develop your understanding of basic concepts. Using synthesis tools will stop you learning these fundamental concepts.

  • Sharing, publishing, distributing your assignment work is not permitted.

    Do not provide or show your assignment work to any other person other than the teaching staff of COMP1511. For example, do not message your work to friends.

    Do not publish your assignment code via the internet. For example, do not place your assignment in a public GitHub repository..

    Rationale: by publishing or sharing your work you are facilitating other students using your work which is not permitted. If they submit your work, you may become involved in an academic integrity investigation.

  • Sharing, publishing, distributing your assignment work after the completion of COMP1511 is not permitted.

    For example, do not place your assignment in a public GitHub repository after COMP1511 is over.

    Rationale: COMP1511 sometimes reuses assignment themes using similar concepts and content. Students in future terms find your code and use it which is not permitted and you may become involved in an academic integrity investigation.

Violation of the above conditions may result in an academic integrity investigation with possible penalties, up to and including a mark of 0 in COMP1511 and exclusion from UNSW.

Relevant scholarship authorities will be informed if students holding scholarships are involved in an incident of plagiarism or other misconduct. If you knowingly provide or show your assignment work to another person for any reason, and work derived from it is submitted you may be penalised, even if the work was submitted without your knowledge or consent. This may apply even if your work is submitted by a third party unknown to you.

Note, you will not be penalised if your work is taken without your consent or knowledge.

For more information, read the UNSW Student Code, or contact the course account.

Submission of Work

You should submit intermediate versions of your assignment. Every time you autotest or submit, a copy will be saved as a backup. You can find those backups here, by logging in, and choosing the yellow button next to 'cse_valley.c'.

Every time you work on the assignment and make some progress you should copy your work to your CSE account and submit it using the give command below.

It is fine if intermediate versions do not compile or otherwise fail submission tests.

Only the final submitted version of your assignment will be marked.

You submit your work like this:

 

give cs1511 ass1_cse_valley cse_valley.c

Assessment Scheme

This assignment will contribute 15% to your final mark.

80% of the marks for this assignment will be based on the performance of the code you write in cse_valley.c

20% of the marks for this assignment will come from hand marking of the readability of the C you have written. These marks will be awarded on the basis of clarity, commenting, elegance and style. In other words, your tutor will assess how easy it is for a human to read and understand your program. The utility 1511 style can help with this!

Marks for your performance will be allocated roughly according to the below scheme.

100% for Performance Completely Working Implementation, which exactly follows the spec.
90% for Performance Completely working implementation of Stage 1, 2 and 3.
65% for Performance Completely working implementation of Stage 1 and 2.
50% for Performance Completely working implementation of Stage 1 and Stage 2, except for the Scattering Seeds command.
30% for Performance Completely working implementation of Stage 1.
20% for Performance Completely working implementation of Inheriting Seeds and Printing All Seeds commands.

Marks for your style will be allocated roughly according to the scheme below

100% for Style Perfect style
90% for Style Great style, almost all style characteristics perfect.
80% for Style Good style, one or two style characteristics not well done.
70% for Style Good style, a few style characteristics not well done.
60% for Style OK style, an attempt at most style characteristics.
<= 50% for Style An attempt at style.

The following is an indicative list of characteristics of your program that will be assessed, though your program will be assessed holistically so other characteristics may be assessed too:

  • Header Commenting (including your zID, and a short description of the program).
  • Consistent, sensible indenting.
  • Using Blank Lines & Whitespace.
  • Using constants.
  • Decomposing code into functions where relevant (especially after Stage 2).
  • Using comments effectively (at least at top of functions, and not containing irrelevant info).

Note that the following penalties apply to your total mark for plagiarism:

0 for the assignment Knowingly providing your work to anyone and it is subsequently submitted (by anyone).
0 for the assignment Submitting any other person's work. This includes joint work.
0 FL for COMP1511 Paying another person to complete work. Submitting another person's work without their consent.

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

Option 1

Low Cost Option
Download this past answer in few clicks

28.99 USD

PURCHASE SOLUTION

Option 2

Custom new solution created by our subject matter experts

GET A QUOTE

rated 5 stars

Purchased 11 times

Completion Status 100%