Welcome to CS Froggerl CS Frogger is an adaptation of the 1981 arcade action game, which you can play here. In this assignment you will be implementing 1091 's simplified version of this game and trying to get your Frogger to the other side of the riverl Please read most of the spec before starting the assignment (although you can save reading stages 2,3 and 4 for later). Nore: The assignment has been officially released - but may still have some small typos, or other issues! If you find any part of the assignment unclear, or has an incorrect specification, please let us know on the course forum! The spec should be treated as the source of truth, with the reference as tallback. If the reference seems incorrect - the spec should take priority, and the reference will be updated to match the spec. Assignment Structure This assignment will test your ability to create, use and manipulate 2D arrays and structs to solve problems. To do this, the gameboard has been implemented as a 2D array of tiles. The tiles are represented by a struct, which is outlined below: - Purpose: a To store information about the tiles on the gameboard. - Contains: - The type of the gameboard tile. - The types are listed in the provided enum. These indude water, turte. bank, etc. - An integer that keeps track of if Frogger is on the tile. - The state of this variable should either be TRUE or FALSE. HINT: Remember to initialise every field inside the structs when creating them (not just the fields you are using at that moment!). Commands To make the game usable and playable you will need to setup and manage the gameboard, as well as implement handy commands like adding logs moving Frogger, and modifying the board. 1. Setup Mode (Stage 1.1) : Set up and initialise the gameboard, as well as printing out the gameboard and starting to add components to it. 2. Command Mode (Stage 1.2 onward) : The program now reads commands continuously until , or you win/lose the game. Each command will begin with a character and then potentially have integers after it. - The number of arguments in a command depends on the first character. For example, to add a log the command is 1 followed by 3 integers, whereas clearing a row on the board, s, requires 1 following integer. 3. Game Mode (Stage 4) : Now the gameboard rows can move, making it more difficult for 3. Game Mode (Stage 4) : Now the gameboard rows can move, making it more difficult for Frogger to reach the other side. Similar to command mode, it takes command but only some of them are valid. These are further detailed in Stage 4. You can assume that your program will never be given a non-existent command or command arguments that are not of the right type unless explicitly told otherwise. Commands will always start with a character. How To Get Started There are a few steps to getting started with CS Frogger. 1. Create a new folder for your assignment twork and move into it. $ mikdir assi $ cd assi 2. Download the starter code (cs frogger.c) here or use this command on your CSE account to copy the file into your current directory: 5 cp -n/web/dp1091/23T1/activities/cs_frogger/cs_frogger.c. 3. Run to make sure you have correctly downloaded the file 4. Read through Stage 1. 5. Spend a few minutes playing with the reference solution .- get a feel for how the assignment works. $1091 cs_frogger 6. Think about your solution, draw some diagrams, write some pseudocode to help you get started. HINT: You might also find it helpful to draw diagrams and write pseudocode between later stages, especially stage 3 and stage 4 ! 7. 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 the standard input/output library. 2. Defined some initial is and enums. 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 the standard input/output library. 2. Defined some initial 's and enums. 3. Defined the struct described above. In the main function, the starter code: 1. Printed a welcome message 2. Created a 2D array of stnuct boand tilie s called 3. Prompts you to write your own code! HINT: To start with, feel free to write your code in the main function! You can also add in your own functions as you go - we would definitely recommend this :) 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. 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 Why does this stage exist? This stage exists to test your basic understanding of arrays, and how to scan into, and print from a two-dimensional array structure. 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, will contribute about 35% to your overall assignment mark. Why does this stage exist? This stage exists to test your basic understanding of arrays, and how to scan into, and print from a two-dimensional array structure. 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 debgg any issues with your code. How many marks will I get? Completing this stage, with good style, will contribute about 35% to your overall assignment mark. In this stage you will: - Set up and initialise the game board - Add turtles to the game board. - Print out the game board. - Add logs to the game board. In stage 1.1, we will initialize the provided variable. Overview This assignment operates in 3 modes: the setup mode, command mode, and game mode. Please ensure you are familiar with the starter code, as it contains the basis for this task (and the whole assignment). You should initialise the variable so that the BANK, the WATER, and the LILLYPADs are on the game board. The set up will look the same each time, where: - the BANK is the bottom row with the.FROG in the middle, - the LILLYPADs are in the top row an alternating. - and the rest should be the WATER. It may look like the image below: \begin{tabular}{ll} \hline & water \\ X & bank \\ O & lilypad \\ T & turtle \\ L & log \\ F & Frogger \\ B & bug \\ S & super bug \end{tabular} Diagrams Key: - Rows are horizontal going left to right. - Columns are vertical going from the top to the bottom. - Blue is the water. - Green is the bank. - Purple are the lillypads. - Orange are turtles. - Brown are logs. - Fdenotes that Frogger is on that tile. - (for Stage 3 onwards) B denotes that a bug is on that tile. - (for stage 4 onwards) S denotes that a superbug is on that tile. The frog isn't its own tile. Each tile has an occupied field and when the frog is on that tile, this field should be set to TRUE, otherwise it is set to - Example 1.1.1: Initialization of game board $./cs_frogger Welcome to CSE Frogger! How many turtles? Game started 00000 F Enter command: Thank you for playing CSE Froggerl Welcome to CS Froggerl CS Frogger is an adaptation of the 1981 arcade action game, which you can play here. In this assignment you will be implementing 1091 's simplified version of this game and trying to get your Frogger to the other side of the riverl Please read most of the spec before starting the assignment (although you can save reading stages 2,3 and 4 for later). Nore: The assignment has been officially released - but may still have some small typos, or other issues! If you find any part of the assignment unclear, or has an incorrect specification, please let us know on the course forum! The spec should be treated as the source of truth, with the reference as tallback. If the reference seems incorrect - the spec should take priority, and the reference will be updated to match the spec. Assignment Structure This assignment will test your ability to create, use and manipulate 2D arrays and structs to solve problems. To do this, the gameboard has been implemented as a 2D array of tiles. The tiles are represented by a struct, which is outlined below: - Purpose: a To store information about the tiles on the gameboard. - Contains: - The type of the gameboard tile. - The types are listed in the provided enum. These indude water, turte. bank, etc. - An integer that keeps track of if Frogger is on the tile. - The state of this variable should either be TRUE or FALSE. HINT: Remember to initialise every field inside the structs when creating them (not just the fields you are using at that moment!). Commands To make the game usable and playable you will need to setup and manage the gameboard, as well as implement handy commands like adding logs moving Frogger, and modifying the board. 1. Setup Mode (Stage 1.1) : Set up and initialise the gameboard, as well as printing out the gameboard and starting to add components to it. 2. Command Mode (Stage 1.2 onward) : The program now reads commands continuously until , or you win/lose the game. Each command will begin with a character and then potentially have integers after it. - The number of arguments in a command depends on the first character. For example, to add a log the command is 1 followed by 3 integers, whereas clearing a row on the board, s, requires 1 following integer. 3. Game Mode (Stage 4) : Now the gameboard rows can move, making it more difficult for 3. Game Mode (Stage 4) : Now the gameboard rows can move, making it more difficult for Frogger to reach the other side. Similar to command mode, it takes command but only some of them are valid. These are further detailed in Stage 4. You can assume that your program will never be given a non-existent command or command arguments that are not of the right type unless explicitly told otherwise. Commands will always start with a character. How To Get Started There are a few steps to getting started with CS Frogger. 1. Create a new folder for your assignment twork and move into it. $ mikdir assi $ cd assi 2. Download the starter code (cs frogger.c) here or use this command on your CSE account to copy the file into your current directory: 5 cp -n/web/dp1091/23T1/activities/cs_frogger/cs_frogger.c. 3. Run to make sure you have correctly downloaded the file 4. Read through Stage 1. 5. Spend a few minutes playing with the reference solution .- get a feel for how the assignment works. $1091 cs_frogger 6. Think about your solution, draw some diagrams, write some pseudocode to help you get started. HINT: You might also find it helpful to draw diagrams and write pseudocode between later stages, especially stage 3 and stage 4 ! 7. 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 the standard input/output library. 2. Defined some initial is and enums. 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 the standard input/output library. 2. Defined some initial 's and enums. 3. Defined the struct described above. In the main function, the starter code: 1. Printed a welcome message 2. Created a 2D array of stnuct boand tilie s called 3. Prompts you to write your own code! HINT: To start with, feel free to write your code in the main function! You can also add in your own functions as you go - we would definitely recommend this :) 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. 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 Why does this stage exist? This stage exists to test your basic understanding of arrays, and how to scan into, and print from a two-dimensional array structure. 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, will contribute about 35% to your overall assignment mark. Why does this stage exist? This stage exists to test your basic understanding of arrays, and how to scan into, and print from a two-dimensional array structure. 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 debgg any issues with your code. How many marks will I get? Completing this stage, with good style, will contribute about 35% to your overall assignment mark. In this stage you will: - Set up and initialise the game board - Add turtles to the game board. - Print out the game board. - Add logs to the game board. In stage 1.1, we will initialize the provided variable. Overview This assignment operates in 3 modes: the setup mode, command mode, and game mode. Please ensure you are familiar with the starter code, as it contains the basis for this task (and the whole assignment). You should initialise the variable so that the BANK, the WATER, and the LILLYPADs are on the game board. The set up will look the same each time, where: - the BANK is the bottom row with the.FROG in the middle, - the LILLYPADs are in the top row an alternating. - and the rest should be the WATER. It may look like the image below: \begin{tabular}{ll} \hline & water \\ X & bank \\ O & lilypad \\ T & turtle \\ L & log \\ F & Frogger \\ B & bug \\ S & super bug \end{tabular} Diagrams Key: - Rows are horizontal going left to right. - Columns are vertical going from the top to the bottom. - Blue is the water. - Green is the bank. - Purple are the lillypads. - Orange are turtles. - Brown are logs. - Fdenotes that Frogger is on that tile. - (for Stage 3 onwards) B denotes that a bug is on that tile. - (for stage 4 onwards) S denotes that a superbug is on that tile. The frog isn't its own tile. Each tile has an occupied field and when the frog is on that tile, this field should be set to TRUE, otherwise it is set to - Example 1.1.1: Initialization of game board $./cs_frogger Welcome to CSE Frogger! How many turtles? Game started 00000 F Enter command: Thank you for playing CSE Froggerl