1.9.5: Take 'em All 1.9.6: Dizzy Karel 1.9.7: For Loop Square 1.9.8: Lots Of Hurdle 1.10.5: Is There A Ball? 1.11.5: Right Side Up 1.12.4: Follow The Yellow Ball Road 1.12.5: Lay Row Of Tennis Balls 1.12.6: Big Tower 1.13.4: Random Hurdles And More Codehs

25 July 2022
4.7 (114 reviews)
17 test answers

Unlock all answers in this set

Unlock answers (13)
question
1.9.5: Take 'em All
answer
function start(){ // Write your code here move(); for(var i = 0; i < 100; i++){ takeBall(); } move(); }
Explanation: The phrase take 'em all" is a very colloquial way of saying "take them all." In other words, it means to take everything or to take all of something."
question
1.9.6: Dizzy Karel
answer
function start(){ for(var i = 0; i < 32; i++){ turnLeft(); } }
Explanation: Karel is a robot who lives in a world full of walls and doors. Karel can only turn left, but he can move forward and backward. Karel's world is also full of beepers. A beeper is a special marker that Karel can pick up and put down. When Karel picks up a beeper, he puts it in his beeper bag. Karel can also use his beeper bag to put down a beeper.Karel is given a specific set of instructions, and he will follow those instructions exactly. However, sometimes Karel may get confused and end up in a different part of the world than he is supposed to be. When this happens, Karel is said to be dizzy.""
question
1.9.7: For Loop Square
answer
function start(){ for(var i = 0; i < 4; i++){ move(); turnLeft(); putBall(); } }
Explanation: The for loop square is a looping construct that allows you to repeat a block of code a set number of times. The syntax for a for loop square is:for(initialization; condition; increment) { // Statements go here } The initialization statement is executed once at the beginning of the loop. This statement typically initializes a counter variable. The condition statement is evaluated before each iteration of the loop. If the condition evaluates to true, the code block will be executed. If the condition evaluates to false, the loop will terminate. The increment statement is executed after each iteration of the loop. This statement typically increments the counter variable.The code block within the for loop will execute once for each value of the counter variable. In the example below, the code block will execute four times, once for each value of i from 1 to 4.for(int i=1; i<=4; i++) { System.out.println(i is: " + i)
question
1.9.8: Lots of Hurdles
answer
function start(){ for(var i = 0; i < 5; i++){ move(); move(); turnLeft(); move(); turnRight(); move(); turnRight(); jumpHurdle(); turnLeft(); } } function jumpHurdle(){ move(); }
Explanation: There are a lot of hurdles to overcome when starting a business. You need to have a great idea, a solid business plan, the right team in place, and the ability to execute your plan. raising capital can be one of the biggest hurdles, as you need to convince investors that your business is worth investing in. Once you've overcome all of these hurdles, you still need to contend with the day-to-day challenges of running a business, such as making sure your product or service is of high quality, keeping your customers happy, and dealing with any unexpected problems that arise.
question
1.10.5: Is There a Ball?
answer
function start(){ safePutBall(); move(); } function safePutBall(){ if(noBallsPresent()){ putBall(); } }
Explanation: The answer to this question depends on the interpretation of the word ball." If the word "ball" is interpreted to mean a physical object that can be thrown and caught, then the answer is likely "no." However, if the word "ball" is interpreted to mean a concept or an idea, then the answer is "yes.""
question
1.11.5: Right Side Up
answer
function start(){ if (facingSouth()) { turnLeft(); } if (facingWest()) { turnAround(); } }
Explanation: The answer to this question depends on the context in which it is used. If someone were to ask you if a particular object were right side up, they would be asking if it were oriented in a way that the top was up and the bottom was down. However, if someone were to ask you if you were right side up, they would be asking if you were oriented in a way that your head was up and your feet were down. In other words, they would be asking if you were standing up.
question
1.12.4: Follow The Yellow Ball Road
answer
function start() { while(ballsPresent()){ move(); } }
Explanation: In the game, the player controls a yellow ball that leaves a trail of yellow balls behind it. The goal of the game is to reach the end of the road without hitting any obstacles. The road is filled with obstacles such as cars, trucks, and other balls. The player must use their mouse to guide the yellow ball through the obstacle-filled road.
question
1.12.5: Lay Row of Tennis Balls
answer
function start(){ while(frontIsClear()){ putBall(); move(); } putBall(); }
Explanation: When tennis players are warming up for a match, they often times will lay down a row of tennis balls and practice their swings, making sure to hit each ball in succession. This is a great way to get some extra practice in and make sure that your swings are consistent.
question
1.12.6: Big Tower
answer
function start(){ north(); clear(); putBall(); } function clear(){ while (frontIsClear()) { putBall(); move(); } } function north(){ while (notFacingNorth()) { turnLeft(); } }
Explanation: The Big Tower is a large structure located in the middle of the Big Island. It is one of the most famous landmarks on the island and is a popular tourist destination. The tower is made of stone and is several stories tall. It has a large clock on the top level that can be seen from anywhere on the island. The Big Tower is also home to a number of businesses, including a restaurant and a gift shop.
question
1.13.4: Random Hurdles
answer
function start(){ for (var i = 0; i < 13; i++) { if (frontIsClear()) { move(); } else { jumpHurdle(); } } } function jumpHurdle(){ turnLeft(); move(); turnRight(); move(); turnRight(); move(); turnLeft(); }
Explanation: In the game of hurdles," players attempt to jump over randomly placed obstacles. The game is played on a field with a number of obstacles, each of which has a certain height. The heights of the obstacles are chosen at random, and the player must jump over each obstacle in turn.The goal of the game is to clear all of the obstacles in the shortest time possible. The player can either jump over the obstacle, or go around it. If the player jumps over the obstacle, then they must land on their feet in order to continue the game. If the player goes around the obstacle, then they can either slow down or speed up, but they cannot change direction.There are a few things to keep in mind in order to do well in this game. First, the player must be able to judge the height of the obstacle and the distance to it in order to jump over it. Second, the player must be able to control their speed in order to make it around the obstacle without running into it. Finally, the player must be able to change direction quickly in order to avoid the obstacles."
question
1.15.4: Diagonal
answer
function start(){ while(frontIsClear()){ putBall(); move(); turnLeft(); move(); for(var i = 0; i < 3; i++){ turnLeft(); } } putBall(); }
Explanation:In the game of hurdles," players attempt to jump over randomly placed obstacles. The game is played on a field with a number of obstacles, each of which has a certain height. The heights of the obstacles are chosen at random, and the player must jump over each obstacle in turn.The goal of the game is to clear all of the obstacles in the shortest time possible. The player can either jump over the obstacle, or go around it. If the player jumps over the obstacle, then they must land on their feet in order to continue the game. If the player goes around the obstacle, then they can either slow down or speed up, but they cannot change direction.There are a few things to keep in mind in order to do well in this game. First, the player must be able to judge the height of the obstacle and the distance to it in order to jump over it. Second, the player must be able to control their speed in order to make it around the obstacle without running into it. Finally, the player must be able to change direction quickly in order to avoid the obstacles."
question
1.15.5: Staircase
answer
function start(){ putBall(); while(frontIsClear()){ turnLeft(); while (ballsPresent()) { move(); } turnRight(); move(); createStep(); } } function createStep() { turnRight(); putBall(); while (frontIsClear()) { move(); putBall(); } turnLeft(); }
Explanation: A staircase is a set of steps leading from one floor to another, typically inside a building. A staircase may be straight, round, or may consist of two or more straight pieces connected at angles.
question
1.16.1: Fetch
answer
function start() { movee(); turnLeft(); move(); move(); move(); move(); turnLeft(); move(); takeBall(); move(); move(); turnLeft(); moveee(); turnLeft(); putBall(); } //Move three function movee(){ move(); move(); move(); } function moveee(){ move(); move(); move(); move(); }
Explanation: ing data from the networkFetching data from the network generally refers to retrieving data from a remote server or other online source, as opposed to loading data from a local file or database. This can be done using a variety of different protocols, such as HTTP, FTP, or even email. In most cases, the data will be in some kind of standard format such as XML or JSON, which can be parsed and processed by the client application.
question
1.16.2: Racing Karel
answer
function start() { trackTurn(); trackTurn(); trackTurn(); trackTurn(); } function trackTurn(){ for (var i = 0; i < 4; i++) { while (frontIsClear()) { move(); } for (var i = 0; i < 8; i++) { putBall(); } turnLeft(); } } function adf(){ move(); } function adsfm(){ turnRight(); } //havetime
Explanation: Karel is a robot that lives in a rectangular world. The world is divided into streets (the horizontal lines) and avenues (the vertical lines). Karel starts at a specific intersection and can move forward one block at a time. Karel can also turn left or right.Karel's goal is to race to the finish line as quickly as possible. Karel can only move forward one block at a time, so she must be careful not to run into any walls or obstacles.
question
1.16.3: Tower Builder
answer
function start(){ buildTower(); move(); comeDown(); if(frontIsClear()){ move(); move(); buildTower(); move(); comeDown(); if(frontIsClear()){ move(); } if (frontIsClear()){ move(); buildTower(); move(); comeDown(); } } if (frontIsClear()){ move(); move(); buildTower(); move(); comeDown(); move(); } } function comeDown(){ turnAround(); move(); move(); move(); turnLeft(); } function buildTower(){ turnLeft(); putBall(); move(); putBall(); move(); putBall(); } //opopopopopopopop
Explanation: This question is asking for the reader to create a function that takes in an array of integers and returns an array of strings. The function should output a string for each element in the array, with the string representing the height of a tower that the element could represent. The function should output the tallest tower possible for each element in the array.For example, if the input array was [1, 2, 3], the function should output [1", "22", "333"]."
question
1.16.4: Super Cleanup Karel
answer
function start(){ while(leftIsClear()){ cleanUpRow(); } finish(); } function cleanUpRow(){ while(frontIsClear()){ if(ballsPresent()){ takeBall(); } move(); } blockedWall(); } function blockedWall(){ if(ballsPresent()){ takeBall(); } turnLeft(); move(); turnLeft(); while(frontIsClear()){ move(); } turnAround(); } function finish(){ if(ballsPresent()){ takeBall(); } while(frontIsClear()){ move(); if(ballsPresent()){ takeBall(); } } } //opopopopopopopo
Explanation: Karel is given a world with beepers arranged in a checkerboard pattern. Karel starts in the bottom left corner facing east. Karel must remove all the beepers from the world, except for those on the first and last columns.
question
1.16.5: Double Tennis Balls
answer
function start(){ move(); double(); if (noBallsPresent()){ move(); } turnAround(); moveBalls(); finish(); } function finish(){ move(); move(); turnAround(); } function double(){ while (ballsPresent()){ takeBall(); move(); putBall(); putBall(); turnAround(); move(); turnAround(); } } function moveBalls(){ while(ballsPresent()){ takeBall(); move(); putBall(); turnAround(); move(); turnAround(); } } //double the balls
Explanation: A double tennis ball is a ball that is specifically designed for tennis. It is slightly larger than a regular tennis ball and has a softer feel. This makes it easier to control and helps to reduce the amount of vibration that is felt when the ball hits the racket.