{{ message }}

# APCSLowell / Lightning

An AP Computer Science A programming assignment for Mr. Simon's APCSA course at Lowell High School, San Francisco, USA

## Files

Failed to load latest commit information.
Type
Name
Commit time
Sep 20, 2015
Aug 27, 2014
Sep 16, 2020
Aug 27, 2014
Aug 27, 2014
Aug 27, 2014

# Lightning

One way to simulate lightning is with a random walk. In this assignment you will create a program that uses a random walk to seemingly shoot lightning from one side of the screen to the other every time the mouse is pressed. You may find sides 16 to 52 of the apjavaProcessing slide presentation helpful.

## Suggested steps to start the assignment

2. Then fork this repository
3. Open the Lightning.pde file. Copy and paste the code into Processing.
4. At the top of the program in Processing, declare 4 `int` variables `startX`, `startY`, `endX` and `endY`. Initialize `startX` to 0, `startY` to 150, `endX` to 0 and `endY` to 150
5. `void setup()` needs to set the `size()`, `strokeWeight()` and `background()` of your program
6. `void draw()` needs to do two things:
-set the `stroke()`color of the lightning bolt to some random value using `Math.random()`
-a `while` loop that repeats the following until the `endX` is off the screen:
1. set `endX` to `startX` plus a random integer from 0 to 9
2. set `endY` to `startY` plus a random integer from -9 to 9
3. draw a `line()` with endpoints `startX`,`startY`,`endX`,`endY`
4. set `startX` equal to `endX`
5. set `startY` equal to `endY`
7. `void mousePressed()` needs to set `startX`,`startY`,`endX`,`endY` back to their original values.
8. When you are happy with the program, copy and paste it back into GitHub
9. You will also need to modify `index.html` to customize your website with it's own title, headline and footer. When you are happy with your program, push your finished project up to GitHub
10. The final step is to submit the URL for your website to google classroom. You can find more specific instructions with pictures on how to submit your assignment on slides 50 to 52 of the apjavaProcessing slide presentation. Don't hesitate to ask for help if your aren't sure how something is suppose to work.

## Program requirements

The steps above are only a suggestion. Your program needs to use `Math.random()` for all random numbers in the assignment. Other than that, your lightning program doesn't have to work or look like any other. Have fun and be creative!

## GitHub problems?

If your program works in Processing but not on GitHub, check this list for possible solutions. If your program still isn't working on GitHub let your instructor know.

## Samples of Student Work

An AP Computer Science A programming assignment for Mr. Simon's APCSA course at Lowell High School, San Francisco, USA

## Releases

No releases published

## Packages 0

No packages published

## Languages

You can’t perform that action at this time.