Activity6 Instructions

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 3

ODI Coding Activity 6 Jessica C. Garwood & Peter J. S. Franks
1"
Introduction to programming Activity 6
Getting started
! Double-click on the file Activity6.R
! Make sure your working directory is set to Activity6
Main exercise
You should have noticed that in the last few weeks, we wrote down a lot of coordinates and plotted a lot
of lines. You must be a pro by now! This week, we will use all of the skills we learned to make our own
maze, customize it, and then play a game with it.
! Your maze needs to be unique, so follow your instructor’s instruction to decide what number you will
have and write it down below. The number 888 is used as an example.
Maze number: ____________________________________________________________________
! First, you need to decide what your maze will look like and draw it. Use a piece of squared paper and
draw an x- and y-axis. Choose between a 4X4, 6X6, or 8X8 maze. The larger the maze, the more
work.
Size of the maze: ___________________________________________________________________
! Then, decide where your start and end points will be. Put a “S” on your start point, and an “E” at the
end. Record these points.
Runner (start): x_start = ________ y_start = ________
Finish flags (end): x_end = ________ y_end = ________
! Draw walls to connect the “S” on your drawing with the “E”. Make sure they are on the lines. After
you have your main path, add more lines to confuse people. Don’t forget: the more walls, the more
work.
! Record the start (x1, y1) and end (x2, y2) coordinates of each wall. Hint: Jessica likes to start with the
bottom and move up for the horizontal walls, then start from the left and move right for the vertical
walls. You can use a highlighter to show which walls you already recorded. Use the sheet provided
and don’t worry, you don’t have to fill out all of the lines!
! Decide what color you want your maze to be and record it below.
Maze color: ___________________________________________________________________
! Open the file Positions_N.csv, go to File > Save As… and replace N by your number. Enter your
start and end coordinates below the appropriate columns and save your changes.
ODI Coding Activity 6 Jessica C. Garwood & Peter J. S. Franks
2"
! Open the file Walls_N.csv, go to File > Save As and replace N by your number. Enter your wall
coordinates and save your changes.
! Open the file Preferences_N.csv, go to File > Save As and replace N by your number. Enter your
wall color under color (don’t add quotation marks) and the size of your maze under size. Save your
changes.
! Open the file Activity6.R, add your number on line 5. Save your changes.
all_maze <- c(888, YourNumber)
! When everyone is done entering their information or if there is nobody at the computer, type
source("Activity6.R") in the R console. Did your maze look the way you expected? Try to
solve it in the light first to make sure it works!
Advanced Advanced activities if your group is done early
! Try your maze in the dark. Find the lines below (they appear twice) and remove one of the # before
each of them. Save your changes and type source("Activity6.R") in the R console. The
architect should use your drawing for the maze plans.
# # Add a black square (the room is dark)
# rect(0, 0, 6, 6,
# col = "black", border=par("fg"), lty=NULL, lwd=par("lwd"),
xpd=FALSE)
Congratulations, you are now very good at troubleshooting
and modifying a computer program!
It is now time to move beyond the maze and towards waves
ODI Coding Activity 6 Jessica C. Garwood & Peter J. S. Franks
3"
Record the position of your walls here
Line%
x1%
y1%
x2%
y2%
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"
"
"
"
"

Navigation menu