Courses‎ > ‎Intro to CS - Full Year‎ > ‎Fall‎ > ‎Dyrland-Weaver‎ > ‎

Work

Work 10: 11/8

posted Nov 8, 2019, 11:51 AM by JonAlf Dyrland-Weaver

On your own, but with consultation of your neighbors when needed, try to recreate the procedures in the following NetLogo program: http://homer.stuy.edu/~dw/netlogo/monitors.html
  1. Phase 1: TO BE DONE BEFORE ANY CODING!
    • Test the buttons & slider out
      • ca is just there for convenience.
    • Using a Key To Success™, answer the following questions:
      • What are the monitors showing?
        • If the monitors all use the same procedure, how would that work?
      • What buttons does the slider influence?
      • How does the slider behave? Why?
      • What is the difference between colorRandomShade and colorRandomShade2?
  2. Phase 2:
    1. Use the info you gathered in Phase 1 to write your own version of the program.
    2. You should have 4 new procedures (not including colorRandom, which you should've done for the previous assignment).
      1. One should report the value used for the monitors.
      2. Separate procedures for colorRandomShade, colorRandomShade2 and gradient.
        1. Remember, slider values should be passed as arguments
    3. Include your answers to the questions from phase 1 as comments at the top of your code.
      1. Like racket, ; is the NetLogo comment operator.
Submit this as monitors

Work 09: 11/7

posted Nov 7, 2019, 11:27 AM by JonAlf Dyrland-Weaver


Try to recreate the procedures in the following NetLogo program: http://homer.stuy.edu/~dw/netlogo/colorPatchesWeb.html
  1. Phase 1: TO BE DONE BEFORE ANY CODING!
    • Test the buttons out
      • ca is just there for convenience.
    • Using a Key To Success™, answer the following questions:
      • For colorQuad
        • What is true about all the purple patches? 
        • What is true about all the  blue patches?
        • What can you say about all the white patches?
      • For grid
        • What is the difference between the black and white patches?
      • What is the difference between colorRandom and colorRandom2?
      • To answer the following questions, you'll need to test in netlogo
        • How can you tell the coordinates of a patch?
        • There is an arithmetic operator in netlogo called mod. It is used as follows:
          • a mod b - where a and b are both integers (and b != 0).
        • What does mod do?
  2. Phase 2:
    1. Use the info you gathered in Phase 1 to write your own version of the program.
    2. You do not need to use the same exact colors I do, but the colors you choose must behave in the same way they do in my version.
    3. Include your answers to the questions from phase 1 as comments at the top of your code.
      1. Like racket, ; is the NetLogo comment operator.
Submit this as color_patches

Work 08: 11/6

posted Nov 6, 2019, 11:23 AM by JonAlf Dyrland-Weaver

With your new table buddy, try to recreate the procedures in the following NetLogo program: http://homer.stuy.edu/~dw/netlogo/crazyTurtlesWeb.html

  1. Phase 1: TO BE DONE BEFORE ANY CODING!
    • Test the buttons out
      • pu, pd and clear (ca) are just buttons that call each of those regular commands, they are there for convenience.
      • You are given forever and regular buttons for each of the custom procedures. The procedures are designed to work with forever buttons, but running them one step at a time might help to understand what they do.
      • The forever buttons were designed to work alone, using 2 or more of them at the same time will lead more to confusion rather than illumination.
    • Using a Key To Success™, write down each button (aside from pd, pu and clear), and answer the following question:
      • What context is it in?
      • Is it a regular button or forever button?
      • Does the called procedure make use of a slider?
      • If it is a Turtle button:
        • Are the actions that all turtles do?
        • Are there actions that apply to certain turtles?
      • There is no button for it, but there is a wiggle procedure
        • How do you think it works?
        • What procedures use the wiggle procedure?
  2. Phase 2:
    1. Use the info you gathered in Phase 1 to write your own version of the program.
    2. Include your answers to the questions from phase 1 as comments at the top of your code.
      1. Like racket, ; is the NetLogo comment operator.
Submit this as crazy_turtles

Work 07: 11/1

posted Nov 1, 2019, 7:43 AM by JonAlf Dyrland-Weaver

In class you've seen me use random in NetLogo. Here is how it works:
  • random x
    • Returns a random integer between 0 and x, excluding x.
    • For example, random 3 could return 0, 1 or 2.
    • For more information on random (and other NetLogo commands) check the documentation.
  1. Create a NetLogo program with the following features:
    1. Interface
      • A slider called angle
        • Should start at 0 and go to 360 in increments of 1
      • A slider called stride
        • Should start at 0 and go to 5 in increments of 0.1
      • Buttons for each of the procedures listed below.
      • Procedures (Make the buttons for all the 
      • Setup
        • Clear the screen and make one turtle (you can add custom features to the turtle if you wish)
      • wiggle0
        • Turtle procedure with no parameters.
        • Makes a turtle move forward 1 unit
        • Makes a turtle turn right a random number of degrees between 0 and the value of the angle slider.
      • wiggle1
        • Turtle procedure with no parameters.
        • Makes a turtle move forward 1 unit
        • Makes a turtle turn right a random number of degrees between 0 and the value of the angle slider.
        • Makes a turtle turn left a random number of degrees between 0 and the value of the angle slider.
      • wiggle2
        • Turtle procedure with no parameters.
        • Makes a turtle move forward stride units (from the slider)
        • Makes a turtle turn right a random number of degrees between 0 and the value of the angle slider
      • wiggle3
        • Turtle procedure with no parameters.
        • Makes a turtle move forward stride units (from the slider)
        • Makes a turtle turn right a random number of degrees between 0 and the value of the angle slider
        • Makes a turtle turn left a random number of degrees between 0 and the value of the angle slider
  2. Test your code using the buttons and sliders
    • When testing, the turtle will move very fast, you can slow down the entire program with the speed slider at the top of the NetLogo window.
    • Answer the following questions in comments at the top of your code (like racket, any line that begins with a ; is considered a comment and will be ignored with the program is run.
      • Run wiggle 0 and wiggle 1 multiple times with the angle slider set to values below 100. How does the turtle behave differently between the two procedures?
      • Run wiggle 0 and wiggle 1 multiple times with the angle slider set to values above 180. How does the turtle behave differently between the two procedures?
      • Run wiggle2 and wiggle3 with varying values for stride and angle. What happens when stride is less than 0? More than 1?
      • Random movement is a big part of many NetLogo programs. Which of the wiggle procedures do you think is the most useful for random movement, and why? Which do you think is the least useful, and why? 
Submit this as wiggles.

Work 06: 10/31

posted Oct 31, 2019, 11:03 AM by JonAlf Dyrland-Weaver

Write a NetLogo program with the following features:
  • Interface
    • A slider called numSides
      • Should start at 3 and go to a reasonable number (like 20)
    • A slider called sideLength
      • Should start at 1 and go to a reasonable number
    • A slider called angle
      • Should start at 0 and go to 360
    • For each slider, set the initial value to be something that makes sense, play around with the values to see what works well
    • Include buttons for each procedure listed below
  • Procedures
    • Setup
      • Clear the screen and make a turtle (you can add custom feature to the turtle if you wish)
    • regularGon
      • Should work like the regularGon procedure form the previous assignment.
      • Pass the numSides and sideLength slider values into this function when you make the button for it.
    • pattern
      • Should call regularGon and then turn right.
      • Pass the angle slider value into the function when you make the button for it.
      • Make the button for pattern a forever button! - see what happens
submit this as sliders

Work 05: 10/30

posted Oct 30, 2019, 10:22 AM by JonAlf Dyrland-Weaver   [ updated Oct 30, 2019, 11:13 AM ]

Note: When you save your NetLogo program, it will create a .nlogo file, you should submit that file.

Write the following NetLogo procedures:
  • setup
    • observer context
    • should clear the screen and create a single turtle, facing up.
  • square 
    • turtle procedure with 1 parameter
    • commands a turtle to draw a square where the side length is given by the parameter
  • triangle
    • turtle procedure with 1 parameter
    • commands a turtle to draw an equilateral triangle where the side length is given by the parameter
  • hexagon
    • turtle procedure with 1 parameter
    • commands a turtle to draw a regular hexagon (6 sided figure) where the side length is given by the parameter
  • regularPolygon
    • turtle procedure with 2 parameters [n, l]
    • commands a turtle to draw a regular polygon with n sides of length l
Challenge:
  • rightTri
    • turtle procedure
    • commands a turtle to draw a right triangle
  • HA!
    • turtle procedure
    • have a turtle draw "HA!" on the screen.
    • or have the turtle draw any message you'd like
submit this as turtle_draw

Work 04: 10/29

posted Oct 29, 2019, 10:54 AM by JonAlf Dyrland-Weaver   [ updated Oct 29, 2019, 12:24 PM ]

  • Download NetLogo!
  • You will have a number of tasks to perform in NetLogo.  To start NetLogo on the school computers open a terminal (shortcut: control-alt-t), and type netlogo at the command prompt.

    For this assignment you will use the following commands:
    • observer commands
      • clear-all
      • create-turtles x
      • create-ordered-turtles x
    • turtle commands
      • forward x
      • back x
      • right x
      • left x
      • pen-down
      • set property value
    • Test out these commands via the command center. Make sure to be in the correct context when using them.
    • In a plain text file, write down what these commands do.
    Create a turtle and do the following:
    1. Access the property sheet for the turtle.
    2. In the same plain text file as before, for each property:
      1. Write it's name
      2. Describe what it is
      3. Write 2 examples of set commands that will change the property.
    When done, feel free to check out the models library (accessible in the File menu) to see all the built in programs NetLogo comes with.

    Submit this as netlogo_commands_0

    Work 03: 10/21

    posted Oct 21, 2019, 9:23 AM by JonAlf Dyrland-Weaver

    1. Read the following article: https://www.vox.com/cards/the-internet/
    2. Answer these questions in a plain text file
      1. What is an I.P. Address?
      2. Why is Tim Breners-Lee important?
      3. What is the last mile?
      4. What does the lock next to a url signify?
      5. What is the IETF, what does it do?
      6. What is ICANN, what does it do?
    submit this under: internet-explained

    Work 02: 10/18

    posted Oct 18, 2019, 10:49 AM by JonAlf Dyrland-Weaver

    With your newfound computer hardware knowledge, you will spec out 3 different computers at different price points:
    • Use this website: https://pcpartpicker.com
    • You will spec out 3 different computers based on max price:
      • $500
      • $900
      • $1200
    • For each machine your spec out, describe how it will be used/justify why it should cost as much as it does.
    • For each component you choose:
      • ensure it is compatible with the rest of your build
      • explain briefly its significance
      • document its price.
    • Clearly document your total expenditure for each of your three builds.
    • Use the following template for each build:
      • Budget: _____
      • General description: 
      • ---Specifications---
      • CPU:
      • Motherboard:
      • RAM:
      • Storage:
      • OS:
      • Network:
      • Graphics:
      • Power Supply:
      • Case:
    • Put this all in a plain text file
    Submit this under computer_build

    Work 01: 10/7

    posted Oct 6, 2019, 4:51 PM by JonAlf Dyrland-Weaver

    As I mentioned in class, we are leaving the racket section behind for now, and moving to the next unit. We will be discussing computer hardware, how computers work, and how the internet works.

    Below you will find a list of computer-related term. Research and define them in your own words! Do not copy or paraphrase a definition you found online. You should be able to understand and describe your terms. You should define as many as you can, but I want you to spend time on each one, don't rush it. You should be able to get through at least 10 before the end of class. We'll compile a class dictionary in the next few days. Put your terms and definitions in a plain text file (.txt), which just happens to be the first term (what a coincidence). Save this file on your lab computer account, and tomorrow you'll submit it using the new hw server system I mentioned last week.

    The Terms:
    1. plain text
    2. algorithm
    3. bit
    4. byte
    5. bandwidth
    6. bluetooth
    7. botnet
    8. cache
    9. compression (.ZIP, .RAR)
    10. CPU
    11. GPU
    12. dual-core / quad-core
    13. encryption
    14. ethernet
    15. firewall
    16. GIF / PNG / JPEG / TIFF
    17. Hard drive
    18. RAM (main memory)
    19. HTML
    20. HTTP
    21. IP address
    22. nano / micro / milli / kilo / mega / giga / tera /
    23. LAN / WAN
    24. Linux
    25. malware / virus / spyware / adware / keylogger
    26. motherboard
    27. Object/machine code
    28. Open Source software
    29. Operating System
    30. Phishing
    31. router / hub / switch
    32. Source code
    33. TCP/IP
    34. upload vs. download
    35. USB

    1-10 of 11