- Joined
- Jul 10, 2007
- Messages
- 6,306
Code:
Lesson 1: Intro
JASS Grammar
Comments
/* */
//
Lesson 2: Variable declaration
type name
type grammer
Lesson 3: Variable declaration
name grammar
Lesson 4: Integers
what an integer stores (whole numbers)
Lesson 5: Actions
() takes arguments
Calling functions (running actions)
Lesson 6: Giving an action a value
value
variable
Lesson 7: Giving an action a list of values
values/variables
Lesson 8: Bits
octal
hex
ascii
use google to display numbers in
binary
octal
hexadecimal
Lesson 9: Integer 32 bits
range
overflow
first bit = -2^31
Lesson 10: Reals
float (not 100% accurate)
round to 3 decimals in globals
VERY large range
Mini Project 1
Lesson 11: Operator w/ Variable Initialization
=
Lesson 12: set
Lesson 13: operators
+, -, *, /, ()
Lesson 14: arrays
what is an array?
size 8192
rvalues/lvalues
[] operator
Lesson 15: strings
Lesson 16: escape characters
\ standard
| |n
http://www.wilsonmar.com/1eschars.htm
Lesson 17: |c, |r
colors
argb
Lesson 18: string concatenation
+
Lesson 19: blocks
block name/end block name
structure of JASS coding
globals block
Mini Project 2
Lesson 20: booleans
can hold the value true/false
how many bits?
still 8, not 1!
Lesson 21: boolean expressions
uses operators
always*** always*** returns true/false
a boolean expression is ANYTHING that gives a boolean
a boolean is still a boolean expression
Lesson 22: not
flips the boolean's value
Lesson 23: comparators
==
!=
used to compare two boolean expressions for equality
Lesson 24: and, or, ()
and links two boolean expressions together
both must be true
or links two boolean expressions together
either must be true
() is for operator precedence
JASS operator precedence is
()
not
and/or (left to right)
keep in mind that normally and has higher precedence than or
consider
true or true and false
in JASS
false
with standard operator precedence
true
Lesson 25: if statement
evalutes a boolean expression to see if it's true
if (some boolean expression is true)
do stuff
endif
JUMP TO HERE IF FALSE
will skip the code inside of it if the boolean expression is not true
requires the then keyword
if boolexpr then
endif
Lesson 26: else
if the boolean expression wasn't true, this is used instead
if the ball is red, then throw it
else, sit on it
if (the ball is red) then
throw the ball
else
sit on the ball
endif
Lesson 27: elseif
used to chain if statements together
if the ball is red, then throw it
else if the ball is blue, then eat it
else if the ball is black, then take it
else if the ball is brown, then water it
else (none of the above are true), sit on it
if (the ball is red) then
throw it
elseif (the ball is blue) then
eat it
elseif (the ball is black) then
take it
elseif (the ball is brown) then
water it
else
sit on it
endif
create functions like the above and create exercises using those functions to craft
beginning expressions
give a set of outcomes that are desired and have them craft the expression for those outcomes
huge chains of elseifs are ok
Lesson 28: simplifying
A huge chain of elseif is not very performant, is not very pretty, and can be avoided
Consider 10 numbers, {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
If the input is any of those 10 numbers, then output "hello"
if (input == 0) then
elseif (input == 1) then
elseif (input == 2) then
elseif (input == 3) then
elseif (input == 4) then
elseif (input == 5) then
elseif (input == 6) then
elseif (input == 7) then
elseif (input == 8) then
elseif (input == 9) then
endif
or
if (input == 0 or input == 1 or input == 2 or input == 3 or input == 4 or input == 5 or input == 6 or input == 7 or input == 8 or input == 9) then
endif
use a boolean array?
boolean array b
b[0] = true
b[1] = true
b[2] = true
b[3] = true
b[4] = true
b[5] = true
b[6] = true
b[7] = true
b[8] = true
b[9] = true
if (b[input]) then
endif
come up with solutions and generalize
in order of precedence
consider
if the user inputs a or b, then result A will happen
if a user inputs, a and d, or e, result B will happen
if the user inputs a or c, then result C will happen
first, simplify
a or b
a and d or e
a or c
firstly, for case 1
if either a or b is entered, case 1 is entered
does this mean that it's possible for *a and d* to occur?
No
a or b
e
c
generalize algorithms
rather than having near identical code in 10 elseifs, have 1 if statement with a generalized approach
I think that mini project 3 has a good example of this
Mini Project 3
Lesson 28: boolean algebra
+ (or)
* (and)
' (not) (compliment)
Lesson 29: Truth Tables
convert table to boolean expression
Lesson 30: De Morgan's Law
Lesson 31: Karnaugh Mapping
Lesson 32: loop
exitwhen
Mini Project 4
Lesson 36: functions
takes nothing
returns nothing
nothing as a special type (void)
Lesson 37: scope
local variables
Lesson 38: take value
take values
Lesson 39: return
Lesson 40: return value
Mini Project 5
Lesson 34: scopes
Lesson 35: function initializer
Lesson 36: libraries
Lesson 37: library ordering (uses/requires)
order of initialization (scopes/libraries)
Mini Project 6
Lesson 38: indexed array
Lesson 39: linked list
Lesson 40: stack
Lesson 41: queue
Lesson 42: Instantiation
Lesson 43: structs
methods
static methods
fields
structs as types
typecasting
this
thistype
onInit (+ order of init)
method operator
delegate
keyword
.name
functions as integers
Mini Project 7
Lesson 44: preprocessor directives
textmacros
Lesson 45: static if
Lesson 46: key
Lesson 47: module
onInit (order of init)
.exists
Lesson 48: module in methods
Mini Project 8
Lesson 49: timers
Lesson 50: timer dialogs
Lesson 51: unit groups
Lesson 52: triggers
events
conditions
actions
Lesson 53: building triggers
Mini Project 9
Lesson 54: local code
GetLocalPlayer()
Lesson 55: texttags
Lesson 56: threading
TriggerSleepAction
TriggerSyncStart
TriggerSyncReady
ExecuteFunc
TriggerExecute .execute
TriggerEvaluate .evaluate
ForceEnumPlayers
synchronous vs asynchronous
actions vs conditions
- X -
Lesson 57: Good commenting
Lesson 58: Good API (various groups)
Lesson 59: Good naming
Lesson 60: Good documentation (API, requirements, settings)
Final Project
Last edited: