This repository was archived by the owner on May 22, 2025. It is now read-only.
forked from CodeYouOrg/intro_pscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient-b.txt
More file actions
76 lines (55 loc) · 1.9 KB
/
Copy pathclient-b.txt
File metadata and controls
76 lines (55 loc) · 1.9 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Client Task B #
# Add your pseudocode to this file below this line: #
# ------------------------------------------------- #
Start
let goalPosition (x = column, y = row)
let customerPosition (a = column, b = row)
Create random goalPosition (randx%10, randy%10) - seeded by time and date
Print "what is your current position?"
Input customerPosition (a,b)
while (a!=x || b!=y)
If a!=x
If a<x
increment a by 1
Print "move east"
else
decrement a by 1
Prine "move west"
else
If b<y
increment b by 1
Print "move north"
else
decrement b by 1
Print "move south"
Print "Congratualtions you have reached your goal!"
End
________________________________________________________________________
| | | | | | | | | |
9 | | | | | | | | | |
|_______|_______|_______|_______|_______|_______|_______|_______|_______|
| | | | | | | | | |
8 | | | | | | | |Goal | |
|_______|_______|_______|_______|_______|_______|_______|_______|_______|
| | | | | | | | | |
7 | | | | | | | | | |
|_______|_______|_______|_______|_______|_______|_______|_______|_______|
| | | | | | | | | |
6 | | | | | | | | | |
|_______|_______|_______|_______|_______|_______|_______|_______|_______|
| | | | | | | | | |
5 | | | | | | | | | |
|_______|_______|_______|_______|_______|_______|_______|_______|_______|
| | | | | | | | | |
4 | | | | | | | | | |
|_______|_______|_______|_______|_______|_______|_______|_______|_______|
| | | | | | | | | |
2 | | | | | | | | | |
|_______|_______|_______|_______|_______|_______|_______|_______|_______|
| | | | | | | | | |
1 | | | | | | | | | |
|_______|_______|_______|_______|_______|_______|_______|_______|_______|
| | | | | | | | | |
0 |Player | | | | | | | | |
|_______|_______|_______|_______|_______|_______|_______|_______|_______|
1 2 3 4 5 6 7 8 9