Draw Flow Chart Write Matlab Program Solve Game Described Stick Game 1 100 Children Stand Q43880027
Draw a flow chart and write a Matlab program to solve the gamedescribed below.
The Stick Game
1) 100 children stand in a line, and the first child has abasket full of sticks. None of the children has a stick to startwith.
2) Starting with the first child, each child takes a turn asrunner going down the line with the basket of sticks. The runnergoes only down the line, starting with their own position.
3) The runner stops at every child (including themselves)whose positions is a multiple of their own position. So child #5stops at child 5 10 15 20 etc.
4) When the runner stops at a child, they check whether thechild has a stick or not.* if the child has a stick, the runner takes it away and putsit in the basket.* if the child has no stick, the runner gives them a stickfrom them basket.
Who has a stick at the end of the game? Print out the numbersof the children that have sticks at the end. That is, if every 10thchild ends up with a stick, then print:
10 20 30 40 50 60 70 80 90 100
Hints:
* Make an array stick(1:100) to contain the result. stick(c)=0means child c has no stick. stick(c)=1 means child c has a stick.So, what is the initial values of stick? What are possible valuesof stick?
* You can check if the child is a multiple of the runner usingthe modulus function:
mod(c, r) = 0 if c is a multiple of r and the runnerstops
mod(c, r) ~= 0 otherwise (it’s the remainder for c / r) andthe runner does not stop
**answer is the perfect squares. not sure how to set up thescript
Expert Answer
Answer to Draw a flow chart and write a Matlab program to solve the game described below.The Stick Game1) 100 children stand in a …
OR