Algorithms Vs Meta Language

16
+ Algorithms vs Syntax Structure Diagrams Kelly Bauer

description

 

Transcript of Algorithms Vs Meta Language

Page 1: Algorithms Vs Meta Language

+

Algorithms vs Syntax Structure DiagramsKelly Bauer

Page 2: Algorithms Vs Meta Language

+Algorithms Sequence:

BEGIN Process 1 Process 2 Process 3

END

Page 3: Algorithms Vs Meta Language

+Selection: Binary

Page 4: Algorithms Vs Meta Language

+Selection: Multiple

Page 5: Algorithms Vs Meta Language

+Repition: Pretest

Page 6: Algorithms Vs Meta Language

+Repition: Post test

Page 7: Algorithms Vs Meta Language

+Subprograms

All of these examples are published by the BOS in

their 1995 book “Methods of Algorithm Description”. This book is great to get,

because it includes examples and worked solutions of algorithm

problems

Page 8: Algorithms Vs Meta Language

+

Tetris Example

BEGIN REPEAT REPEAT

Drop BrickIF Left OR Right key is pressed

THENRotate piece

END IFIF Space Key is pressed THEN

Drop brick to bottomEND IF

UNTIL brick hits another brick IF there are a line of bricks made up Remove line of bricks Add 1 to score Add 1 to speed of bricks END IF UNTIL bricks hit top of the screen Display “End of Game”END

Page 9: Algorithms Vs Meta Language

+

So, what is an algorithm?

Page 10: Algorithms Vs Meta Language

+What’s the difference between an alorithm and a syntax structure diagram?

Page 11: Algorithms Vs Meta Language

+So, what is a syntax structure diagram?

Page 12: Algorithms Vs Meta Language

+

Dim [Public|Private] <Variable> As <Data Type>

Dim

Public

Private

Variable As Data Type

Page 13: Algorithms Vs Meta Language

BooleanByteCharDate

TimeDecimalDouble

IntLong

ShortSingle

Data Type= [Single|Short|Boolean|Byte|Char|Date|Time|Decimal|Double|Int|Long]

Page 14: Algorithms Vs Meta Language

Upper CaseLowerCas

eUpperCas

e

Digit

Variable = Uppercase {LowerCase|UpperCase|Digit}

Page 15: Algorithms Vs Meta Language

1

2

3

4

5

6

7

8

9

0

Digit=0|1|2|3|4|5|6|7|8|9

Page 16: Algorithms Vs Meta Language

+

What now? Design an algorithm for your game.

You also need to do syntax diagrams for all the control structures that you would need in your assignment. The control structures come from your algorithm.

Click icon to add picture

Click icon to add picture