Algorithms Vs Meta Language
-
Upload
kelly-bauer -
Category
Education
-
view
585 -
download
0
description
Transcript of Algorithms Vs Meta Language
+
Algorithms vs Syntax Structure DiagramsKelly Bauer
+Algorithms Sequence:
BEGIN Process 1 Process 2 Process 3
END
+Selection: Binary
+Selection: Multiple
+Repition: Pretest
+Repition: Post test
+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
+
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
+
So, what is an algorithm?
+What’s the difference between an alorithm and a syntax structure diagram?
+So, what is a syntax structure diagram?
+
Dim [Public|Private] <Variable> As <Data Type>
Dim
Public
Private
Variable As Data Type
BooleanByteCharDate
TimeDecimalDouble
IntLong
ShortSingle
Data Type= [Single|Short|Boolean|Byte|Char|Date|Time|Decimal|Double|Int|Long]
Upper CaseLowerCas
eUpperCas
e
Digit
Variable = Uppercase {LowerCase|UpperCase|Digit}
1
2
3
4
5
6
7
8
9
0
Digit=0|1|2|3|4|5|6|7|8|9
+
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