Four snails enter a room at coordinates(0,0), (500,0), (500,500), (0,500) respec
ID: 441485 • Letter: F
Question
Four snails enter a room at coordinates(0,0), (500,0), (500,500), (0,500) respectively. Each snails starts to crawl at a rate of 1cm/sec in a clockwise direction towards the snail at the next corner- so snail 1 chases snail 2, snail 2 chases snail 3, snail 3 chases snail 4 and snail 4 chases snail 1. Write a function Step which given the row and column of sanili (rowi,coli) ahnd the row and column of snail j, (rowj,colj) computes the new coordinates of snail i and plots it. The new coordinates are determineds by setting, Rowdiff= rowj-rowi; coldiff= colj-colli; s=sqrt((rowdiff^2)+(coldiff^2)) row i becomes rowi+rowdifff/s and coli becomes coli +coldiff/s; The function should put a circle of radius 2 at rowi, coli; Write the main loop in the calling program that should call STEP for each of the 4 snails!!! NEEED HELP WITH THIS ALLGERO PROJECT!!!Explanation / Answer
Don't remember Allegro commands, but here is an algorithm for moving the snails. For algorithm: void Step(int snail[4][2]) //first index is for snail i, second index is for snail i->x position and for snail i->y position { //For snail 0 for( int i =0;iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.