Sunday, October 10, 2010

Programming Notes 1

I'm currently in Bachelor of Science: Computer Science, so I thought I'd share some notes :)

Flowcharts are the best way to go before programming anything. It's a collection of shapes/symbols that have specific roles for your code. The internet has buttloads of lists that you can find easily! It acts like a Pseudo Code which is equivalent to a draft version of your code. With it you can Simulate any future outcomes with your code and find potential bugs without having any problems later on.

Pseudo Code - draft code. For example:
if 50 is greater than X
give player lots of potions.
tell the player to lose it.

Simulate also means Simulation. It means "reading your code" in a way. Kinda hard to explain here, maybe something like this:
Give player 5 potions
X is equal to 40
if player potions is equal to X
     the player will gain 500 gold
you don't have enough
(go back to do)
if we simulate this
Player has 5 potions
5 is not equal to 40
go back to beginning
Player has 10 potions now
10 is not equal to 40
start over
Player has 40 potions now
40 is equal to 40
end the process.
That's how simulation goes :) Try changing the player's potion amount and simulate it! (In fact try doing -2  with algebra you have in mind. haha)

In programming, there's what we call "Integer Math" which means whole numbers only, no decimals and "Double/Float" allows decimals in code. But I'll work on explaining the stuff I learned some time later :D

No comments:

Post a Comment