1 / 79
文档名称:

python 课件8.ppt

格式:ppt   大小:375KB   页数:79页
下载后只包含 1 个 PPT 格式的文档,没有任何的图纸或源代码,查看文件列表

如果您已付费下载过本站文档,您可以点这里二次下载

分享

预览

python 课件8.ppt

上传人:neryka98 2018/5/2 文件大小:375 KB

下载得到文件列表

python 课件8.ppt

文档介绍

文档介绍:Programming Thinking and Method (8)
Zhao Hai 赵海 Department puter Science and Engineering Shanghai Jiao Tong University   ******@.
1
Python Programming, 1/e
Objectives
To understand the potential applications of simulation as a way to solve real-world problems.
To understand pseudorandom numbers and their application in Monte Carlo simulations.
To understand and be able to apply top-down and spiral design techniques in plex programs.
2
Python Programming, 1/e
Objectives
To understand unit-testing and be able to apply this technique in the implementation and debugging plex programming.
3
Python Programming, 1/e
Simulating Racquetball
Simulation can solve real-world problems by modeling real-world processes to provide otherwise unobtainable information.
Computer simulation is used to predict the weather, design aircraft, create special effects for movies, etc.
4
Python Programming, 1/e
A Simulation Problem
Denny Dibblebit often plays racquetball with players who are slightly better than he is.
Denny usually loses his matches!
Shouldn’t players who are a little better win a little more often?
Susan suggests that they write a simulation to see if slight differences in ability can cause such large differences in scores.
5
Python Programming, 1/e
Analysis and Specification
Racquetball is played between two players using a racquet to hit a ball in a four-walled court.
One player starts the game by putting the ball in motion – serving.
Players try to alternate hitting the ball to keep it in play, referred to as a rally. The rally ends when one player fails to hit a legal shot.
6
Python Programming, 1/e
Analysis and Specification
The player who misses the shot loses the rally. If the loser is the player who served, service passes to the other player.
If the server wins the rally, a point is awarded. Players can only score points during their own service.
The first player to reach 15 points wins the game.
7
Python Programming, 1/e
Analysis