Page 1 of 1

Assignment 5A: Fibonacci Sequence. You may have learned about Fibonacci Sequences in high school or prior classes. To br

Posted: Fri Jul 08, 2022 6:15 am
by answerhappygod
Assignment 5a Fibonacci Sequence You May Have Learned About Fibonacci Sequences In High School Or Prior Classes To Br 1
Assignment 5a Fibonacci Sequence You May Have Learned About Fibonacci Sequences In High School Or Prior Classes To Br 1 (88.28 KiB) Viewed 47 times
Assignment 5a Fibonacci Sequence You May Have Learned About Fibonacci Sequences In High School Or Prior Classes To Br 2
Assignment 5a Fibonacci Sequence You May Have Learned About Fibonacci Sequences In High School Or Prior Classes To Br 2 (83.14 KiB) Viewed 47 times
Assignment 5a Fibonacci Sequence You May Have Learned About Fibonacci Sequences In High School Or Prior Classes To Br 3
Assignment 5a Fibonacci Sequence You May Have Learned About Fibonacci Sequences In High School Or Prior Classes To Br 3 (37.34 KiB) Viewed 47 times
Assignment 5A: Fibonacci Sequence. You may have learned about Fibonacci Sequences in high school or prior classes. To briefly summarize, it is a sequence that is created when you repeatedly add the two prior numbers in the sequence together. Here is an example of the first few numbers in the sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21... In CSE 1322L, we teach students how to create this sequence using an actranced concept called recursion. In this class however, we'll use arrays and loops. Your task is to do the following: Prompt the user to enter the length of the Fibonacci Sequence they want to make Validate that the number is greater than 0, and keep asking them until it is Use that number to initialize an empty array C++ Students: Watch the video posted on the FYE website or D2L to learn how to do this in your language- it's a little different from the Java and C# approach . . Initialize index 0 of the array to 0, and index 1 of the array to 1. Using a looping structure, fill the array with the correct Fibonacci sequence values Once the array is full, use another looping structure to print the sequence from the array Note: You must store the sequence in the array, and then print it in a separate loop from the one that created it. You can not print the values in the same loop where you create and store them in the array. Sample Output #1: [Fibonacci Sequence Generator] How long should the Fibonacci Sequence be?: -15 Sequences must be larger than 01 How long should the Fibonacci Sequence be?: 5 Okay, here's your sequence: 0, 1, 1, 2, 3 Sample Output #2: [Fibonacci Sequence Generator] How long should the Fibonacci Sequence be?: 12 Okay, here's your sequence: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89
Assignment 5B: Maze Game! 2D Arrays can be used to store and represent information about video game levels or boards. In this exercise, you will use this knowledge to create an interactive game where players attempt to move through a maze. You will start by creating a pre-defined 2D array with the following values: {"_""X""""X","X"} ","X","W"} """} "__" _"."X","X") {"X"."X","" You will then set the player (represented by "O") at index 0, 0 of the array, the top-left corner of the maze. You will use a loop to repeatedly prompt the user to enter a direction ("Left", "Right", "Up", or "Down"). Based on these directions, you will try to move the player. If the location is valid (represented by "_"), you will move the player there If the location is out of bounds (e.g. index 0, -1) or the command is invalid, you will inform the player and prompt them to enter another direction If the location is a wall (represented by "X"), you will tell the user they hit a wall and the game is over. . . . If the player did not lose, you will print out the current state of the map and ask them for a new direction. You will keep doing this until they lose or they reach the end (represented by the "W"). Sample Output #1: [Maze Game] 0.X._.X.X. _.X.X.W. X._. X.X. .X.X. Which direction do you want to move? Up You can't move there it's out of bounds! Which direction do you want to move? Down _.X.X.X. 0.X._.X.W. ..X.. X.X... X.X. Which direction do you want to move? Down .X.X.X. .X.X.W.
Which direction do you want to move? Down _.X._.X.X. _.X._.X.W. 0..X.. X.X. .X.X. Which direction do you want to move? Down You hit a wall Game Over! Sample Output #2: [Maze Game] 0.X.X.X. X._.X.W. X.. X.X. __.X.X. Which direction do you want to move? Eleventy That's not a valid direction! which direction do you want to move? Down X.X.X. 0.X.X.W. __X_ X.X. .X.X. Which direction do you want to move? Down XX.X. X. X.W. O..X.. X.X.___ .X.X. which direction do you want to move? Right _.X.X.X. _.X.X.W. 0..X.. X.X.. .X.X. which direction do you want to move? Right //Skipping ahead (This line is not part of the output) X.X.X. XX.W. X.0.. X.X. X.X. Which direction do you want to move? Up You win!