O'Reilly logo

Digital Dice by Paul J. Nahin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

image

image

13. A Police Patrol Problem

Figure S13.1 shows a logical flow diagram of the simulation of this problem, and the code patrol.m follows the flow diagram faithfully. The code assumes that all of the patrol cars are randomly patrolling the road; for scenario (a), that of a single patrol car sitting at y = 1/2, only a simple extra line of code is required, which I’ll tell you about in just a bit. To make the code crystal clear, the following comments will almost certainly be helpful. The variables totalgrassdistance and totalconcretedistance are the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required