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
29 lines (28 loc) · 1018 Bytes
/
Copy pathclient-b.txt
File metadata and controls
29 lines (28 loc) · 1018 Bytes
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
# Client Task B #
# Add your pseudocode to this file below this line: #
# ------------------------------------------------- #
BEGIN WarehouseApp
DEFINE WAREHOUSE as a 2D grid (e.g., [['A1', 'A2'], ['B1', 'B2']])
FUNCTION findPath(start, target)
SET currentPosition = start
WHILE currentPosition NOT EQUAL target DO
PRINT "You are at " + currentPosition
PRINT "Move (N/S/E/W):"
READ move
UPDATE currentPosition BASED ON move
IF currentPosition OUT OF BOUNDS THEN
PRINT "Invalid move. Try again."
SET currentPosition BACK TO previous position
END IF
END WHILE
PRINT "You reached: " + target
END FUNCTION
FUNCTION main()
PRINT "Enter starting position:"
READ startPosition
PRINT "Enter target position:"
READ targetPosition
CALL findPath(startPosition, targetPosition)
END FUNCTION
CALL main()
END WarehouseApp