forked from CodeYouOrg/intro_pscode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
client-b.txt
36 lines (29 loc) · 1.37 KB
/
client-b.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# Client Task B #
# Add your pseudocode to this file below this line: #
# ------------------------------------------------- #
Int variable final_destination_x to x coordinate
Int variable final_destination_y to y coordinate
Int variable cust_loc_x to customer starting x coordinate
Int variable cust_loc_y to customer starting y coordinate
While cust_loc_x < final_destination_x
print "you are at" print cust_loc_x, cust_loc_y
print "final location is at" print final_destination_x, final_destination_y
tell customer to move East
If cust moves East, increment cust_loc_x++
While cust_loc_x > final_destination_x
print "you are at" print cust_loc_x, cust_loc_y
print "final location is at" print final_destination_x, final_destination_y
tell customer to move West
If Cust moves West, increment cust_loc_x--
While cust_loc_y < final_destination_y
print "you are at" print cust_loc_x, cust_loc_y
print "final location is at" print final_destination_x, final_destination_y
tell customer to move North
If cust moves North, increment cust_loc_y++
while cust_loc_y > final_destination_y
print "you are at" print cust_loc_x, cust_loc_y
print "final location is at" print final_destination_x, final_destination_y
tell customer to move South
If cust moves South, increment cust_loc_y--
If cust_loc_x == final_destination_x and cust_loc_y==final_destination_y
print "you have arrived!"