Search:

# Pseudocode

Asked By: Ted    Date: Dec 24    Category: MS Office    Views: 1314

i wrote up a pusedocode for the part of the
problem that i have to finish. Here it is:

t=0
x=0
y=h
row= ROW_PARAM_START
bounce_count=0

While x <= d
print t
print x
print y
Increment row
increment t
Change x
Change y
Store Vy
test y for bounce

While bounce_cont > 0 AND x <= d
print t
print x
print y
increment row
increment t
change x
change y
test y for bounce
change Vy
WEND
WEND
If Vy <= 0 AND Abs(y-Vy) <= WIND_EFFECT
"FREE"
Else "DOOMED"
END simulate

I have written this and its easy to write this down but since im not
good at VBA its hard for me to transform this into an actual code.
If i'm rite the second part should be a loop and the first not? or is
the entire thing a loop?
Apart from this if anyone could tell me if am wrong or tell me if im
right :D. And any help as to how to start this of in VBA would be of
great help.

Share:

Here is where you have to stop thinking like a human, and start  thinking
like a machine. A dumb machine that can only do what it is told.

1) You have defined starting positions.

You state that you will increment time. What are the new starting
positions for this new time increment? Perhaps the ending positions of
the previous increment? Do you define and capture velocity somewhere?

Your lecturer has perhaps done too much work for you, since you now have
to think like him, but none the less, has specified in a workbook all
the things like height, initial velocity, etc. You will need to capture
these values from the workbook into VBA variables, and work with the
variables.

Then, at the end of each calculation, write  the results back to the
workbook, each time to a new line.

So my pseudo code  looks different to yours:

'Define all variables, or check that they have been defined by the
lecturer

'1) Set starting conditions for first simulation

'2) Perform trajectory and bounce calculation

'3) Capture end position and velocity

'4) Write end values to the workbook

'5) Define new start values as old end values

'6) Loop around from 2) to 5) until distance to target has been reached.

'***********************************************************************
************
Now, what you seem to lack is an understanding of the VBA programming
language. Like most modern languages, it is object-oriented. Objects
have properties, actions, etc.

One example only is to define initial velocity.

Dim Vinit

Vinit = Sheets("Sheet1").Range("B7").value

Now you can use Vinit in a calculation. But note that the range I looked
at had a value property associated with it.

So I rephrase my first statement: Think like an object-oriented
semi-blank computer, and the logic will come.

Didn't find what you were looking for? Find more on Pseudocode Or get search suggestion and latest updates.

Related Topics:

Tagged: