Computers and Technology

Marching Ants This is a simulation of ants searching around and trying to find some food, moving in seemingly random directions. Implement the following algorithm in processing. You’ll need a for( ) loop to make this work: atx = 250 <-- initial position, set this to the center of your screen anty = 250 <-- same thing Loop 500 times: Old aunty = aunty Old anty = anty Antx = antx + random number from -5 to 5 Anty = anty + random number from -5 to 5 Draw a line from (antx, anty) to (old antx, old anty) If you put your drawing code into a draw( ) function, it will repeatedly draw the marching ants over and over again. It looks kind of messy after you do this so many times! Make it so that you only simulate the marching ants 20 times instead! (hint: you’ll need another loop!) For an extra challenge, can you make the color of the ants random?

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 02:30, capo9972
Write a program that takes in 3 inputs [players (int type), expected game time (double type), team (char type)] and calculates actual game time (double) based on the following conditions: if the number of players or the expected game time is less than or equal to zero, it should output wrong input if the number of players is greater than 0 and less than or equal to 6 and if they are on the â€r’ or â€r’ team, their game time will be 10% faster. and if they are on the â€b’ or â€b’ team, their game time will be 15% faster. and if they are on the â€y’ or â€y’ team, their game time will be 20% faster. and if they are on any other team, they will play 0% faster. if the number of players is greater than 6 but less than or equal to 12 and if they are on the â€r’ or â€r’ team, their game time will be 20% faster. and if they are on the â€b’ or â€b’ team, their game time will be 25% faster. and if they are on the â€y’ or â€y’ team their game time will be 30% faster. and if they are on any other team, they will play 0% faster. if the number of players is greater than 12 but less than or equal to 18 and if they are on the â€r’ or â€r’ team, their game time will be 30% faster. and if they are on the â€b’ or â€b’ team, their game time will be 35% faster. and if they are on the â€y’ or â€y’ team, their game time will
Answers: 2
image
Computers and Technology, 22.06.2019 08:00, lindseyreneesmith7
Digital information is stored using a series of ones and zeros. computers are digital machines because they can only read information as on or off –1 or 0. this method of computation is known as the system
Answers: 1
image
Computers and Technology, 22.06.2019 13:30, morganwendel126
Use the keyword strategy to remember the meaning of the following word. the meaning for the word has been provided. write your keyword and describe the picture you would create in your mind. centurion: a commander in the army of ancient rome. keyword: picture:
Answers: 2
image
Computers and Technology, 23.06.2019 09:30, nsjcbdhcb
Light travels at a speed of 186,000 miles a second. the distance light travels in a year is 5,865,690,000,000 miles/year 5,865,695,000,000 miles/year 58,656,950,000,000 miles/year 6,789,000,0000 miles/year
Answers: 1
Do you know the correct answer?
Marching Ants This is a simulation of ants searching around and trying to find some food, moving in...

Questions in other subjects:

Konu
Mathematics, 20.01.2021 21:20
Konu
English, 20.01.2021 21:20
Konu
Mathematics, 20.01.2021 21:20