├── 2020 ├── Conventions.java ├── Lesson #1 │ ├── ExampleOne.java │ ├── Lesson Plan.txt │ └── Lesson.java ├── Lesson #2 │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── settings.json │ ├── .wpilib │ │ └── wpilib_preferences.json │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ ├── src │ │ └── main │ │ │ ├── deploy │ │ │ └── example.txt │ │ │ └── java │ │ │ └── frc │ │ │ ├── robot │ │ │ ├── Main.java │ │ │ └── Robot.java │ │ │ └── util │ │ │ └── Gamepad.java │ └── vendordeps │ │ ├── Phoenix.json │ │ └── REVRobotics.json ├── Lesson #3 │ ├── .gitignore │ ├── .vscode │ │ ├── launch.json │ │ └── settings.json │ ├── .wpilib │ │ └── wpilib_preferences.json │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ ├── src │ │ └── main │ │ │ ├── deploy │ │ │ └── example.txt │ │ │ └── java │ │ │ └── frc │ │ │ ├── robot │ │ │ ├── Main.java │ │ │ ├── OI.java │ │ │ ├── Robot.java │ │ │ ├── RobotMap.java │ │ │ ├── commands │ │ │ │ ├── DrivetrainDriveCommand.java │ │ │ │ ├── FloopCloseCommand.java │ │ │ │ ├── FloopOpenCommand.java │ │ │ │ ├── FloopPullCommand.java │ │ │ │ ├── FloopPushCommand.java │ │ │ │ ├── FloopStartScoreCommand.java │ │ │ │ └── FloopStopScoreCommand.java │ │ │ └── subsystems │ │ │ │ ├── Drivetrain.java │ │ │ │ ├── DrivetrainSingleton.java │ │ │ │ └── Floop.java │ │ │ └── util │ │ │ └── Gamepad.java │ └── vendordeps │ │ └── Phoenix.json └── Robotics │ └── 694 │ ├── Engineering │ ├── Brianna.txt │ ├── Eric.txt │ └── Mr.Blay.txt │ ├── Marketing │ ├── Areyan.txt │ └── Sabrina.txt │ └── Software │ ├── Adris2018.txt │ ├── Ayan2022.txt │ ├── Brian2023.txt │ ├── Emily2020.txt │ ├── Eric2022.txt │ ├── George2019.txt │ ├── HuiMin2019.txt │ ├── Ivan2022.txt │ ├── Jin2021.txt │ ├── Kevin2020.txt │ ├── Miguel2022.txt │ ├── Nicky2022.txt │ ├── Pak2021.txt │ ├── Pratham2020.txt │ ├── Ryan2021.txt │ ├── Sam2022.txt │ ├── Sheon2019.txt │ ├── Tahsin2021.txt │ ├── Timothy2019.txt │ ├── Victor2021.txt │ ├── Willis2021.txt │ ├── Wilson2017.txt │ └── Winston2020.txt ├── 2021 ├── 01_cmd │ └── README.md ├── 02_git │ ├── DerekLi │ │ └── README.md │ ├── Kirill_Vesialou │ │ └── README.md │ ├── Lin_Eric │ │ └── readme.md │ ├── README.md │ ├── Shaurya_sen │ │ └── README.md │ ├── Tianlang │ │ └── README.md │ ├── Tianlang_Qin │ │ └── README.md │ ├── Yuchen_Pan │ │ └── README.md │ ├── ZidanniClerigo │ │ ├── README.md │ │ └── y │ ├── aiden_li │ │ └── README.md │ ├── alvin_he │ │ ├── README │ │ └── README.md │ ├── anthony_chen │ │ └── README.md │ ├── benjamin_goldfisher │ │ └── README.md │ ├── brandon_phiong │ │ ├── README.md │ │ ├── README.mdes │ │ └── brandon_phiong │ ├── calvin_zhang │ │ └── README.md │ ├── dylan_hai │ │ └── README.md │ ├── elaine_ye │ │ └── README.md │ ├── ivan_chen │ │ └── README.md │ ├── john_doe │ │ └── README.md │ ├── jonathan_deng │ │ └── README.md │ ├── kevin_li │ │ └── README.md │ ├── mahir_riki │ │ └── README.md │ ├── mark_zhu │ │ └── README.md │ ├── myles_pasetsky │ │ └── README.md │ ├── nehemiah_jang │ │ └── README.md │ ├── nicky_lin │ │ └── README.md │ ├── pak_lau │ │ └── README.md │ ├── paul_serbanescu │ │ └── README.md │ ├── phillip_guan │ │ └── README.md │ ├── raihan_nadeem │ │ └── README.md │ ├── randy_sim │ │ └── README.md │ ├── renee_mui │ │ └── README.md │ ├── reya_miller │ │ └── README.md │ ├── sam_belliveau │ │ └── README.md │ ├── tahsin_ahmed │ │ └── README.md │ └── yaqi_chew │ │ ├── README.git │ │ └── README.md ├── 03_java │ ├── Eric_Lin │ │ └── Main.java │ ├── Kirill_Vesialou │ │ └── Main.java │ ├── README.md │ ├── april_jang │ │ └── Main.java │ ├── april_jang_two_practice │ │ ├── Main.java │ │ └── Secret.java │ ├── brandon_phiong │ │ └── main.Java │ ├── derek_li │ │ └── Main.java │ ├── dylan_hai │ │ └── Main.java │ ├── elaine_ye │ │ └── Main.java │ ├── ivan_chen │ │ └── Main.java │ ├── jonathan_deng │ │ └── Main.java │ ├── kevin_li │ │ └── Main.java │ ├── mahir_riki │ │ └── Main.java │ ├── nehemiah_jang │ │ └── Main.java │ ├── niki_chen │ │ └── Main.java │ ├── pak_lau │ │ └── Main.java │ ├── paul_serbanescu │ │ └── Main.java │ ├── raihan_nadeem │ │ └── Main.java │ └── zidanni_clerigo │ │ └── Main.java ├── 04_oop │ ├── Kirill_Vesialou │ │ └── Car.java │ ├── README.md │ ├── aiden_li │ │ └── car.java │ ├── april_jang │ │ ├── Car.java │ │ └── Test.java │ ├── brandon_phiong │ │ ├── Car.java │ │ └── Main.java │ ├── dylan_hai │ │ ├── Car.java │ │ ├── Main.java │ │ └── test.java │ ├── elaine_ye │ │ ├── Car.java │ │ └── Main.java │ ├── ivan_chen │ │ ├── Car.java │ │ └── Main.java │ ├── jonathan_deng │ │ ├── Car.java │ │ └── Test.java │ ├── kevin_li │ │ └── Car.java │ ├── lin_eric │ │ ├── Car.java │ │ └── Main.java │ ├── mahir_riki │ │ └── Car.java │ ├── pak_lau │ │ ├── Car.java │ │ └── Main.java │ ├── raihan_nadeem │ │ ├── Car.java │ │ └── Main.java │ └── yaqi_chew │ │ └── Car.java ├── 05_inheritance │ ├── Eric_Lin │ │ ├── Beserker.java │ │ ├── Hero.java │ │ ├── Knight.java │ │ └── Mage.java │ ├── README.md │ ├── dylan_hai │ │ ├── Berserker.java │ │ ├── Hero.java │ │ ├── Knight.java │ │ ├── Mage.java │ │ └── Main.java │ ├── elaine_ye │ │ ├── Berserker.java │ │ ├── Hero.java │ │ ├── Knight.java │ │ └── Mage.java │ ├── kevin_li │ │ └── hero.java │ ├── mahir_riki │ │ └── Hero.java │ ├── pak_lau │ │ ├── Berserker.java │ │ ├── Hero.java │ │ ├── Knight.java │ │ └── Mage.java │ ├── raihan_nadeem │ │ └── Main.java │ └── reya_miller │ │ └── 05_inheritance │ │ ├── README.md │ │ └── hero.java ├── 06_git2 │ ├── BugRunner.java │ ├── README.md │ ├── derekLi │ │ ├── BoxBug.java │ │ └── BoxBugRunner.java │ ├── example │ │ ├── LineBug.java │ │ └── LineBugRunner.java │ ├── group1 │ │ ├── AnthonyBug.java │ │ ├── Bee.java │ │ ├── BenBug.java │ │ ├── JuanBug.java │ │ ├── MommyMilkers.java │ │ ├── SammyBug.java │ │ ├── SomeBug.java │ │ └── YasuoBug.java │ ├── group3 │ │ ├── BoxBugKevin.java │ │ └── BoxBugKevinRunner.java │ ├── info │ │ └── gridworld │ │ │ ├── actor │ │ │ ├── Actor.gif │ │ │ ├── Actor.java │ │ │ ├── ActorWorld.java │ │ │ ├── BoxBug.gif │ │ │ ├── Bug.gif │ │ │ ├── Bug.java │ │ │ ├── Critter.gif │ │ │ ├── Critter.java │ │ │ ├── Flower.gif │ │ │ ├── Flower.java │ │ │ ├── Rock.gif │ │ │ └── Rock.java │ │ │ ├── grid │ │ │ ├── AbstractGrid.java │ │ │ ├── BoundedGrid.gif │ │ │ ├── BoundedGrid.java │ │ │ ├── Grid.java │ │ │ ├── Location.java │ │ │ ├── UnboundedGrid.gif │ │ │ └── UnboundedGrid.java │ │ │ ├── gui │ │ │ ├── AbstractDisplay.java │ │ │ ├── ColorEditor.java │ │ │ ├── DefaultDisplay.java │ │ │ ├── Display.java │ │ │ ├── DisplayMap.java │ │ │ ├── FormLayout.java │ │ │ ├── GUIController.java │ │ │ ├── GridPanel.java │ │ │ ├── GridWorld.gif │ │ │ ├── ImageDisplay.java │ │ │ ├── LocationEditor.java │ │ │ ├── MenuMaker.java │ │ │ ├── PseudoInfiniteViewport.java │ │ │ ├── WorldFrame.java │ │ │ └── WorldFrameResources.properties │ │ │ └── world │ │ │ └── World.java │ ├── mahir_riki │ │ ├── BoxBug.java │ │ └── BoxBugRunner.java │ ├── pak_lau │ │ ├── BoxBug.java │ │ ├── BoxBugRunner.java │ │ └── RainbowBug.java │ ├── run.sh │ └── scrots │ │ ├── default.PNG │ │ └── line.PNG ├── 07_trialbyfire │ ├── Driver.java │ └── README.md ├── 08_newbierobot │ ├── .project │ ├── .settings │ │ └── org.eclipse.buildship.core.prefs │ ├── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── readme.md │ ├── settings.gradle │ ├── src │ │ └── main │ │ │ ├── deploy │ │ │ └── example.txt │ │ │ └── java │ │ │ └── frc │ │ │ └── robot │ │ │ ├── Constants.java │ │ │ ├── Main.java │ │ │ ├── Robot.java │ │ │ ├── RobotContainer.java │ │ │ ├── commands │ │ │ ├── DrivetrainDriveCommand.java │ │ │ ├── DrivetrainSpinCommand.java │ │ │ ├── ShooterShootCommand.java │ │ │ ├── ShooterStopCommand.java │ │ │ └── autos │ │ │ │ └── DoNothingAutonCommand.java │ │ │ └── subsystems │ │ │ ├── Drivetrain.java │ │ │ └── Shooter.java │ └── vendordeps │ │ ├── Phoenix.json │ │ ├── WPILibNewCommands.json │ │ └── navx_frc.json └── README.md ├── 2022 ├── 01_CommandLine │ └── README.md ├── 02_JavaBasics │ └── README.md ├── 03_GitBasics │ └── README.md ├── 04_AdvancedJava │ └── README.md ├── 05_AdvancedGit │ └── README.md ├── 06_RobotCode │ └── README.md ├── README.md └── RichieBot │ ├── WPILib-License.md │ ├── bin │ └── main │ │ └── frc │ │ └── robot │ │ └── subsystems │ │ └── Note.txt │ ├── build.gradle │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── settings.gradle │ ├── src │ └── main │ │ ├── deploy │ │ └── example.txt │ │ └── java │ │ └── frc │ │ └── robot │ │ ├── Constants.java │ │ ├── Main.java │ │ ├── Robot.java │ │ ├── RobotContainer.java │ │ ├── commands │ │ ├── Cook.java │ │ ├── DriveDistanceCommand.java │ │ ├── DriveForwardCommand.java │ │ ├── ExampleCommand.java │ │ └── TankDriveCommand.java │ │ └── subsystems │ │ ├── Bread.java │ │ ├── Note.txt │ │ └── RomiDrivetrain.java │ └── vendordeps │ └── WPILibNewCommands.json ├── 2023 ├── 00_CommandLine │ └── README.md ├── 01_JavaBasics │ └── README.md ├── 02_GitEducation │ └── README.md ├── 03_ConditionalsAndArrays │ ├── Lesson3.java │ └── README.md ├── 04_Looping │ ├── Lesson4.java │ └── README.md ├── 05_Functions │ ├── Lesson5.java │ └── README.md ├── 06_OOP1 │ ├── Lesson6.java │ └── README.md ├── 07OOP2 │ ├── Car.java │ ├── Lesson7.java │ ├── README.md │ ├── Truck.java │ └── Vehicle.java ├── 08_OOP3 │ ├── Account.java │ ├── Ball.java │ ├── Circle.java │ ├── Lesson8.java │ ├── Main.java │ ├── MyDate.java │ ├── Player.java │ └── README.md ├── 09_OOP4 │ ├── Lesson9.java │ ├── README.md │ ├── robot │ │ ├── AbstractRobot.java │ │ ├── Robot.java │ │ └── Shooter.java │ └── vehicles │ │ ├── Car.java │ │ ├── Truck.java │ │ └── Vehicle.java ├── 10_MotorLabs │ ├── DriveFunctions.java │ └── README.md ├── 11_Hardware │ ├── README.md │ └── outtake │ │ └── Outtake.java ├── 12_Software │ └── README.md ├── 13_CommandsNShooterLabs │ └── README.md ├── 14_AutonsNPaths │ ├── NewbieAuton.java │ ├── NewbieAuton.path │ └── README.md ├── 15_ControlTheory │ ├── Controller.java │ ├── FeedForwardController.java │ ├── PIDController.java │ └── README.md ├── 16_StuyLib │ └── README.md └── resources │ └── README.md ├── .gitignore ├── .vscode └── launch.json ├── LICENSE ├── README.md └── resources └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/java,macos,gradle,windows,visualstudiocode 3 | # Edit at https://www.gitignore.io/?templates=java,macos,gradle,windows,visualstudiocode 4 | 5 | ### Java ### 6 | # Compiled class file 7 | *.class 8 | 9 | # Log file 10 | *.log 11 | 12 | # BlueJ files 13 | *.ctxt 14 | 15 | # Mobile Tools for Java (J2ME) 16 | .mtj.tmp/ 17 | 18 | # Package Files # 19 | *.jar 20 | *.war 21 | *.nar 22 | *.ear 23 | *.zip 24 | *.tar.gz 25 | *.rar 26 | 27 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 28 | hs_err_pid* 29 | 30 | ### macOS ### 31 | # General 32 | .DS_Store 33 | .AppleDouble 34 | .LSOverride 35 | 36 | # Icon must end with two \r 37 | Icon 38 | 39 | # Thumbnails 40 | ._* 41 | 42 | # Files that might appear in the root of a volume 43 | .DocumentRevisions-V100 44 | .fseventsd 45 | .Spotlight-V100 46 | .TemporaryItems 47 | .Trashes 48 | .VolumeIcon.icns 49 | .com.apple.timemachine.donotpresent 50 | 51 | # Directories potentially created on remote AFP share 52 | .AppleDB 53 | .AppleDesktop 54 | Network Trash Folder 55 | Temporary Items 56 | .apdisk 57 | 58 | ### VisualStudioCode ### 59 | .vscode/* 60 | !.vscode/settings.json 61 | !.vscode/tasks.json 62 | !.vscode/launch.json 63 | !.vscode/extensions.json 64 | 65 | ### VisualStudioCode Patch ### 66 | # Ignore all local history of files 67 | .history 68 | 69 | ### Windows ### 70 | # Windows thumbnail cache files 71 | Thumbs.db 72 | Thumbs.db:encryptable 73 | ehthumbs.db 74 | ehthumbs_vista.db 75 | 76 | # Dump file 77 | *.stackdump 78 | 79 | # Folder config file 80 | [Dd]esktop.ini 81 | 82 | # Recycle Bin used on file shares 83 | $RECYCLE.BIN/ 84 | 85 | # Windows Installer files 86 | *.cab 87 | *.msi 88 | *.msix 89 | *.msm 90 | *.msp 91 | 92 | # Windows shortcuts 93 | *.lnk 94 | 95 | ### Gradle ### 96 | .gradle 97 | build/ 98 | 99 | # Ignore Gradle GUI config 100 | gradle-app.setting 101 | 102 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 103 | !gradle-wrapper.jar 104 | 105 | # Cache of project 106 | .gradletasknamecache 107 | 108 | # # Work around https://youtrack.jetbrains.com/issue/IDEA-116898 109 | # gradle/wrapper/gradle-wrapper.properties 110 | 111 | ### Gradle Patch ### 112 | **/build/ 113 | 114 | # End of https://www.gitignore.io/api/java,macos,gradle,windows,visualstudiocode 115 | 116 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "configurations": [ 3 | { 4 | "type": "java", 5 | "name": "Main", 6 | "request": "launch", 7 | "mainClass": "Main", 8 | "projectName": "newbie-ed_7dbd7922" 9 | }, 10 | { 11 | "type": "java", 12 | "name": "Lesson7", 13 | "request": "launch", 14 | "mainClass": "Lesson7", 15 | "projectName": "newbie-ed_7dbd7922" 16 | }, 17 | { 18 | "type": "java", 19 | "name": "CodeLens (Launch) - Main", 20 | "request": "launch", 21 | "mainClass": "Main", 22 | "projectName": "newbie-ed_4a15b88d" 23 | }, 24 | { 25 | "type": "java", 26 | "name": "Debug (Launch) - Current File", 27 | "request": "launch", 28 | "mainClass": "${file}" 29 | } 30 | ] 31 | } -------------------------------------------------------------------------------- /2020/Conventions.java: -------------------------------------------------------------------------------- 1 | // 2 | // FRC Team 2910 coding conventions for the Java(tm) programming language 3 | // Note: Team 694 uses the same coding conventions, we just stole this document from them 4 | // Note 2: Actually we follow these coding conventions better than they do, because I read some of their other repos, and they cheat a lot 5 | // 6 | 7 | /* 8 | First, some basic terminology: 9 | - A class-level variable is a static variable. 10 | - A field is a non-static, member variable of a class or enum. 11 | - A constant is a final class-level variable. 12 | 13 | Always use curly braces even for single line statements. 14 | Curly braces start on the same line. 15 | 16 | Tab size is 4. 17 | 18 | Function names should be descriptive 19 | - Name a function after the action it performs. 20 | - Getters/Setters should start with "get" and "set" 21 | - Functions that return a bool should be phrased as a question. 22 | - Ex. isReady(), doesThingExist(), hasThing() 23 | 24 | Use comments and newlines to explain and organize code. 25 | Use asserts. 26 | 27 | Avoid using public member variables. Prefer to use Getters/Setters. 28 | 29 | Do not use "this." to access member variables (Ex. this.mMemberVariable) 30 | */ 31 | 32 | public class ThisIsAClass { // Classes use UpperCamelCase 33 | 34 | public static final double THIS_IS_A_CONSTANT = 3.14; // Constants use UPPERCASE_WITH_UNDERSCORES 35 | 36 | private double mMemberVariable = 2.71828; // All member variables are prefixed with 'm' followed by UpperCamelCase 37 | 38 | public int getNumber() { // method names are lowerCamelCase 39 | int newVariable; // Declare one variable per line 40 | int anotherVariable; // Declare one variable per line 41 | 42 | // Always use curly braces even for single-line statements 43 | if (foo.memberFunction()) { // Curly braces start on the same line 44 | return 0; 45 | } else { 46 | return 5; 47 | } 48 | } 49 | } 50 | 51 | public enum ThisIsAnEnum { // Enums use UpperCamelCase 52 | ENUM_VALUE, // Enum values use UPPERCASE_WITH_UNDERSCORES 53 | ANOTHER_VALUE 54 | } 55 | 56 | public interface IThisIsAnInterface { // Interfaces are prefixed with a 'I' and use UpperCamelCase 57 | void doAThing(); 58 | } 59 | 60 | -------------------------------------------------------------------------------- /2020/Lesson #1/ExampleOne.java: -------------------------------------------------------------------------------- 1 | 2 | import java.io.FileWriter; 3 | import java.io.IOException; 4 | 5 | class ExampleOne { 6 | 7 | public static void main(String args[]) throws IOException { 8 | 9 | // This is a comment 10 | // They are green, and dont affect the code 11 | 12 | // Make a number 13 | double age = 41; 14 | boolean felon = false; 15 | String name = ""; 16 | 17 | System.out.println(name + " is " + age + " Years Old."); 18 | 19 | 20 | // Say wants to buy a drink 21 | if (age < 21) { 22 | System.out.println("It is time for you to go to jail!"); 23 | 24 | // Make a double that counts jail time 25 | double jailTime = 0; 26 | 27 | // Make Newbie Felon 28 | felon = true; 29 | 30 | // Keep in jail until she/he has served their time 31 | while (jailTime < 25) { 32 | System.out.println(name + " Has been in jail for " + jailTime + " years!"); 33 | 34 | jailTime = jailTime + 1; 35 | age = age + 1; 36 | } 37 | 38 | } else { 39 | System.out.println("Here, Have a Drink!"); 40 | } 41 | 42 | // Make report about Newbie 43 | FileWriter report = new FileWriter("./report.txt"); 44 | 45 | report.write(name + ": \n"); 46 | report.write("age: " + age + "\n"); 47 | report.write("felon: " + felon + "\n"); 48 | 49 | report.flush(); 50 | } 51 | } -------------------------------------------------------------------------------- /2020/Lesson #1/Lesson Plan.txt: -------------------------------------------------------------------------------- 1 | The plan of the fist lesson is to cover the topics in this slide. 2 | https://docs.google.com/presentation/d/1z1E3HLfAEsyye_5G5BnJzk1hj3ShV2cvw7eL7QBW2Co 3 | 4 | Instead of doing the slide, I am considering doing live coding to explain subjects 5 | as it allows me to explain things using code instead of pointing to examples in the 6 | slide. 7 | 8 | I think it might be more adaptable. The Lesson.java file in this folder is the 9 | plan that I would plan to take the live code in. It comes with explainations 10 | and code that should be used in the lesson. 11 | 12 | My plan is to cover: 13 | - Comments 14 | - Variables 15 | - Print Statements 16 | - Conditionals / If Statements 17 | - While Loops 18 | - For Loops? 19 | - Imports? 20 | - Objects 21 | - Opening a file? 22 | - Functions? 23 | - Calling them 24 | - Inputs 25 | - Outputs -------------------------------------------------------------------------------- /2020/Lesson #1/Lesson.java: -------------------------------------------------------------------------------- 1 | 2 | import java.io.FileWriter; 3 | import java.io.IOException; 4 | import java.io.File; 5 | 6 | class Lesson { 7 | 8 | public static void main(String args) { 9 | 10 | // TODO: Explain Comments 11 | 12 | 13 | // TODO: Create a double and string 14 | 15 | 16 | // TODO: Print out the variables 17 | 18 | 19 | // TODO: Introduce Conditions 20 | // TODO: Use If with Conditionals 21 | 22 | 23 | // TODO: Make a While Loop 24 | 25 | 26 | // TODO: Make text file 27 | 28 | 29 | // TODO: Sumarize everything that happened in text file 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /2020/Lesson #2/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "wpilib", 10 | "name": "WPILib Desktop Debug", 11 | "request": "launch", 12 | "desktop": true, 13 | }, 14 | { 15 | "type": "wpilib", 16 | "name": "WPILib roboRIO Debug", 17 | "request": "launch", 18 | "desktop": false, 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /2020/Lesson #2/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic", 3 | "files.exclude": { 4 | "**/.git": true, 5 | "**/.svn": true, 6 | "**/.hg": true, 7 | "**/CVS": true, 8 | "**/.DS_Store": true, 9 | "bin/": true, 10 | ".classpath": true, 11 | ".project": true 12 | }, 13 | "wpilib.online": true 14 | } 15 | -------------------------------------------------------------------------------- /2020/Lesson #2/.wpilib/wpilib_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "enableCppIntellisense": false, 3 | "currentLanguage": "java", 4 | "projectYear": "2019", 5 | "teamNumber": 694 6 | } -------------------------------------------------------------------------------- /2020/Lesson #2/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2019.1.1" 4 | } 5 | 6 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 7 | 8 | // Define my targets (RoboRIO) and artifacts (deployable files) 9 | // This is added by GradleRIO's backing project EmbeddedTools. 10 | deploy { 11 | targets { 12 | roboRIO("roborio") { 13 | // Team number is loaded either from the .wpilib/wpilib_preferences.json 14 | // or from command line. If not found an exception will be thrown. 15 | // You can use getTeamOrDefault(team) instead of getTeamNumber if you 16 | // want to store a team number in this file. 17 | team = frc.getTeamNumber() 18 | } 19 | } 20 | artifacts { 21 | frcJavaArtifact('frcJava') { 22 | targets << "roborio" 23 | // Debug can be overridden by command line, for use with VSCode 24 | debug = frc.getDebugOrDefault(false) 25 | } 26 | // Built in artifact to deploy arbitrary files to the roboRIO. 27 | fileTreeArtifact('frcStaticFileDeploy') { 28 | // The directory below is the local directory to deploy 29 | files = fileTree(dir: 'src/main/deploy') 30 | // Deploy to RoboRIO target, into /home/lvuser/deploy 31 | targets << "roborio" 32 | directory = '/home/lvuser/deploy' 33 | } 34 | } 35 | } 36 | 37 | // Set this to true to enable desktop support. 38 | def includeDesktopSupport = false 39 | 40 | // Maven central needed for JUnit 41 | repositories { 42 | mavenCentral() 43 | } 44 | 45 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 46 | // Also defines JUnit 4. 47 | dependencies { 48 | compile wpi.deps.wpilib() 49 | compile wpi.deps.vendor.java() 50 | nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio) 51 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 52 | testCompile 'junit:junit:4.12' 53 | } 54 | 55 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 56 | // in order to make them all available at runtime. Also adding the manifest so WPILib 57 | // knows where to look for our Robot Class. 58 | jar { 59 | from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } 60 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 61 | } 62 | -------------------------------------------------------------------------------- /2020/Lesson #2/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Lesson #2/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /2020/Lesson #2/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /2020/Lesson #2/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2019' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | frcHome = new File(publicFolder, "frc${frcYear}") 15 | } else { 16 | def userFolder = System.getProperty("user.home") 17 | frcHome = new File(userFolder, "frc${frcYear}") 18 | } 19 | def frcHomeMaven = new File(frcHome, 'maven') 20 | maven { 21 | name 'frcHome' 22 | url frcHomeMaven 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /2020/Lesson #2/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'FileUtilities.getFilePath' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /2020/Lesson #2/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot; 9 | 10 | import edu.wpi.first.wpilibj.RobotBase; 11 | 12 | /** 13 | * Do NOT add any static variables to this class, or any initialization at all. 14 | * Unless you know what you are doing, do not modify this file except to 15 | * change the parameter class to the startRobot call. 16 | */ 17 | public final class Main { 18 | private Main() { 19 | } 20 | 21 | /** 22 | * Main initialization function. Do not perform any initialization here. 23 | * 24 | *

If you change your main robot class, change the parameter type. 25 | */ 26 | public static void main(String... args) { 27 | RobotBase.startRobot(Robot::new); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /2020/Lesson #2/vendordeps/REVRobotics.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "REVRobotics.json", 3 | "name": "REVRobotics", 4 | "version": "1.1.9", 5 | "uuid": "3f48eb8c-50fe-43a6-9cb7-44c86353c4cb", 6 | "mavenUrls": [ 7 | "http://www.revrobotics.com/content/sw/max/sdk/maven/" 8 | ], 9 | "jsonUrl": "http://www.revrobotics.com/content/sw/max/sdk/REVRobotics.json", 10 | "javaDependencies": [ 11 | { 12 | "groupId": "com.revrobotics.frc", 13 | "artifactId": "SparkMax-java", 14 | "version": "1.1.9" 15 | } 16 | ], 17 | "jniDependencies": [ 18 | { 19 | "groupId": "com.revrobotics.frc", 20 | "artifactId": "SparkMax-driver", 21 | "version": "1.1.9", 22 | "skipInvalidPlatforms": true, 23 | "isJar": false, 24 | "validPlatforms": [ 25 | "linuxathena" 26 | ] 27 | } 28 | ], 29 | "cppDependencies": [ 30 | { 31 | "groupId": "com.revrobotics.frc", 32 | "artifactId": "SparkMax-cpp", 33 | "version": "1.1.9", 34 | "libName": "libSparkMax", 35 | "headerClassifier": "headers", 36 | "sharedLibrary": false, 37 | "skipInvalidPlatforms": true, 38 | "binaryPlatforms": [ 39 | "linuxathena" 40 | ] 41 | }, 42 | { 43 | "groupId": "com.revrobotics.frc", 44 | "artifactId": "SparkMax-driver", 45 | "version": "1.1.9", 46 | "libName": "libSparkMaxDriver", 47 | "headerClassifier": "headers", 48 | "sharedLibrary": false, 49 | "skipInvalidPlatforms": true, 50 | "binaryPlatforms": [ 51 | "linuxathena" 52 | ] 53 | } 54 | ] 55 | } -------------------------------------------------------------------------------- /2020/Lesson #3/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | 8 | { 9 | "type": "wpilib", 10 | "name": "WPILib Desktop Debug", 11 | "request": "launch", 12 | "desktop": true, 13 | }, 14 | { 15 | "type": "wpilib", 16 | "name": "WPILib roboRIO Debug", 17 | "request": "launch", 18 | "desktop": false, 19 | } 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /2020/Lesson #3/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "java.configuration.updateBuildConfiguration": "automatic", 3 | "files.exclude": { 4 | "**/.git": true, 5 | "**/.svn": true, 6 | "**/.hg": true, 7 | "**/CVS": true, 8 | "**/.DS_Store": true, 9 | "bin/": true, 10 | ".classpath": true, 11 | ".project": true 12 | }, 13 | "wpilib.online": true 14 | } 15 | -------------------------------------------------------------------------------- /2020/Lesson #3/.wpilib/wpilib_preferences.json: -------------------------------------------------------------------------------- 1 | { 2 | "enableCppIntellisense": false, 3 | "currentLanguage": "java", 4 | "projectYear": "2019", 5 | "teamNumber": 694 6 | } -------------------------------------------------------------------------------- /2020/Lesson #3/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2019.1.1" 4 | } 5 | 6 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 7 | 8 | // Define my targets (RoboRIO) and artifacts (deployable files) 9 | // This is added by GradleRIO's backing project EmbeddedTools. 10 | deploy { 11 | targets { 12 | roboRIO("roborio") { 13 | // Team number is loaded either from the .wpilib/wpilib_preferences.json 14 | // or from command line. If not found an exception will be thrown. 15 | // You can use getTeamOrDefault(team) instead of getTeamNumber if you 16 | // want to store a team number in this file. 17 | team = frc.getTeamNumber() 18 | } 19 | } 20 | artifacts { 21 | frcJavaArtifact('frcJava') { 22 | targets << "roborio" 23 | // Debug can be overridden by command line, for use with VSCode 24 | debug = frc.getDebugOrDefault(false) 25 | } 26 | // Built in artifact to deploy arbitrary files to the roboRIO. 27 | fileTreeArtifact('frcStaticFileDeploy') { 28 | // The directory below is the local directory to deploy 29 | files = fileTree(dir: 'src/main/deploy') 30 | // Deploy to RoboRIO target, into /home/lvuser/deploy 31 | targets << "roborio" 32 | directory = '/home/lvuser/deploy' 33 | } 34 | } 35 | } 36 | 37 | // Set this to true to enable desktop support. 38 | def includeDesktopSupport = false 39 | 40 | // Maven central needed for JUnit 41 | repositories { 42 | mavenCentral() 43 | } 44 | 45 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 46 | // Also defines JUnit 4. 47 | dependencies { 48 | compile wpi.deps.wpilib() 49 | compile wpi.deps.vendor.java() 50 | nativeZip wpi.deps.vendor.jni(wpi.platforms.roborio) 51 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 52 | testCompile 'junit:junit:4.12' 53 | } 54 | 55 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 56 | // in order to make them all available at runtime. Also adding the manifest so WPILib 57 | // knows where to look for our Robot Class. 58 | jar { 59 | from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } 60 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 61 | } 62 | -------------------------------------------------------------------------------- /2020/Lesson #3/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Lesson #3/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /2020/Lesson #3/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-5.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /2020/Lesson #3/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2019' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | frcHome = new File(publicFolder, "frc${frcYear}") 15 | } else { 16 | def userFolder = System.getProperty("user.home") 17 | frcHome = new File(userFolder, "frc${frcYear}") 18 | } 19 | def frcHomeMaven = new File(frcHome, 'maven') 20 | maven { 21 | name 'frcHome' 22 | url frcHomeMaven 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'FileUtilities.getFilePath' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot; 9 | 10 | import edu.wpi.first.wpilibj.RobotBase; 11 | 12 | /** 13 | * Do NOT add any static variables to this class, or any initialization at all. 14 | * Unless you know what you are doing, do not modify this file except to 15 | * change the parameter class to the startRobot call. 16 | */ 17 | public final class Main { 18 | private Main() { 19 | } 20 | 21 | /** 22 | * Main initialization function. Do not perform any initialization here. 23 | * 24 | *

If you change your main robot class, change the parameter type. 25 | */ 26 | public static void main(String... args) { 27 | RobotBase.startRobot(Robot::new); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/OI.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot; 9 | 10 | import frc.robot.commands.FloopCloseCommand; 11 | import frc.robot.commands.FloopOpenCommand; 12 | import frc.robot.commands.FloopPullCommand; 13 | import frc.robot.commands.FloopPushCommand; 14 | import frc.robot.commands.FloopStartScoreCommand; 15 | import frc.robot.commands.FloopStopScoreCommand; 16 | import frc.util.Gamepad; 17 | 18 | public class OI { 19 | 20 | public Gamepad gamepad; 21 | 22 | public OI() { 23 | 24 | gamepad = new Gamepad(0); 25 | 26 | //when each of the buttons is pressed, the corresponding command is called 27 | gamepad.getLeftButton().whenPressed(new FloopPushCommand()); 28 | gamepad.getRightButton().whenPressed(new FloopPullCommand()); 29 | gamepad.getTopButton().whenPressed(new FloopOpenCommand()); 30 | gamepad.getBottomButton().whenPressed(new FloopCloseCommand()); 31 | 32 | gamepad.getDPadLeft().whenPressed(new FloopStartScoreCommand()); 33 | gamepad.getDPadRight().whenPressed(new FloopStopScoreCommand()); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/Robot.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot; 9 | 10 | import edu.wpi.first.wpilibj.TimedRobot; 11 | import frc.robot.subsystems.Drivetrain; 12 | import frc.robot.subsystems.Floop; 13 | import frc.util.Gamepad; 14 | 15 | public class Robot extends TimedRobot { 16 | 17 | public static Drivetrain drivetrain; 18 | public static Floop floop; 19 | public static OI oi; 20 | 21 | @Override 22 | public void robotInit() { 23 | //creates new instance of Drivetrain object 24 | drivetrain = new Drivetrain(); 25 | 26 | floop = new Floop(); 27 | 28 | //makes new instance of OI (where buttons are connected with commands) 29 | oi = new OI(); 30 | 31 | } 32 | 33 | @Override 34 | public void robotPeriodic() { 35 | } 36 | 37 | @Override 38 | public void disabledInit() { 39 | } 40 | 41 | @Override 42 | public void disabledPeriodic() { 43 | } 44 | 45 | @Override 46 | public void autonomousInit() { 47 | } 48 | 49 | @Override 50 | public void autonomousPeriodic() { 51 | //prints out the current tick count from the encoder 52 | //this is using the method made in Drivetrain.java 53 | System.out.println(drivetrain.getEncoderTicks()); 54 | } 55 | 56 | @Override 57 | public void teleopInit() { 58 | } 59 | 60 | @Override 61 | public void teleopPeriodic() { 62 | } 63 | 64 | @Override 65 | public void testPeriodic() { 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/RobotMap.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2017-2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot; 9 | 10 | /** 11 | * The RobotMap is a mapping from the ports sensors and actuators are wired into 12 | * to a variable name. This provides flexibility changing wiring, makes checking 13 | * the wiring easier and significantly reduces the number of magic numbers 14 | * floating around. 15 | */ 16 | public class RobotMap { 17 | public static final int DRIVETRAIN_LEFT_FRONT_MOTOR_PORT = -1; 18 | public static final int DRIVETRAIN_RIGHT_FRONT_MOTOR_PORT = -1; 19 | public static final int DRIVETRAIN_LEFT_REAR_MOTOR_PORT = -1; 20 | public static final int DRIVETRAIN_RIGHT_REAR_MOTOR_PORT = -1; 21 | 22 | public static final int FLOOP_SOLENOID_PORT = -1; 23 | public static final int PUSHER_SOLENOID_PORT = -1; 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/commands/DrivetrainDriveCommand.java: -------------------------------------------------------------------------------- 1 | package frc.robot.commands; 2 | 3 | import edu.wpi.first.wpilibj.command.Command; 4 | 5 | import frc.robot.Robot; 6 | public class DrivetrainDriveCommand extends Command { 7 | 8 | public DrivetrainDriveCommand() { 9 | // Use requires() here to declare subsystem dependencies 10 | requires(Robot.drivetrain); 11 | } 12 | 13 | // Called just before this Command runs the first time 14 | @Override 15 | protected void initialize() { 16 | } 17 | 18 | // Called repeatedly when this Command is scheduled to run 19 | @Override 20 | protected void execute() { 21 | Robot.drivetrain.tankDrive(Robot.oi.gamepad.getLeftY(), Robot.oi.gamepad.getRightY()); 22 | } 23 | 24 | // Make this return true when this Command no longer needs to run execute() 25 | @Override 26 | protected boolean isFinished() { 27 | return false; 28 | } 29 | 30 | // Called once after isFinished returns true 31 | @Override 32 | protected void end() { 33 | } 34 | 35 | // Called when another command which requires one or more of the same 36 | // subsystems is scheduled to run 37 | @Override 38 | protected void interrupted() { 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/commands/FloopCloseCommand.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot.commands; 9 | 10 | import edu.wpi.first.wpilibj.command.Command; 11 | import frc.robot.Robot; 12 | 13 | public class FloopCloseCommand extends Command { 14 | public FloopCloseCommand() { 15 | requires(Robot.floop); 16 | } 17 | 18 | @Override 19 | protected void initialize() { 20 | Robot.floop.close(); 21 | } 22 | 23 | @Override 24 | protected boolean isFinished() { 25 | return true; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/commands/FloopOpenCommand.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot.commands; 9 | 10 | import edu.wpi.first.wpilibj.command.Command; 11 | import frc.robot.Robot; 12 | 13 | public class FloopOpenCommand extends Command { 14 | public FloopOpenCommand() { 15 | requires(Robot.floop); 16 | } 17 | 18 | @Override 19 | protected void initialize() { 20 | Robot.floop.open(); 21 | } 22 | 23 | @Override 24 | protected boolean isFinished() { 25 | return true; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/commands/FloopPullCommand.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot.commands; 9 | 10 | import edu.wpi.first.wpilibj.command.Command; 11 | import frc.robot.Robot; 12 | 13 | public class FloopPullCommand extends Command { 14 | public FloopPullCommand() { 15 | requires(Robot.floop); 16 | } 17 | 18 | @Override 19 | protected void initialize() { 20 | Robot.floop.pull(); 21 | } 22 | 23 | @Override 24 | protected boolean isFinished() { 25 | return true; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/commands/FloopPushCommand.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot.commands; 9 | 10 | import edu.wpi.first.wpilibj.command.Command; 11 | import frc.robot.Robot; 12 | 13 | public class FloopPushCommand extends Command { 14 | public FloopPushCommand() { 15 | requires(Robot.floop); 16 | } 17 | 18 | @Override 19 | protected void initialize() { 20 | Robot.floop.push(); 21 | } 22 | 23 | @Override 24 | protected boolean isFinished() { 25 | return true; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/commands/FloopStartScoreCommand.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot.commands; 9 | 10 | import edu.wpi.first.wpilibj.command.CommandGroup; 11 | 12 | public class FloopStartScoreCommand extends CommandGroup { 13 | 14 | //command groups are a sequence of groups that are run in order 15 | //used for autons, for example 16 | //addSequential adds commands that will run one after the other 17 | //addParallel adds commands that will run together 18 | public FloopStartScoreCommand() { 19 | addSequential(new FloopCloseCommand()); 20 | addSequential(new FloopPushCommand()); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/commands/FloopStopScoreCommand.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot.commands; 9 | 10 | import edu.wpi.first.wpilibj.command.CommandGroup; 11 | import edu.wpi.first.wpilibj.command.WaitCommand; 12 | 13 | public class FloopStopScoreCommand extends CommandGroup { 14 | 15 | public FloopStopScoreCommand() { 16 | addSequential(new FloopPullCommand()); 17 | addSequential(new WaitCommand(0.25)); //adds a pause between these two commands 18 | addSequential(new FloopOpenCommand()); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /2020/Lesson #3/src/main/java/frc/robot/subsystems/Floop.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot.subsystems; 9 | 10 | import edu.wpi.first.wpilibj.Solenoid; 11 | import edu.wpi.first.wpilibj.command.Subsystem; 12 | import frc.robot.RobotMap; 13 | 14 | public class Floop extends Subsystem { 15 | 16 | private Solenoid floopSolenoid; 17 | private Solenoid pusherSolenoid; 18 | 19 | public Floop() { 20 | floopSolenoid = new Solenoid(RobotMap.FLOOP_SOLENOID_PORT); 21 | pusherSolenoid = new Solenoid(RobotMap.PUSHER_SOLENOID_PORT); 22 | } 23 | 24 | @Override 25 | public void initDefaultCommand() { 26 | //no default commands for floop 27 | } 28 | 29 | public void push() { 30 | pusherSolenoid.set(true); 31 | } 32 | 33 | public void pull() { 34 | pusherSolenoid.set(false); 35 | } 36 | 37 | public void open() { 38 | floopSolenoid.set(true); 39 | } 40 | 41 | public void close() { 42 | floopSolenoid.set(false); 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /2020/Robotics/694/Engineering/Brianna.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Engineering/Brianna.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Engineering/Eric.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Engineering/Eric.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Engineering/Mr.Blay.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Engineering/Mr.Blay.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Marketing/Areyan.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Marketing/Areyan.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Marketing/Sabrina.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Marketing/Sabrina.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Adris2018.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Adris2018.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Ayan2022.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Ayan2022.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Brian2023.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Brian2023.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Emily2020.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Emily2020.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Eric2022.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Eric2022.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/George2019.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/George2019.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/HuiMin2019.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/HuiMin2019.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Ivan2022.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Ivan2022.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Jin2021.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Jin2021.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Kevin2020.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Kevin2020.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Miguel2022.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Miguel2022.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Nicky2022.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Nicky2022.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Pak2021.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Pak2021.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Pratham2020.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Pratham2020.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Ryan2021.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Ryan2021.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Sam2022.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Sam2022.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Sheon2019.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Sheon2019.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Tahsin2021.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Tahsin2021.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Timothy2019.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Timothy2019.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Victor2021.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Victor2021.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Willis2021.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Willis2021.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Wilson2017.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Wilson2017.txt -------------------------------------------------------------------------------- /2020/Robotics/694/Software/Winston2020.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2020/Robotics/694/Software/Winston2020.txt -------------------------------------------------------------------------------- /2021/01_cmd/README.md: -------------------------------------------------------------------------------- 1 | # 01_cmd 2 | 3 | Lesson Slides: [here](https://docs.google.com/presentation/d/150pdD_KhL8tzTVYqMRFvlCp5fvCbr4M_Bp8RuA-AGJQ/edit?usp=sharing)
4 | Recording: [here](https://drive.google.com/file/d/1EMDaE0Ngja2oYtcp3N6LJ4_MThr7pQjW/view?usp=sharing) -------------------------------------------------------------------------------- /2021/02_git/DerekLi/README.md: -------------------------------------------------------------------------------- 1 | # DerekLi 2 | -------------------------------------------------------------------------------- /2021/02_git/Kirill_Vesialou/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/02_git/Kirill_Vesialou/README.md -------------------------------------------------------------------------------- /2021/02_git/Lin_Eric/readme.md: -------------------------------------------------------------------------------- 1 | I like pizza, so feel free to buy me some. I like food. 2 | 3 | -------------------------------------------------------------------------------- /2021/02_git/README.md: -------------------------------------------------------------------------------- 1 | # 02_git 2 | 3 | Lesson Slides: [here](https://docs.google.com/presentation/d/1EMUmq-82oTyH2jIl2wT7KT6lPpmhIhBIWQ6qlKFcL0U/edit?usp=sharing)
4 | Recording: [here](https://drive.google.com/file/d/1mZUWKh0yP2WpUhcx5h9O63ko7zmCkMfK/view?usp=sharing) 5 | 6 | ## Assignment 7 | 8 | Create a folder using the following naming convention: `_` 9 | cd into the folder and create a file called `README.md`. This is the file that github will show when you look at a folder. 10 | In the `README.md` file put your first and last name as a header like so: 11 | ``` 12 | # 13 | ``` 14 | Below you may put anything that you want to share (does not necessarily have to be about you). Or you may put nothing. 15 | Finally commit and push your changes. 16 | 17 | ## Extra 18 | 19 | The `README.md` file is in a special markdown format that is compatiable with HTML. 20 | You can read more about markdown [here](https://github.com/adam-p/markdown-here/wiki/Markdown-Here-Cheatsheet). 21 | 22 | If you feel like spicing up your markdown file then try adding an image or maybe some links... 23 | 24 | ## Example 25 | 26 | Check out [john_doe](john_doe). 27 | 28 | # Two Factor Authentication (2fa) 29 | 30 | In order to commit to our organization you'll need to have 2fa enabled. You can read about it [here](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/configuring-two-factor-authentication).

31 | There are two ways to commit with 2fa enabled: 32 | 1. Personal Access Token: this is a password that will replace your normal password. more into [here](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/creating-a-personal-access-token). 33 | 2. SSH key: this uses a different protocool for the remote repo called [ssh](https://www.digitalocean.com/community/tutorials/ssh-essentials-working-with-ssh-servers-clients-and-keys). more info [here](https://docs.github.com/en/free-pro-team@latest/github/authenticating-to-github/connecting-to-github-with-ssh). -------------------------------------------------------------------------------- /2021/02_git/Shaurya_sen/README.md: -------------------------------------------------------------------------------- 1 | # Shaurya Sen 2 | Hello there 3 | -------------------------------------------------------------------------------- /2021/02_git/Tianlang/README.md: -------------------------------------------------------------------------------- 1 | hi 2 | -------------------------------------------------------------------------------- /2021/02_git/Tianlang_Qin/README.md: -------------------------------------------------------------------------------- 1 | QWERDF 2 | -------------------------------------------------------------------------------- /2021/02_git/Yuchen_Pan/README.md: -------------------------------------------------------------------------------- 1 | # Yuchen Pan 2 | -------------------------------------------------------------------------------- /2021/02_git/ZidanniClerigo/README.md: -------------------------------------------------------------------------------- 1 | # Zidanni Clerigo 2 | -------------------------------------------------------------------------------- /2021/02_git/ZidanniClerigo/y: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /2021/02_git/aiden_li/README.md: -------------------------------------------------------------------------------- 1 | # Aiden Li 2 | 3 | -------------------------------------------------------------------------------- /2021/02_git/alvin_he/README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/02_git/alvin_he/README -------------------------------------------------------------------------------- /2021/02_git/alvin_he/README.md: -------------------------------------------------------------------------------- 1 | #alvin_he 2 | 3 | -------------------------------------------------------------------------------- /2021/02_git/anthony_chen/README.md: -------------------------------------------------------------------------------- 1 | # I am using Git Bash and Nano to create and modify this file! 2 | 3 | -------------------------------------------------------------------------------- /2021/02_git/benjamin_goldfisher/README.md: -------------------------------------------------------------------------------- 1 | # Benjamin Goldfisher 2 | test 3 | test again 4 | -------------------------------------------------------------------------------- /2021/02_git/brandon_phiong/README.md: -------------------------------------------------------------------------------- 1 | brandon_phiong3 2 | -------------------------------------------------------------------------------- /2021/02_git/brandon_phiong/README.mdes: -------------------------------------------------------------------------------- 1 | brandon_phiong 2 | 3 | -------------------------------------------------------------------------------- /2021/02_git/brandon_phiong/brandon_phiong: -------------------------------------------------------------------------------- 1 | brandon_phiong 2 | -------------------------------------------------------------------------------- /2021/02_git/calvin_zhang/README.md: -------------------------------------------------------------------------------- 1 | # Calvin Zhang 2 | -------------------------------------------------------------------------------- /2021/02_git/dylan_hai/README.md: -------------------------------------------------------------------------------- 1 | #dylan hai 2 | Here you go -------------------------------------------------------------------------------- /2021/02_git/elaine_ye/README.md: -------------------------------------------------------------------------------- 1 | # hi 2 | 3 | -------------------------------------------------------------------------------- /2021/02_git/ivan_chen/README.md: -------------------------------------------------------------------------------- 1 | Ivan Chen 2 | -------------------------------------------------------------------------------- /2021/02_git/john_doe/README.md: -------------------------------------------------------------------------------- 1 | # John Doe 2 | 3 | Hi my name is John Doe. 4 | ![john](https://vignette.wikia.nocookie.net/old-roblox/images/2/23/JohnDoeOldAvatar.png/revision/latest/top-crop/width/360/height/450?cb=20200508081710) -------------------------------------------------------------------------------- /2021/02_git/jonathan_deng/README.md: -------------------------------------------------------------------------------- 1 | # Jonathan Deng 2 | 3 | -------------------------------------------------------------------------------- /2021/02_git/kevin_li/README.md: -------------------------------------------------------------------------------- 1 | hi did i do this right 2 | 3 | -------------------------------------------------------------------------------- /2021/02_git/mahir_riki/README.md: -------------------------------------------------------------------------------- 1 | # Mahir Riki 2 | -------------------------------------------------------------------------------- /2021/02_git/mark_zhu/README.md: -------------------------------------------------------------------------------- 1 | # Mark Zhu 2 | -------------------------------------------------------------------------------- /2021/02_git/myles_pasetsky/README.md: -------------------------------------------------------------------------------- 1 | _____ 2 | | D 3 | | | 4 | | | 5 | \___| _ 6 | || _______ -( (- 7 | |_'(-------) '-' 8 | | / 9 | _____,-\__..__|_____Pr59 10 | 11 | -------------------------------------------------------------------------------- /2021/02_git/nehemiah_jang/README.md: -------------------------------------------------------------------------------- 1 | # Nehemiah Jang 2 | 3 | -------------------------------------------------------------------------------- /2021/02_git/nicky_lin/README.md: -------------------------------------------------------------------------------- 1 | # Nicky Lin 2 | 3 | ![nicky](https://media.discordapp.net/attachments/484572814465040386/770761261977305158/0_JS164998846.png?width=867&height=650) 4 | ![thicc](https://cdn.discordapp.com/attachments/668227065677479956/770762436361060402/lei.PNG) 5 | -------------------------------------------------------------------------------- /2021/02_git/pak_lau/README.md: -------------------------------------------------------------------------------- 1 | # Pak Ming Lau 2 | All known laws of aviation 3 | 4 | 5 | -------------------------------------------------------------------------------- /2021/02_git/paul_serbanescu/README.md: -------------------------------------------------------------------------------- 1 | # Paul Serbanescu 2 | 3 | whoops 4 | 5 | -------------------------------------------------------------------------------- /2021/02_git/phillip_guan/README.md: -------------------------------------------------------------------------------- 1 | # Phillip Guan POGGERS 2 | -------------------------------------------------------------------------------- /2021/02_git/raihan_nadeem/README.md: -------------------------------------------------------------------------------- 1 | # hello #3 2 | -------------------------------------------------------------------------------- /2021/02_git/randy_sim/README.md: -------------------------------------------------------------------------------- 1 | # Randy Sim 2 | 3 | Hey. -------------------------------------------------------------------------------- /2021/02_git/renee_mui/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/02_git/renee_mui/README.md -------------------------------------------------------------------------------- /2021/02_git/reya_miller/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/02_git/reya_miller/README.md -------------------------------------------------------------------------------- /2021/02_git/sam_belliveau/README.md: -------------------------------------------------------------------------------- 1 | # sam_belliveau 2 | -------------------------------------------------------------------------------- /2021/02_git/tahsin_ahmed/README.md: -------------------------------------------------------------------------------- 1 | # Tahsin Ahmed 2 | -------------------------------------------------------------------------------- /2021/02_git/yaqi_chew/README.git: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/02_git/yaqi_chew/README.git -------------------------------------------------------------------------------- /2021/02_git/yaqi_chew/README.md: -------------------------------------------------------------------------------- 1 | # yaqic -------------------------------------------------------------------------------- /2021/03_java/Eric_Lin/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | int cashMoneyEricHas = 0; 5 | int cashMoneyEricWants = 1000000; 6 | boolean ericWantsToWalkOnTheMoon = true; 7 | double theValueOfPi = 3.14159; 8 | System.out.println(cashMoneyEricHas); 9 | System.out.println(cashMoneyEricWants); 10 | System.out.println(ericWantsToWalkOnTheMoon); 11 | System.out.println(theValueOfPi); 12 | for( cashMoneyEricHas = 0; cashMoneyEricHas < 10; cashMoneyEricHas += 2){ 13 | System.out.println(cashMoneyEricHas); 14 | }}} 15 | 16 | 17 | -------------------------------------------------------------------------------- /2021/03_java/Kirill_Vesialou/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | } 5 | } -------------------------------------------------------------------------------- /2021/03_java/april_jang/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | int x = 10; 5 | double y = 10.10; 6 | boolean c = true; 7 | int g = 1; 8 | String d = "My fingers go brrrrrrrr"; 9 | for (x = 10; x >= 0; x--) { 10 | while (g <= 10 ) { 11 | if (g % 2 == 0) { 12 | System.out.println(d); 13 | } g++; 14 | } 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /2021/03_java/april_jang_two_practice/Main.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Main { 4 | public static void main(String[] args) { 5 | Scanner usersResponse = new Scanner(System.in); 6 | String usersName; 7 | Scanner usersColor = new Scanner(System.in); 8 | String usersFavColor; 9 | 10 | System.out.print("Enter your name: "); 11 | usersName = usersResponse.nextLine(); 12 | System.out.print("Enter your favorite color: "); 13 | usersFavColor = usersColor.nextLine(); 14 | 15 | System.out.println("Hi " + usersName + "! Your favorite color is " + usersFavColor + "!"); 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /2021/03_java/april_jang_two_practice/Secret.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Secret { 4 | public static void main(String [] args) { 5 | Scanner usersInput = new Scanner(System.in); 6 | String secretWord = "April"; 7 | String guess = ""; 8 | System.out.println("I'm thinking of a word!"); 9 | int guessTrys = 0; 10 | int guessStop = 3; 11 | boolean tooMuch = false; 12 | 13 | while (!guess.equals(secretWord) && !tooMuch) { 14 | 15 | if (guessTrys < guessStop) { 16 | 17 | System.out.print("Enter a guess: "); 18 | guess = usersInput.nextLine(); 19 | guessTrys++; 20 | 21 | } else { 22 | tooMuch = true; 23 | } 24 | } 25 | } 26 | if (tooMuch) { 27 | 28 | System.out.println("You lose, you couldn't guess the word in enough tries!"); 29 | 30 | } else { 31 | System.out.println("You guess the word correctly!"); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /2021/03_java/brandon_phiong/main.Java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | int a = 1; 5 | System.out.println(a); 6 | } 7 | } 8 | 9 | -------------------------------------------------------------------------------- /2021/03_java/derek_li/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | int y = 20; 5 | System.out.print1n(y); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /2021/03_java/dylan_hai/Main.java: -------------------------------------------------------------------------------- 1 | 2 | public class Main { 3 | public static void main(String[] args) { 4 | System.out.println("Hello world!"); 5 | String sisterName="Avery"; 6 | System.out.println(sisterName); 7 | Boolean truth= false; 8 | System.out.println(truth); 9 | Integer numbers= 10; 10 | for(Integer i=0; i= 25; b--) { 15 | System.out.println(b); 16 | } 17 | } 18 | 19 | public static void words() { 20 | String sentence = "This is a code in Java"; 21 | for (String word : sentence.split(" ")) { 22 | if (word.length() % 2 == 0) { 23 | System.out.println(word); 24 | } 25 | } 26 | } 27 | } 28 | 29 | -------------------------------------------------------------------------------- /2021/03_java/jonathan_deng/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | for(int=10; i>0;i-=2){ 4 | System.out.printIn(+i) 5 | -------------------------------------------------------------------------------- /2021/03_java/kevin_li/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | double y = 2.2; 5 | boolean z = true; 6 | System.out.println(y); 7 | System.out.println(z); 8 | for (int x = 0; x < 10; x++) {System.out.println(x);} 9 | for (int a = 0; a < 10; a+=2) {System.out.println(a);} 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /2021/03_java/mahir_riki/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | 5 | boolean hasTacos = true; 6 | int Yellow = 10; 7 | int myAge = 15; 8 | System.out.println(hasTacos); 9 | System.out.println(Yellow); 10 | System.out.println(myAge); 11 | 12 | for (int i = 1; i < 10; i++) { 13 | System.out.println(i); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /2021/03_java/nehemiah_jang/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | int x = 1; 5 | boolean y = true; 6 | String a = "Hi"; 7 | double s = 5.69; 8 | while (x < 11) { 9 | if (x % 2 == 0) { 10 | System.out.println(x); 11 | } 12 | x++; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /2021/03_java/niki_chen/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | int myAge = 14; 5 | double exactAge = 14.16; 6 | boolean age = true; 7 | String height = "unknown"; 8 | System.out.println(myAge); 9 | System.out.println(exactAge); 10 | System.out.println(age); 11 | System.out.println(height); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /2021/03_java/pak_lau/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | boolean cheese = true; 5 | double bacon = 1.1; 6 | String fries = "yes"; 7 | System.out.println(cheese); 8 | System.out.println(bacon); 9 | System.out.println(fries); 10 | int burger = 2; 11 | while(burger < 11) { 12 | if(burger % 2 == 0) { 13 | System.out.println(burger); 14 | } 15 | burger++; 16 | } 17 | } 18 | } 19 | 20 | -------------------------------------------------------------------------------- /2021/03_java/paul_serbanescu/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | System.out.println("Hello world!"); 4 | 5 | int thisIsANumber = 69; 6 | boolean bool = true; 7 | 8 | for (int i = 0; i < 10; i++) { 9 | System.out.println(i); 10 | } 11 | 12 | System.out.println(""); 13 | 14 | for (int soImGonnaDoANewLoop = 0; soImGonnaDoANewLoop < 10; soImGonnaDoANewLoop += 2) { 15 | System.out.println(soImGonnaDoANewLoop); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /2021/03_java/raihan_nadeem/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | boolean iknowhowtodothis = true; 4 | int abc = 4; 5 | if (iknowhowtodothis) { 6 | System.out.println("i can do this"); 7 | } 8 | if (abc > 3) { 9 | System.out.println("4 is greater than 3 :D"); 10 | } 11 | for (int i = 0; i < 10; i+=2) { 12 | System.out.println(i); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /2021/03_java/zidanni_clerigo/Main.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/03_java/zidanni_clerigo/Main.java -------------------------------------------------------------------------------- /2021/04_oop/Kirill_Vesialou/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0 5 | private static final int MAX_MILEAGE = 20; 6 | 7 | public Car(String model, String color) { 8 | this.model = model; 9 | this.color = "colorless"; 10 | } 11 | 12 | public void repair() { 13 | int mileage = 0 14 | System.out.println("Repaired!"); 15 | } 16 | 17 | public String toString() { 18 | return "This car is a " + color + " " + model; 19 | } 20 | 21 | 22 | public boolean willExplode() { 23 | if (mileage>=MAX_MILEAGE) { 24 | return true; 25 | } 26 | else { 27 | return false; 28 | } 29 | } 30 | 31 | public void explode() { 32 | for(i = 5, i > 0, i--); { 33 | System.out.println(i); 34 | } 35 | if (i=0) { 36 | System.out.println("haha car go boom"); 37 | } 38 | } 39 | 40 | public void drive () { 41 | if (willExplode()) 42 | explode(); 43 | } 44 | else { 45 | System.out.println("vroom"); 46 | mileage++; 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /2021/04_oop/README.md: -------------------------------------------------------------------------------- 1 | # Exercise 2 | Edit the Car class to contain the requirements below (copy and paste the code into Car.java in your own folder (named as first_last) in this directory) 3 | ```java 4 | public class Car { 5 | private String model; 6 | private String color; 7 | 8 | public Car(String model, String color) { 9 | this.model = model; 10 | this.color = color; 11 | } 12 | 13 | public void repair() { 14 | System.out.println("Repaired!"); 15 | } 16 | 17 | public String toString() { 18 | return "This car is a " + color + " " + model; 19 | } 20 | } 21 | ``` 22 | 1. Add a new int field called mileage that is set to 0 23 | 2. Add a field called `private static final int MAX_MILEAGE = 20;` 24 | 3. Create a new constructor where it only takes in the model of a car and sets color to "colorless" 25 | 4. Add a method called `public boolean willExplode()` which returns whether or not a car will explode (if mileage is greater or equal to max mileage) 26 | 5. Edit the method repair() to set the mileage back to 0 and then notify us that the car is repaired 27 | 6. Add a new private method called `public void explode()` that will count down from 5 and once it reaches 0, print out `haha car go boom` 28 | 7. Add a method called `public void drive()` that if it will explode, then run explode(), and it not, print out vroom and increment the mileage by 1; 29 | 8. Test your code with this (copy and paste this into a file `Main.java` in the same directory as Car.java): 30 | ```java 31 | public class Main { 32 | 33 | public static void main(String[] args) { 34 | // hMDT stands for handMeDownToyota 35 | Car hMDT = new Car("Tesla", "fold"); 36 | 37 | System.out.println("Car: " + hMDT); 38 | 39 | // Task on hand: 40 | // Check if the chair is driving too much 41 | // If it is not, continue driving it 42 | // Otherwise destroy it 43 | 44 | // boolean ab = hMDT.willExplode(); 45 | 46 | while (!hMDT.willExplode()) { 47 | hMDT.drive(); 48 | } 49 | 50 | System.out.println("Whew that was close. Almost exploded."); 51 | hMDT.drive(); 52 | } 53 | } 54 | ``` 55 | -------------------------------------------------------------------------------- /2021/04_oop/aiden_li/car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | 7 | public Car(String model, String color) { 8 | this.model = model; 9 | this.color = color; 10 | } 11 | 12 | public Car(String model) { 13 | this.model = model; 14 | this.color = colorless; 15 | } 16 | 17 | public boolean willexplode(){ 18 | return mileage >= MAX_MILEAGE; 19 | } 20 | public void repair() { 21 | System.out.println("Repaired!"); 22 | } 23 | 24 | public void explode () { 25 | System.out.println("5"); 26 | System.out.println("4"); 27 | System.out.println("3"); 28 | System.out.println("2"); 29 | System.out.println("1"); 30 | System.out.println("*explosion*"); 31 | } 32 | public void drive() { 33 | 34 | 35 | if (willexplode() == true) { 36 | explode(); 37 | }else { 38 | System.out.println("wroom"); 39 | mileage ++; 40 | 41 | } 42 | 43 | } 44 | 45 | 46 | 47 | public String toString() { 48 | return "This car is a " + color + " " + model; 49 | } 50 | } -------------------------------------------------------------------------------- /2021/04_oop/april_jang/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | 7 | 8 | public Car(String model, String color) { 9 | this.model = model; 10 | this.color = color; 11 | } 12 | 13 | public Car(String model) { 14 | this.model = model; 15 | this.color = "Colorless"; 16 | } 17 | 18 | public void repair() { 19 | mileage = 0; 20 | System.out.println("Repaired!"); 21 | } 22 | 23 | public boolean willExplode () { 24 | return mileage >= MAX_MILEAGE; 25 | } 26 | 27 | private void explode() { 28 | for (int i = 5; i > 0; i--) { 29 | System.out.println(i); 30 | } 31 | 32 | System.out.println("haha car go boom"); 33 | } 34 | 35 | public void drive() { 36 | if (willExplode()) { 37 | explode(); 38 | } 39 | 40 | else { 41 | System.out.println("Vroom Vroom"); 42 | mileage++; 43 | } 44 | } 45 | 46 | public String toString() { 47 | return "This car is a " + color + " " + model; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /2021/04_oop/april_jang/Test.java: -------------------------------------------------------------------------------- 1 | public class Test { 2 | 3 | public static void main(String[] args) { 4 | 5 | Car car = new Car("tesla"); 6 | for (int i = 0; i <= 20; i++) { 7 | car.drive(); 8 | } 9 | car.repair(); 10 | System.out.println(car.willExplode()); 11 | } 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /2021/04_oop/brandon_phiong/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | 7 | public Car(String model, String color) { 8 | this.model = model; 9 | this.color = color; 10 | } 11 | 12 | public Car(String model) { 13 | this.model = model; 14 | this.color = "colorless"; 15 | } 16 | 17 | public boolean willExplode() { 18 | return mileage >= MAX_MILEAGE; 19 | 20 | } 21 | 22 | public void repair() { 23 | mileage = 0; 24 | System.out.println("Repaired!"); 25 | } 26 | 27 | private void explode() { 28 | System.out.println("5"); 29 | System.out.println("4"); 30 | System.out.println("3"); 31 | System.out.println("2"); 32 | System.out.println("1"); 33 | System.out.println("0"); 34 | System.out.println("haha car go boom"); 35 | } 36 | 37 | public void drive() { 38 | if (willExplode()) { 39 | explode(); 40 | } else { 41 | System.out.println("vroom"); 42 | mileage++; } 43 | } 44 | 45 | public String toString() { 46 | return "This car is a " + color + " " + model; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /2021/04_oop/brandon_phiong/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | 3 | public static void main(String[] args) { 4 | // hMDT stands for handMeDownToyota 5 | Car hMDT = new Car("Tesla", "fold"); 6 | 7 | System.out.println("Car: " + hMDT); 8 | 9 | // Task on hand: 10 | // Check if the chair is driving too much 11 | // If it is not, continue driving it 12 | // Otherwise destroy it 13 | 14 | // boolean ab = hMDT.willExplode(); 15 | 16 | while (!hMDT.willExplode()) { 17 | hMDT.drive(); 18 | } 19 | 20 | System.out.println("Whew that was close. Almost exploded."); 21 | hMDT.drive(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /2021/04_oop/dylan_hai/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | 7 | public Car(String model, String color) { 8 | this.model = model; 9 | this.color = color; 10 | } 11 | public Car(String model) { 12 | this.model = model; 13 | this.color = "colorless"; 14 | } 15 | public void repair() { 16 | this.mileage = 0; 17 | System.out.println("Repaired!"); 18 | } 19 | 20 | public String toString() { 21 | return "This car is a " + color + " " + model; 22 | } 23 | public boolean willExplode(){ 24 | if (this.mileage >= this.MAX_MILEAGE){ 25 | return true; 26 | } 27 | else { 28 | return false; 29 | } 30 | } 31 | private void explode(){ 32 | for (int i = 5;i>0;i--){ 33 | System.out.println(i); 34 | } 35 | System.out.println("haha car go boom"); 36 | } 37 | public void drive(){ 38 | if (willExplode()){ 39 | explode(); 40 | } 41 | else { 42 | System.out.println("vroom"); 43 | this.mileage++; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /2021/04_oop/dylan_hai/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | Car dylanCar = new Car("BMW 325i", "blue"); 4 | for(int i = 0; i<=20; i++){ 5 | dylanCar.drive(); 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /2021/04_oop/dylan_hai/test.java: -------------------------------------------------------------------------------- 1 | int foo = 5.0/3 -------------------------------------------------------------------------------- /2021/04_oop/elaine_ye/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | 7 | public Car(String model, String color) { 8 | this.model = model; 9 | this.color = color; 10 | } 11 | 12 | public Car(String model) { 13 | this.model = model; 14 | color = "colorless"; 15 | } 16 | 17 | public boolean willExplode() { 18 | return mileage >= MAX_MILEAGE; 19 | } 20 | 21 | public void repair() { 22 | mileage = 0; 23 | System.out.println("Repaired!"); 24 | } 25 | 26 | private void explode() { 27 | for (int countdown = 5; countdown >= 0; countdown--) { 28 | System.out.println(countdown); 29 | } 30 | System.out.println("haha car go boom boom"); 31 | } 32 | public void drive() { 33 | if (willExplode()) { 34 | explode(); 35 | } else { 36 | System.out.println("vroom"); 37 | mileage++; 38 | } 39 | } 40 | 41 | public String toString() { 42 | return "This car is a " + color + " " + model; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /2021/04_oop/elaine_ye/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | Car shinyCar = new Car("Toyota"); 4 | System.out.println(shinyCar); 5 | 6 | for (int i = 0; i < 21; i++) { 7 | shinyCar.drive(); 8 | } 9 | 10 | shinyCar.repair(); 11 | for (int i = 0; i < 21; i++) { 12 | shinyCar.drive(); 13 | } 14 | } 15 | } 16 | 17 | 18 | -------------------------------------------------------------------------------- /2021/04_oop/ivan_chen/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | 7 | public Car(String model, String color) { 8 | this.model = model; 9 | this.color = color; 10 | } 11 | 12 | public Car(String model) { 13 | this.model = model; 14 | this.color = "colorless"; 15 | } 16 | 17 | public boolean willExplode() { 18 | return mileage >= MAX_MILEAGE; 19 | } 20 | 21 | private void explode() { 22 | System.out.println("5"); 23 | System.out.println("4"); 24 | System.out.println("3"); 25 | System.out.println("2"); 26 | System.out.println("1"); 27 | System.out.println("haha car go boom"); 28 | } 29 | 30 | public void drive() { 31 | if (willExplode()) { 32 | explode(); 33 | } else { 34 | System.out.println("vroom"); 35 | mileage++; 36 | } 37 | } 38 | 39 | public void repair() { 40 | mileage = 0; 41 | System.out.println("Repaired!"); 42 | } 43 | 44 | public String toString() { 45 | return "This car is a " + color + " " + model; 46 | } 47 | } -------------------------------------------------------------------------------- /2021/04_oop/ivan_chen/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | Car myCar = new Car("Tesla"); 4 | System.out.println(myCar); 5 | 6 | for(int i = 0; i < 21; i++) { 7 | myCar.drive(); 8 | } 9 | 10 | for (int i = 0; i > 21; i++) { 11 | myCar.drive(); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /2021/04_oop/jonathan_deng/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | public Car(String model, String color) { 7 | this.model = model; 8 | this.color = color; 9 | } 10 | public Car(String model) { 11 | this.model = model; 12 | color="colourless"; 13 | } 14 | 15 | 16 | public void explode() { 17 | for (int i=5;i > 0;i--){ 18 | System.out.println(i); 19 | } 20 | System.out.println("haha car go boom"); 21 | } 22 | public boolean willExplode(){ 23 | return(mileage>=MAX_MILEAGE); 24 | } 25 | public void repair() { 26 | System.out.println("Repaired!"); 27 | } 28 | public String toString() { 29 | return "This car is a " + color + " " + model; 30 | } 31 | public void drive(){ 32 | if(willExplode()) 33 | explode(); 34 | else{ 35 | System.out.println("vroom"); 36 | mileage++; 37 | 38 | } 39 | 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /2021/04_oop/jonathan_deng/Test.java: -------------------------------------------------------------------------------- 1 | public class Test { 2 | 3 | public static void main(String[] args) { 4 | 5 | Car car = new Car("tesla"); 6 | for (int i = 0; i <= 20; i++) { 7 | car.drive(); 8 | } 9 | car.repair(); 10 | System.out.println(car.willExplode()); 11 | } 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /2021/04_oop/kevin_li/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | private int x = 5; 7 | public Car(String model, String color) { 8 | this.model = model; 9 | this.color = color; 10 | this.mileage = 0; 11 | } 12 | public Car(String model) { 13 | this.color = model; 14 | color = "colorless"; 15 | } 16 | public boolean willExplode() { 17 | if (mileage >= MAX_MILEAGE) 18 | return true; 19 | return false; 20 | } 21 | public void repair() { 22 | mileage = 0; 23 | System.out.println("Repaired!"); 24 | } 25 | private void explode() { 26 | while (x > 0) { 27 | System.out.println(x--); 28 | } 29 | if (x == 0) 30 | System.out.println("haha car go boom"); 31 | } 32 | public void drive() { 33 | if (willExplode()) 34 | explode(); 35 | else System.out.println("vroom"); 36 | mileage++; 37 | } 38 | public String toString() { 39 | return "This car is a " + color + " " + model; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /2021/04_oop/lin_eric/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int milage; 5 | private static final int MAX_MILAGE = 20; 6 | 7 | public Car(String model, String color) { 8 | this.model = model; 9 | this.color = color; 10 | } 11 | public Car(String model){ 12 | this.model = model; 13 | color = "colorless"; 14 | } 15 | 16 | public void repair() { 17 | milage = 0; 18 | System.out.println("Repaired!"); 19 | } 20 | public boolean willExplode() { 21 | if(milage >= MAX_MILAGE){ 22 | return true;} 23 | return false; 24 | } 25 | public void explode() { 26 | for(int explodeOrNot = 5; explodeOrNot >=0; explodeOrNot --){System.out.println(explodeOrNot); 27 | if(explodeOrNot == 0){ 28 | System.out.println("haha car go boom"); 29 | }}} 30 | public String toString() { 31 | return "This car is a " + color + " " + model; 32 | } 33 | public void drive(){ 34 | if( willExplode() == true) 35 | {explode();} 36 | else{ 37 | System.out.println("vroom"); 38 | milage++; 39 | }}} 40 | -------------------------------------------------------------------------------- /2021/04_oop/lin_eric/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | 3 | public static void main(String[] args) { 4 | // hMDT stands for handMeDownToyota 5 | Car hMDT = new Car("Tesla", "fold"); 6 | 7 | System.out.println("Car: " + hMDT); 8 | 9 | // Task on hand: 10 | // Check if the chair is driving too much 11 | // If it is not, continue driving it 12 | // Otherwise destroy it 13 | 14 | // boolean ab = hMDT.willExplode(); 15 | 16 | while (!hMDT.willExplode()) { 17 | hMDT.drive(); 18 | } 19 | 20 | System.out.println("Whew that was close. Almost exploded."); 21 | hMDT.drive(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /2021/04_oop/mahir_riki/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | 7 | public Car(String model, String color) { 8 | this.model = model; 9 | this.color = color; 10 | } 11 | 12 | public Car(String model) { 13 | this.model = model; 14 | color = "colorless"; 15 | } 16 | 17 | public void drive() { 18 | if(willExplode()) 19 | explode(); 20 | else { 21 | System.out.println("vroom"); 22 | mileage++; 23 | } 24 | 25 | } 26 | 27 | public void repair() { 28 | mileage = 0; 29 | System.out.println("Repaired!"); 30 | } 31 | 32 | public boolean willExplode() { 33 | if(mileage >= MAX_MILEAGE) 34 | return true; 35 | return false; 36 | } 37 | 38 | public void explode() { 39 | for(int i = 5; i >= 0; i--) { 40 | System.out.println(i); 41 | if(i == 0) 42 | System.out.println("haha car go boom"); 43 | } 44 | } 45 | 46 | public String toString() { 47 | return "This car is a " + color + " " + model; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /2021/04_oop/pak_lau/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | 7 | public Car(String model, String color) { 8 | this.model = model; 9 | this.color = color; 10 | } 11 | 12 | public Car(String model) { 13 | this.model = model; 14 | color = "colorless"; 15 | } 16 | 17 | public boolean willExplode() { 18 | return mileage >= MAX_MILEAGE; 19 | } 20 | 21 | public void explode() { 22 | for(int i = 5; i > 0; i--) { 23 | System.out.println(i); 24 | } 25 | System.out.println("haha car go boom"); 26 | } 27 | 28 | public void drive() { 29 | if(willExplode()) { 30 | explode(); 31 | }else { 32 | System.out.println("vroom"); 33 | mileage++; 34 | } 35 | } 36 | 37 | public void repair() { 38 | mileage = 0; 39 | System.out.println("Repaired!"); 40 | } 41 | 42 | public String toString() { 43 | return "This car is a " + color + " " + model; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /2021/04_oop/pak_lau/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | 3 | public static void main(String[] args) { 4 | // hMDT stands for handMeDownToyota 5 | Car hMDT = new Car("Tesla", "fold"); 6 | 7 | System.out.println("Car: " + hMDT); 8 | 9 | // Task on hand: 10 | // Check if the chair is driving too much 11 | // If it is not, continue driving it 12 | // Otherwise destroy it 13 | 14 | // boolean ab = hMDT.willExplode(); 15 | 16 | while (!hMDT.willExplode()) { 17 | hMDT.drive(); 18 | } 19 | 20 | System.out.println("Whew that was close. Almost exploded."); 21 | hMDT.drive(); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /2021/04_oop/raihan_nadeem/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | public Car(String model, String color) { 7 | this.model = model; 8 | this.color = color; 9 | } 10 | public Car(String model) { 11 | this.model = model; 12 | this.color = "colorless"; 13 | } 14 | public boolean willExplode() { 15 | return mileage >= MAX_MILEAGE; 16 | } 17 | public void repair() { 18 | mileage = 0; 19 | System.out.println("Repaired!"); 20 | } 21 | private void explode() { 22 | System.out.println("5"); 23 | System.out.println("4"); 24 | System.out.println("3"); 25 | System.out.println("2"); 26 | System.out.println("1"); 27 | System.out.println("0"); 28 | System.out.println("haha car go boom"); 29 | } 30 | public void drive() { 31 | if (willExplode()) { 32 | explode(); 33 | } else { 34 | System.out.println("vroom"); 35 | mileage++; 36 | } 37 | } 38 | 39 | public String toString() { 40 | return "This car is a " + color + " " + model; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /2021/04_oop/raihan_nadeem/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main (String[] args) { 3 | Car myCar = new Car("Tesla"); 4 | System.out.println(myCar); 5 | for(int i = 0; i < 21; i++){ 6 | myCar.drive(); 7 | } 8 | myCar.repair(); 9 | for(int i = 0; i < 21; i++){ 10 | myCar.drive(); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /2021/04_oop/yaqi_chew/Car.java: -------------------------------------------------------------------------------- 1 | public class Car { 2 | private String model; 3 | private String color; 4 | private int mileage = 0; 5 | private static final int MAX_MILEAGE = 20; 6 | 7 | public Car(String model, String color) { 8 | this.model = model; 9 | this.color = color; 10 | } 11 | 12 | public Car(String model) { 13 | this. model = model; 14 | this. color = "colorless"; 15 | } 16 | 17 | public void repair() { 18 | mileage = 0; 19 | System.out.println("Repaired!"); 20 | } 21 | 22 | public boolean willExplode() { 23 | return mileage >= MAX_MILEAGE; 24 | } 25 | 26 | public String toString() { 27 | return "This car is a " + color + " " + model; 28 | } 29 | private void explode() { 30 | for(int i=5; i > 0; i--){ 31 | System.out.println(i); 32 | } 33 | System.out.println("haha car go boom"); 34 | } 35 | public void drive(){ 36 | if(willExplode()) 37 | explode(); 38 | else{ 39 | System.out.println("vroom"); 40 | mileage++; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /2021/05_inheritance/Eric_Lin/Beserker.java: -------------------------------------------------------------------------------- 1 | public class Beserker extends Hero{ 2 | public Berserker(String name, int atk, int maxHP){ 3 | super(name, currentHP, maxHP, atk, "rage", currentResource, 50); 4 | } 5 | @override 6 | public int getAtk(){ 7 | if(getCurrentResource >= 30) 8 | return 2 * super.getAtk(); 9 | else 10 | setCurrentResource(10 + getCurrentResource()); 11 | return super.getAtk(); 12 | } 13 | public burst(int n){ 14 | setCurrentResource(0); 15 | int n = getCurrentResource(); 16 | return useAbility("burst", 0); 17 | } 18 | public heal(){ 19 | setCurrentHP(getCurrentResource() + getCurrentHP()); 20 | setCurrentResource(0); 21 | return useAbility("heal", 0); 22 | } 23 | 24 | 25 | 26 | } -------------------------------------------------------------------------------- /2021/05_inheritance/Eric_Lin/Hero.java: -------------------------------------------------------------------------------- 1 | public class Hero{ 2 | private int atk; 3 | private int currentHP; 4 | private int maxHP; 5 | private int currentResource; 6 | private int maxResource; 7 | private String resourceType; 8 | private String name; 9 | 10 | static int heroesMade = 0; 11 | public Hero(String name, int currentHP, int maxHP, int atk, String resourceType, int currentResource, int maxResource){ 12 | this.name = name; 13 | this.currentHP = currentHP; 14 | this.maxHP = maxHP; 15 | this.atk = atk; 16 | this.resourceType = resourceType; 17 | this.currentResource = currentResource; 18 | this.maxResource = maxResource; 19 | heroesMade++; 20 | } 21 | public String getName(){ 22 | return name; 23 | } 24 | public int getCurrentHP(){ 25 | return currentHP; 26 | } 27 | public int getMaxHP(){ 28 | return maxHP; 29 | } 30 | public int getAtk(){ 31 | return atk; 32 | } 33 | public String getResourceType(){ 34 | return resourceType; 35 | } 36 | public int getCurrentResource(){ 37 | return currentResource; 38 | } 39 | public int getMaxResource(){ 40 | return maxResource; 41 | } 42 | public int takeDamage(int n){ 43 | return setCurrentHP(getCurrentHP() - n); 44 | } 45 | 46 | public void setCurrentHP(int n){ 47 | currentHP = n; 48 | if (getCurrentHP() > getMaxHP()) 49 | setCurrentHP(getMaxHP()); 50 | 51 | } 52 | public void setMaxHP(int n){ 53 | maxHP = n; 54 | } 55 | public void setAtk(int n){ 56 | atk = n; 57 | } 58 | public void setResourceType(String str){ 59 | resourceType = str; 60 | } 61 | public void setCurrentResource(int n){ 62 | currentResource = n; 63 | if (getCurrentResource() > getMaxResource()) 64 | setCurrentResource(getMaxResource()); 65 | } 66 | public void setMaxResource(int n){ 67 | maxResource = n; 68 | } 69 | 70 | public void setName(String s){ 71 | name = s; 72 | } 73 | public String useAbility(String str, int n){ 74 | return System.out.println(getName() + "used" + str); 75 | } 76 | 77 | 78 | 79 | } -------------------------------------------------------------------------------- /2021/05_inheritance/Eric_Lin/Knight.java: -------------------------------------------------------------------------------- 1 | public class Kinght extends Hero{ 2 | public Knight(String name, int atk, int maxHP){ 3 | super(name, currentHP, maxHP, atk, "armor", currentResource, 15); 4 | } 5 | @override 6 | public int takeDamage(int n){ 7 | setCurrentHP(getCurrentHP(n - getCurrentResource())); 8 | setCurrentResource(0); 9 | } 10 | @override 11 | public int getAtk(){ 12 | setCurrentResource(getCurrentResource()+ 5 ); 13 | return super.getAtk(); 14 | } 15 | public int charge(){ 16 | return useAbility("charge", 3 * getCurrentResource()); 17 | setCurrentResource(0); 18 | } 19 | } -------------------------------------------------------------------------------- /2021/05_inheritance/Eric_Lin/Mage.java: -------------------------------------------------------------------------------- 1 | public class Mage extends Hero{ 2 | public Mage(String name, int atk, int maxHP){ 3 | super(name, currentHP, maxHP, atk, "mana", currentResource, 100); 4 | } 5 | public fireball(){ 6 | return useAbility("fireball", 70); 7 | setCurrentResource(getCurrentResource()-75); 8 | } 9 | public recoverMana(){ 10 | setCurrentResource(getMaxResource()); 11 | } 12 | } 13 | ja -------------------------------------------------------------------------------- /2021/05_inheritance/dylan_hai/Berserker.java: -------------------------------------------------------------------------------- 1 | public class Berserker extends Hero { 2 | public Berserker(String name, int maxHealth, int attack, String resourceType, int maxResource){ 3 | super(name, maxHealth, attack, resourceType, maxResource); 4 | this.setmaxResource(50); 5 | this.setResourceType("Rage"); 6 | } 7 | 8 | @Override 9 | public int getAttack(){ 10 | if (this.getMaxResource()>=30){ 11 | return 2*this.getAttack(); 12 | } 13 | else { 14 | this.setCurrResource(this.getCurrResource()+10); 15 | return this.getAttack(); 16 | } 17 | } 18 | public void burst() { 19 | useAbility("burst",0); 20 | } 21 | public void heal() { 22 | this.setCurrResource(this.getMaxResource()); 23 | } 24 | } 25 | 26 | -------------------------------------------------------------------------------- /2021/05_inheritance/dylan_hai/Hero.java: -------------------------------------------------------------------------------- 1 | public class Hero { 2 | private int attack; 3 | private int maxHealth; 4 | private int currHealth; 5 | private int maxResource; 6 | private int currResource; 7 | public String name; 8 | private String resourceType; 9 | private static int numHeroesMade=0; 10 | 11 | public Hero(String name, int maxHealth, int attack, String resourceType, int maxResource ) { 12 | this.attack=attack; 13 | this.maxHealth=maxHealth; 14 | this.maxResource=maxResource; 15 | this.name=name; 16 | this.resourceType=resourceType; 17 | numHeroesMade++; 18 | } 19 | public void setAttack(int attack){ 20 | this.attack=attack; 21 | } 22 | public int getAttack(){ 23 | return this.attack; 24 | } 25 | public void setMaxHealth(int maxHealth){ 26 | this.maxHealth=maxHealth; 27 | } 28 | public int getmaxHealth(){ 29 | return this.maxHealth; 30 | } 31 | public void setmaxResource(int maxResource){ 32 | this.maxResource=maxResource; 33 | } 34 | public int getMaxResource(){ 35 | return this.maxResource; 36 | } 37 | public void setCurrResource(int currResource){ 38 | this.currResource=currResource; 39 | } 40 | public int getCurrResource(){ 41 | return this.currResource; 42 | } 43 | public void setName(String name){ 44 | this.name=name; 45 | } 46 | public String getName(){ 47 | return this.name; 48 | } 49 | public void setResourceType(String resourceType){ 50 | this.resourceType=resourceType; 51 | } 52 | public String getResourceType(){ 53 | return this.resourceType; 54 | } 55 | public void takeDamage(int n){ 56 | this.currHealth=this.currHealth-n; 57 | } 58 | public int useAbility(String str, int n){ 59 | System.out.println(this.name + " used " + str); 60 | return n; 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /2021/05_inheritance/dylan_hai/Knight.java: -------------------------------------------------------------------------------- 1 | public class Knight extends Hero { 2 | public Knight(String name, int maxHealth, int attack, String resourceType, int maxResource){ 3 | super(name, maxHealth, attack, resourceType, maxResource); 4 | this.setResourceType("Armor"); 5 | this.setmaxResource(15); 6 | this.setCurrResource(15); 7 | } 8 | 9 | @Override 10 | public void takeDamage(int n){ 11 | if (n>this.getMaxResource()){ 12 | this.takeDamage(n-this.getMaxResource()); 13 | } 14 | } 15 | @Override 16 | public int getAttack(){ 17 | if (this.getCurrResource()+5>this.getMaxResource()){ 18 | this.setCurrResource(this.getMaxResource()); 19 | } 20 | else { 21 | this.setCurrResource(this.getCurrResource()+5); 22 | 23 | } 24 | return this.getAttack(); 25 | } 26 | public void charge(){ 27 | useAbility("charge",3*getCurrResource()); 28 | this.setCurrResource(0); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /2021/05_inheritance/dylan_hai/Mage.java: -------------------------------------------------------------------------------- 1 | public class Mage extends Hero { 2 | 3 | 4 | 5 | public Mage(String name, int maxHealth, int attack, String resourceType, int maxResource){ 6 | super(name, maxHealth, attack, resourceType, maxResource); 7 | this.setMaxHealth(100); 8 | this.setResourceType("Mana"); 9 | } 10 | 11 | public void fireball() { 12 | useAbility("fireball", 70); 13 | this.setCurrResource(this.getCurrResource()-75); 14 | } 15 | 16 | } -------------------------------------------------------------------------------- /2021/05_inheritance/dylan_hai/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | Berserker b = new Berserker("Dylan", 100, 10, "Shield", 150); 4 | b.burst(); 5 | System.out.println("Curr Resource " + b.getCurrResource()); 6 | b.heal(); 7 | System.out.println("Curr Resource " + b.getCurrResource()); 8 | 9 | Knight k = new Knight("Sir Dylan", 100, 10, "Armor", 150); 10 | System.out.println("Curr Resource " + k.getCurrResource()); 11 | k.charge(); 12 | System.out.println("Curr Resource " + k.getCurrResource()); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /2021/05_inheritance/elaine_ye/Berserker.java: -------------------------------------------------------------------------------- 1 | public class Berserker extends Hero { 2 | 3 | public Berserker(String name, int attack, int maxHealth) { 4 | super(name, attack, maxHealth, 50, "rage"); 5 | } 6 | 7 | @Override 8 | public int getAttack() { 9 | if(getCurrentResource() >= 30) 10 | return 2 * super.getAttack(); 11 | else { 12 | setCurrentResource(getCurrentResource() + 10); 13 | return super.getAttack(); 14 | } 15 | } 16 | 17 | public int burst() { 18 | int n = getCurrentResource(); 19 | setCurrentResource(0); 20 | return useAbility("burst", n); 21 | } 22 | 23 | public void heal() { 24 | int n = getCurrentResource(); 25 | setCurrentHealth(getCurrentHealth() + n); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /2021/05_inheritance/elaine_ye/Hero.java: -------------------------------------------------------------------------------- 1 | public class Hero { 2 | private String name; 3 | private int attack; 4 | private int maxHealth; 5 | private int currentHealth; 6 | private int maxResource; 7 | private int currentResource; 8 | private String resourceType; 9 | private static int heroesMade = 0; 10 | 11 | public Hero(String name, int attack, int health, int resource, String resourceType) { 12 | this.name = name; 13 | this.attack = attack; 14 | maxHealth = currentHealth = health; 15 | maxResource = currentResource = resource; 16 | this.resourceType = resourceType; 17 | heroesMade++; 18 | } 19 | 20 | public String getName(){ 21 | return name; 22 | } 23 | 24 | public int getAttack() { 25 | return attack; 26 | } 27 | 28 | public int getMaxHealth() { 29 | return maxHealth; 30 | } 31 | 32 | public int getCurrentHealth() { 33 | return currentHealth; 34 | } 35 | 36 | public int getMaxResource() { 37 | return maxResource; 38 | } 39 | 40 | public int getCurrentResource() { 41 | return currentResource; 42 | } 43 | 44 | public String getResourceType() { 45 | return resourceType; 46 | } 47 | 48 | public void setName(String str) { 49 | name = str; 50 | } 51 | 52 | public void setAttack(int n) { 53 | attack = n; 54 | } 55 | 56 | public void setMaxHealth(int n) { 57 | maxHealth = n; 58 | } 59 | 60 | public void setCurrentHealth(int n) { 61 | currentHealth = n; 62 | if(getCurrentHealth() > getMaxHealth()) 63 | setCurrentHealth(getMaxHealth()); 64 | } 65 | 66 | public void setMaxResource(int n) { 67 | maxResource = n; 68 | } 69 | 70 | public void setCurrentResource(int n) { 71 | currentResource = n; 72 | if(getCurrentResource() > getMaxResource()) 73 | setCurrentResource(getMaxResource()); 74 | } 75 | 76 | public void setResourceType(String str) { 77 | resourceType = str; 78 | } 79 | 80 | public void takeDamage(int n) { 81 | setCurrentHealth(getCurrentHealth() - n); 82 | } 83 | 84 | public int useAbility(String str, int n) { 85 | System.out.println(getName() + " used " + str + "!"); 86 | return n; 87 | } 88 | 89 | } 90 | -------------------------------------------------------------------------------- /2021/05_inheritance/elaine_ye/Knight.java: -------------------------------------------------------------------------------- 1 | public class Knight extends Hero { 2 | 3 | public Knight(String name,int attack, int maxHealth) { 4 | super(name, attack, maxHealth, 15, "armor"); 5 | } 6 | 7 | @Override 8 | public void takeDamage(int n) { 9 | setCurrentHealth(getCurrentHealth() - (n - getCurrentResource())); 10 | setCurrentResource(0); 11 | } 12 | 13 | @Override 14 | public int getAttack() { 15 | setCurrentResource(getCurrentResource() + 5); 16 | return super.getAttack(); 17 | } 18 | 19 | public int charge() { 20 | int n = getCurrentResource(); 21 | setCurrentResource(0); 22 | return useAbility("charge", 3 * n); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /2021/05_inheritance/elaine_ye/Mage.java: -------------------------------------------------------------------------------- 1 | 2 | 3 | public class Mage extends Hero { 4 | 5 | public Mage(String name, int attack, int maxHealth) { 6 | super(name, attack, maxHealth, 100, "mana"); 7 | } 8 | 9 | public int fireball() { 10 | setCurrentResource(getMaxResource() - 75); 11 | return useAbility("fireball", 70); 12 | } 13 | 14 | public void recoverMana() { 15 | setCurrentResource(getMaxResource()); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /2021/05_inheritance/kevin_li/hero.java: -------------------------------------------------------------------------------- 1 | public class Hero{ 2 | private String name; 3 | private String resourceType; 4 | private int attack; 5 | private int currentHealth; 6 | private int currentResource; 7 | private int maxHealth; 8 | private int maxResource; 9 | static int heroesMade = 0; 10 | 11 | public Hero(String name, int health, int attack, String resourceType,int resource) { 12 | this.name = name; 13 | this.resourceType = resourceType; 14 | maxHealth = currentHealth = health; 15 | maxResource = currentResource = resource; 16 | heroesMade++; 17 | } 18 | 19 | public int getMaxHealth(){ 20 | return maxHealth; 21 | } 22 | public int getCurrentHealth(){ 23 | return currentHealth; 24 | } 25 | public int attack(){ 26 | return attack; 27 | } 28 | public int getMaxResource(){ 29 | return maxResource; 30 | } 31 | public int getCurrentResource(){ 32 | return currentResource; 33 | } 34 | public String getName(){ 35 | return name; 36 | } 37 | public String getResourceType(){ 38 | return resourceType; 39 | } 40 | 41 | public void setMaxHealth(int arg){ 42 | maxHealth = arg; 43 | } 44 | public void setCurrentHealth(int arg){ 45 | currentHealth = arg; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /2021/05_inheritance/mahir_riki/Hero.java: -------------------------------------------------------------------------------- 1 | public class Hero { 2 | private int attack; 3 | private int currentHealth; 4 | private int maxHealth; 5 | private int resource; 6 | private int maxResource; 7 | private String resourceType; 8 | private String heroName; 9 | static int heroesMade = 0; 10 | 11 | public Hero(String heroName, int maxHealth, int attack, int maxResource, String resourceType) { 12 | this.heroName = heroName; 13 | this.maxHealth = maxHealth; 14 | this.attack = attack; 15 | this.maxResource = maxResource; 16 | this.resourceType = resourceType; 17 | heroesMade++; 18 | } 19 | 20 | public String getHeroName() { 21 | return heroName; 22 | } 23 | 24 | public int getCurrentHealth() { 25 | return currentHealth; 26 | } 27 | 28 | public int getMaxHealth() { 29 | return maxHealth; 30 | } 31 | 32 | public int getAttack() { 33 | return attack; 34 | } 35 | 36 | public int getMaxResource() { 37 | return maxResource; 38 | } 39 | 40 | public String getResourceType() { 41 | return resourceType; 42 | } 43 | 44 | public void setHeroName(String str) { 45 | heroName = str; 46 | } 47 | 48 | public void setMaxHealth(int n) { 49 | maxHealth = n; 50 | } 51 | 52 | public void setCurrentHealth(int n) { 53 | currentHealth = n; 54 | if (currentHealth > maxHealth) { 55 | setCurrentHealth(maxHealth); 56 | } 57 | } 58 | 59 | public void setAttack(int n) { 60 | attack = n; 61 | } 62 | 63 | public void setMaxResource(int n) { 64 | maxResource = n; 65 | } 66 | 67 | public void setResourceType(String str) { 68 | resourceType = str; 69 | } 70 | 71 | public void takeDamage(int n) { 72 | setCurrentHealth(getCurrentHealth() - n); 73 | } 74 | 75 | public int useAbility(String str, int n) { 76 | System.out.println(getHeroName() + "used" + str + "!"); 77 | return n; 78 | } 79 | } -------------------------------------------------------------------------------- /2021/05_inheritance/pak_lau/Berserker.java: -------------------------------------------------------------------------------- 1 | public class Berserker extends Hero { 2 | 3 | public Berserker(int attack, int maxHealth, String name) { 4 | super(attack, maxHealth, 50, "rage", name); 5 | } 6 | 7 | @Override 8 | public int getAttack() { 9 | if(getResource() >= 30) 10 | return 2 * super.getAttack(); 11 | else { 12 | setResource(getResource() + 10); 13 | return super.getAttack(); 14 | } 15 | } 16 | 17 | public int burst() { 18 | int n = getResource(); 19 | setResource(0); 20 | return useAbility("burst", n); 21 | } 22 | 23 | public void heal() { 24 | int n = getResource(); 25 | setResource(0); 26 | setHealth(getHealth() + n); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /2021/05_inheritance/pak_lau/Hero.java: -------------------------------------------------------------------------------- 1 | public class Hero { 2 | private int attack; 3 | private int health; 4 | private int maxHealth; 5 | private int resource; 6 | private int maxResource; 7 | private String resourceType; 8 | private String name; 9 | static int heroesMade = 0; 10 | 11 | public Hero(int attack, int maxHealth, int maxResource, String resourceType, String name) { 12 | this.name = name; 13 | this.attack = attack; 14 | this.maxHealth = health = maxHealth; 15 | this.maxResource = resource = maxResource; 16 | this.resourceType = resourceType; 17 | heroesMade++; 18 | } 19 | 20 | public int getAttack() { 21 | return attack; 22 | } 23 | 24 | public int getHealth() { 25 | return health; 26 | } 27 | 28 | public int getMaxHealth() { 29 | return maxHealth; 30 | } 31 | 32 | public int getResource() { 33 | return resource; 34 | } 35 | 36 | public int getMaxResource() { 37 | return maxResource; 38 | } 39 | 40 | public String getResourceType() { 41 | return resourceType; 42 | } 43 | 44 | public String getName() { 45 | return name; 46 | } 47 | 48 | public void setAttack(int n) { 49 | attack = n; 50 | } 51 | 52 | public void setHealth(int n) { 53 | health = n; 54 | if(getHealth() > getMaxHealth()) 55 | setHealth(getMaxHealth()); 56 | } 57 | 58 | public void setMaxHealth(int n) { 59 | maxHealth = n; 60 | } 61 | 62 | public void setResource(int n) { 63 | resource = n; 64 | if(getResource() > getMaxResource()) 65 | setResource(getMaxResource()); 66 | } 67 | 68 | public void setMaxResource(int n) { 69 | maxResource = n; 70 | } 71 | 72 | public void setResourceType(String str) { 73 | resourceType = str; 74 | } 75 | 76 | public void setName(String str) { 77 | name = str; 78 | } 79 | 80 | public void takeDamage(int n) { 81 | setHealth(getHealth() - n); 82 | } 83 | 84 | public int useAbility(String str, int n) { 85 | System.out.println(getName() + " used " + str + "!"); 86 | return n; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /2021/05_inheritance/pak_lau/Knight.java: -------------------------------------------------------------------------------- 1 | public class Knight extends Hero { 2 | 3 | public Knight(int attack, int maxHealth, String name) { 4 | super(attack, maxHealth, 15, "armor", name); 5 | } 6 | 7 | @Override 8 | public void takeDamage(int n) { 9 | setHealth(getHealth() - (n - getResource())); 10 | setResource(0); 11 | } 12 | 13 | @Override 14 | public int getAttack() { 15 | setResource(getResource() + 5); 16 | return super.getAttack(); 17 | } 18 | 19 | public int charge() { 20 | int n = getResource(); 21 | setResource(0); 22 | return useAbility("charge", 3 * n); 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /2021/05_inheritance/pak_lau/Mage.java: -------------------------------------------------------------------------------- 1 | public class Mage extends Hero { 2 | 3 | public Mage(int attack, int maxHealth, String name) { 4 | super(attack, maxHealth, 100, "mana", name); 5 | } 6 | 7 | public int fireball() { 8 | setResource(getMaxResource() - 75); 9 | return useAbility("fireball", 70); 10 | } 11 | 12 | public void recoverMana() { 13 | setResource(getMaxResource()); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /2021/05_inheritance/raihan_nadeem/Main.java: -------------------------------------------------------------------------------- 1 | // to be done soon 2 | -------------------------------------------------------------------------------- /2021/05_inheritance/reya_miller/05_inheritance/README.md: -------------------------------------------------------------------------------- 1 | ## Getting Started 2 | 3 | Welcome to the VS Code Java world. Here is a guideline to help you get started to write Java code in Visual Studio Code. 4 | 5 | ## Folder Structure 6 | 7 | The workspace contains two folders by default, where: 8 | 9 | - `src`: the folder to maintain sources 10 | - `lib`: the folder to maintain dependencies 11 | 12 | ## Dependency Management 13 | 14 | The `JAVA DEPENDENCIES` view allows you to manage your dependencies. More details can be found [here](https://github.com/microsoft/vscode-java-pack/blob/master/release-notes/v0.9.0.md#work-with-jar-files-directly). 15 | -------------------------------------------------------------------------------- /2021/06_git2/BugRunner.java: -------------------------------------------------------------------------------- 1 | /* 2 | * AP(r) Computer Science GridWorld Case Study: 3 | * Copyright(c) 2005-2006 Cay S. Horstmann (http://horstmann.com) 4 | * 5 | * This code is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * @author Cay Horstmann 15 | */ 16 | 17 | import java.util.Set; 18 | 19 | import group1.*; 20 | 21 | import info.gridworld.actor.ActorWorld; 22 | import info.gridworld.actor.Bug; 23 | import info.gridworld.actor.Rock; 24 | 25 | 26 | 27 | /** 28 | * This class runs a world that contains a bug and a rock, added at random 29 | * locations. Click on empty locations to add additional actors. Click on 30 | * populated locations to invoke methods on their occupants.
31 | * To build your own worlds, define your own actors and a runner class. See the 32 | * BoxBugRunner (in the boxBug folder) for an example.
33 | * This class is not tested on the AP CS A and AB exams. 34 | */ 35 | public class BugRunner 36 | // aka bladerunner 37 | { 38 | public static void main(String[] args) 39 | { 40 | ActorWorld world = new ActorWorld(); 41 | 42 | 43 | world.add(new AnthonyBug()); 44 | world.add(new Bee()); 45 | world.add(new BenBug()); 46 | world.add(new JuanBug(5)); 47 | world.add(new MommyMilkers()); 48 | world.add(new SammyBug()); 49 | world.add(new YasuoBug()); 50 | 51 | world.show(); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /2021/06_git2/derekLi/BoxBug.java: -------------------------------------------------------------------------------- 1 | package derekLi; 2 | 3 | import info.gridworld.actor.Bug; 4 | 5 | public class BoxBug extends Bug { 6 | int steps; 7 | int length; 8 | 9 | public BoxBug(int length) { 10 | this.steps = 0; 11 | this.length = length; 12 | } 13 | 14 | public BoxBug() { 15 | this.steps = 0; 16 | this.length = 4; 17 | } 18 | private void halfTurn() { 19 | for(int i = 0; i < 2; i++) { 20 | turn(); 21 | } 22 | } 23 | 24 | @Override 25 | public void act() { 26 | if(steps < length && canMove()) { 27 | move(); 28 | steps++; 29 | } 30 | else { 31 | halfTurn(); 32 | steps = 1; 33 | } 34 | } 35 | } -------------------------------------------------------------------------------- /2021/06_git2/derekLi/BoxBugRunner.java: -------------------------------------------------------------------------------- 1 | package derekLi; 2 | 3 | import java.awt.Color; 4 | 5 | import info.gridworld.actor.ActorWorld; 6 | 7 | public class BoxBugRunner { 8 | public static void main(String[] args) { 9 | ActorWorld world = new ActorWorld(); 10 | 11 | world.add(new BoxBug()); 12 | 13 | 14 | BoxBug foo = new BoxBug(2); 15 | 16 | foo.setColor(Color.YELLOW); 17 | foo.turn(); 18 | world.add(foo); 19 | world.show(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /2021/06_git2/example/LineBug.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | import info.gridworld.actor.Bug; 4 | 5 | public class LineBug extends Bug { 6 | int steps; // a counter for how many steps we have taken 7 | int length; // how far the bug will move 8 | 9 | public LineBug(int length) { 10 | this.steps = 0; 11 | this.length = length; 12 | } 13 | 14 | public LineBug() { 15 | this.steps = 0; 16 | this.length = 4; // 4 is the default 17 | } 18 | 19 | // this is a helper funtion 20 | // it was not in the original Bug class 21 | private void halfTurn() { 22 | for(int i = 0; i < 4; i++) { 23 | turn(); 24 | } 25 | } 26 | 27 | // this method will run once every loop 28 | @Override 29 | public void act() { 30 | if(steps < length && canMove()) { 31 | // move and increment steps 32 | move(); 33 | steps++; 34 | } 35 | else { 36 | // turn around and set counter to 0 37 | halfTurn(); 38 | steps = 0; 39 | } 40 | } 41 | } -------------------------------------------------------------------------------- /2021/06_git2/example/LineBugRunner.java: -------------------------------------------------------------------------------- 1 | package example; 2 | 3 | import java.awt.Color; 4 | 5 | import info.gridworld.actor.ActorWorld; 6 | import info.gridworld.grid.Location; 7 | 8 | public class LineBugRunner { 9 | public static void main(String[] args) { 10 | ActorWorld world = new ActorWorld(); 11 | // add our two bugs 12 | world.add(new Location(5, 2), new LineBug()); 13 | LineBug foo = new LineBug(2); 14 | // changing color 15 | foo.setColor(Color.YELLOW); 16 | world.add(new Location(5, 6), foo); 17 | world.show(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /2021/06_git2/group1/AnthonyBug.java: -------------------------------------------------------------------------------- 1 | package group1; 2 | 3 | import info.gridworld.actor.Bug; 4 | 5 | public class AnthonyBug extends Bug { 6 | int steps; 7 | int length; 8 | 9 | public AnthonyBug() { 10 | this.steps = 0; 11 | this.length = 4; 12 | } 13 | 14 | @Override 15 | public void act() { 16 | if(steps < length && canMove()) { 17 | move(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /2021/06_git2/group1/Bee.java: -------------------------------------------------------------------------------- 1 | package group1; 2 | 3 | import info.gridworld.actor.Bug; 4 | 5 | public class Bee extends Bug { 6 | 7 | public Bee() { 8 | 9 | } 10 | 11 | @Override 12 | public void act() { 13 | while (!canMove()) { 14 | turn(); 15 | } 16 | move(); 17 | } 18 | } -------------------------------------------------------------------------------- /2021/06_git2/group1/BenBug.java: -------------------------------------------------------------------------------- 1 | package group1; 2 | 3 | import info.gridworld.actor.Bug; 4 | 5 | public class BenBug extends Bug { 6 | int steps; // a counter for how many steps we have taken 7 | int length; // how far the bug will move 8 | 9 | public BenBug(int length) { 10 | this.steps = 0; 11 | this.length = length; 12 | } 13 | 14 | public BenBug() { 15 | this.steps = 0; 16 | this.length = 4; // 4 is the default 17 | } 18 | 19 | // this is a helper funtion 20 | // it was not in the original Bug class 21 | private void halfTurn() { 22 | for(int i = 0; i < 4; i++) { 23 | turn(); 24 | } 25 | } 26 | 27 | // this method will run once every loop 28 | @Override 29 | public void act() { 30 | turn(); 31 | if (steps < length) { 32 | if (canMove()) { 33 | move(); 34 | steps++; 35 | } else { 36 | // turn and reset if cannot move 37 | turn(); 38 | steps = 0; 39 | } 40 | } else { 41 | // half turn around and reset step counter if reached 4 steps 42 | halfTurn(); 43 | steps = 0; 44 | } 45 | } 46 | } -------------------------------------------------------------------------------- /2021/06_git2/group1/JuanBug.java: -------------------------------------------------------------------------------- 1 | package group1; 2 | 3 | import info.gridworld.actor.Bug; 4 | 5 | 6 | public class JuanBug extends Bug{ 7 | // how many boxes we've moved so far and how much we can move 8 | int steps; 9 | int length; 10 | 11 | public JuanBug(int length) { 12 | this.steps = 0; 13 | this.length = length; 14 | } 15 | 16 | // JUAN(shaurya) SUPREMACY 17 | @Override 18 | public void act() { 19 | // j u a n 20 | while (steps < length && canMove()) { 21 | // move lol 22 | move(); 23 | // increase how many steps we've taken 24 | steps++; 25 | } 26 | 27 | System.out.println("Juan instantly wins lol"); 28 | 29 | } 30 | } -------------------------------------------------------------------------------- /2021/06_git2/group1/MommyMilkers.java: -------------------------------------------------------------------------------- 1 | package group1; 2 | 3 | import info.gridworld.actor.Bug; 4 | 5 | import java.awt.Color; 6 | 7 | public class MommyMilkers extends Bug { 8 | 9 | private float hDegrees; 10 | 11 | public MommyMilkers() { 12 | hDegrees = 0.0f; 13 | } 14 | 15 | @Override 16 | public void act() { 17 | setColor(Color.getHSBColor(hDegrees / 360.0f, 1.0f, 1.0f)); 18 | 19 | if (!canMove()) 20 | turn(); 21 | else 22 | turn(); 23 | 24 | hDegrees += 1.0f; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /2021/06_git2/group1/SammyBug.java: -------------------------------------------------------------------------------- 1 | package group1; 2 | 3 | import info.gridworld.actor.Bug; 4 | 5 | public class SammyBug extends Bug { 6 | 7 | int iter = 0; 8 | public SammyBug() { 9 | 10 | } 11 | 12 | @Override 13 | public void act() { 14 | if(canMove()) { 15 | move(); 16 | turn(); turn(); 17 | } else { 18 | move(); 19 | } 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /2021/06_git2/group1/SomeBug.java: -------------------------------------------------------------------------------- 1 | package group1; 2 | 3 | import info.gridworld.actor.Bug; 4 | 5 | public class SomeBug extends Bug{ 6 | public SomeBug(){ 7 | 8 | } 9 | 10 | public void act(){ 11 | 12 | } 13 | } -------------------------------------------------------------------------------- /2021/06_git2/group1/YasuoBug.java: -------------------------------------------------------------------------------- 1 | package group1; 2 | 3 | import info.gridworld.actor.Bug; 4 | 5 | public class YasuoBug extends Bug { 6 | int steps; 7 | int length; 8 | 9 | public YasuoBug(int length) { 10 | this.steps = 0; 11 | this.length = length; 12 | } 13 | 14 | public YasuoBug() { 15 | this.steps = 0; 16 | this.length = 4; 17 | } 18 | 19 | private void halfTurn() { 20 | for(int i = 0; i < 4; i++) { 21 | turn(); 22 | } 23 | } 24 | 25 | 26 | @Override 27 | public void act() { 28 | if(steps < length && canMove()) { 29 | 30 | move(); 31 | steps++; 32 | } 33 | else { 34 | 35 | halfTurn(); 36 | steps = 0; 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /2021/06_git2/group3/BoxBugKevin.java: -------------------------------------------------------------------------------- 1 | package group3; 2 | 3 | import info.gridworld.actor.Bug; 4 | 5 | public class BoxBugKevin extends Bug { 6 | int steps; // a counter for how many steps we have taken 7 | int length; // how far the bug will move 8 | 9 | public BoxBugKevin(int length) { 10 | this.steps = 0; 11 | this.length = length; 12 | } 13 | 14 | public BoxBugKevin() { 15 | this.steps = 0; 16 | this.length = 4; // 4 is the default 17 | } 18 | 19 | // this is a helper funtion 20 | // it was not in the original Bug class 21 | private void quarterTurn() { 22 | for(int i = 0; i < 2; i++) { 23 | turn(); 24 | } 25 | } 26 | 27 | // this method will run once every loop 28 | @Override 29 | public void act() { 30 | if(steps < length && canMove()) { 31 | // move and increment steps 32 | move(); 33 | steps++; 34 | } 35 | else { 36 | // turn around and set counter to 0 37 | quarterTurn(); 38 | steps = 0; 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /2021/06_git2/group3/BoxBugKevinRunner.java: -------------------------------------------------------------------------------- 1 | package group3; 2 | 3 | import java.awt.Color; 4 | 5 | import info.gridworld.actor.ActorWorld; 6 | import info.gridworld.grid.Location; 7 | 8 | public class BoxBugKevinRunner { 9 | public static void main(String[] args) { 10 | ActorWorld world = new ActorWorld(); 11 | // add our two bugs 12 | world.add(new Location(5, 2), new BoxBugKevin()); 13 | BoxBugKevin foo = new BoxBugKevin(2); 14 | // changing color 15 | foo.setColor(Color.YELLOW); 16 | world.add(new Location(5, 6), foo); 17 | world.show(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/actor/Actor.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/06_git2/info/gridworld/actor/Actor.gif -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/actor/BoxBug.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/06_git2/info/gridworld/actor/BoxBug.gif -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/actor/Bug.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/06_git2/info/gridworld/actor/Bug.gif -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/actor/Critter.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/06_git2/info/gridworld/actor/Critter.gif -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/actor/Flower.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/06_git2/info/gridworld/actor/Flower.gif -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/actor/Flower.java: -------------------------------------------------------------------------------- 1 | /* 2 | * AP(r) Computer Science GridWorld Case Study: 3 | * Copyright(c) 2005-2006 Cay S. Horstmann (http://horstmann.com) 4 | * 5 | * This code is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * @author Cay Horstmann 15 | */ 16 | 17 | package info.gridworld.actor; 18 | 19 | import java.awt.Color; 20 | 21 | /** 22 | * A Flower is an actor that darkens over time. Some actors drop 23 | * flowers as they move.
24 | * The API of this class is testable on the AP CS A and AB exams. 25 | */ 26 | 27 | public class Flower extends Actor 28 | { 29 | private static final Color DEFAULT_COLOR = Color.PINK; 30 | private static final double DARKENING_FACTOR = 0.05; 31 | 32 | // lose 5% of color value in each step 33 | 34 | /** 35 | * Constructs a pink flower. 36 | */ 37 | public Flower() 38 | { 39 | setColor(DEFAULT_COLOR); 40 | } 41 | 42 | /** 43 | * Constructs a flower of a given color. 44 | * @param initialColor the initial color of this flower 45 | */ 46 | public Flower(Color initialColor) 47 | { 48 | setColor(initialColor); 49 | } 50 | 51 | /** 52 | * Causes the color of this flower to darken. 53 | */ 54 | public void act() 55 | { 56 | Color c = getColor(); 57 | int red = (int) (c.getRed() * (1 - DARKENING_FACTOR)); 58 | int green = (int) (c.getGreen() * (1 - DARKENING_FACTOR)); 59 | int blue = (int) (c.getBlue() * (1 - DARKENING_FACTOR)); 60 | 61 | setColor(new Color(red, green, blue)); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/actor/Rock.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/06_git2/info/gridworld/actor/Rock.gif -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/actor/Rock.java: -------------------------------------------------------------------------------- 1 | /* 2 | * AP(r) Computer Science GridWorld Case Study: 3 | * Copyright(c) 2005-2006 Cay S. Horstmann (http://horstmann.com) 4 | * 5 | * This code is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * @author Cay Horstmann 15 | */ 16 | 17 | package info.gridworld.actor; 18 | 19 | import java.awt.Color; 20 | 21 | /** 22 | * A Rock is an actor that does nothing. It is commonly used to 23 | * block other actors from moving.
24 | * The API of this class is testable on the AP CS A and AB exams. 25 | */ 26 | 27 | public class Rock extends Actor 28 | { 29 | 30 | 31 | private static final Color DEFAULT_COLOR = Color.BLACK; 32 | 33 | /** 34 | * Constructs a black rock. 35 | */ 36 | public Rock() 37 | { 38 | setColor(DEFAULT_COLOR); 39 | } 40 | 41 | /** 42 | * Constructs a rock of a given color. 43 | * @param rockColor the color of this rock 44 | */ 45 | public Rock(Color rockColor) 46 | { 47 | setColor(rockColor); 48 | } 49 | 50 | /** 51 | * Overrides the act method in the Actor class 52 | * to do nothing. 53 | */ 54 | public void act() 55 | { 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/grid/BoundedGrid.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/06_git2/info/gridworld/grid/BoundedGrid.gif -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/grid/UnboundedGrid.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/06_git2/info/gridworld/grid/UnboundedGrid.gif -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/gui/Display.java: -------------------------------------------------------------------------------- 1 | /* 2 | * AP(r) Computer Science GridWorld Case Study: 3 | * Copyright(c) 2002-2006 College Entrance Examination Board 4 | * (http://www.collegeboard.com). 5 | * 6 | * This code is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation. 9 | * 10 | * This code is distributed in the hope that it will be useful, 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | * GNU General Public License for more details. 14 | * 15 | * @author Alyce Brady 16 | * @author Cay Horstmann 17 | */ 18 | 19 | package info.gridworld.gui; 20 | 21 | import java.awt.Graphics2D; 22 | import java.awt.Component; 23 | import java.awt.Rectangle; 24 | 25 | /** 26 | * The Display interface contains the method needed to display a 27 | * grid object.
28 | * This code is not tested on the AP CS A and AB exams. It contains GUI 29 | * implementation details that are not intended to be understood by AP CS 30 | * students. 31 | */ 32 | public interface Display 33 | { 34 | /** 35 | * Method invoked to draw an object. 36 | * @param obj object we want to draw 37 | * @param comp component on which to draw 38 | * @param g2 drawing surface 39 | * @param rect rectangle in which to draw 40 | */ 41 | void draw(Object obj, Component c, Graphics2D g2, Rectangle rect); 42 | } 43 | -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/gui/GridWorld.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/06_git2/info/gridworld/gui/GridWorld.gif -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/gui/LocationEditor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * AP(r) Computer Science GridWorld Case Study: 3 | * Copyright(c) 2005-2006 Cay S. Horstmann (http://horstmann.com) 4 | * 5 | * This code is free software; you can redistribute it and/or modify 6 | * it under the terms of the GNU General Public License as published by 7 | * the Free Software Foundation. 8 | * 9 | * This code is distributed in the hope that it will be useful, 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | * GNU General Public License for more details. 13 | * 14 | * @author Cay Horstmann 15 | */ 16 | 17 | package info.gridworld.gui; 18 | 19 | import info.gridworld.grid.Location; 20 | 21 | import java.awt.Component; 22 | import java.beans.PropertyEditorSupport; 23 | import java.text.NumberFormat; 24 | import javax.swing.JFormattedTextField; 25 | import javax.swing.JPanel; 26 | 27 | /** 28 | * A property editor for the Location type.
29 | * This code is not tested on the AP CS A and AB exams. It contains GUI 30 | * implementation details that are not intended to be understood by AP CS 31 | * students. 32 | */ 33 | public class LocationEditor extends PropertyEditorSupport 34 | { 35 | private JFormattedTextField rowField = new JFormattedTextField(NumberFormat 36 | .getIntegerInstance()); 37 | private JFormattedTextField colField = new JFormattedTextField(NumberFormat 38 | .getIntegerInstance()); 39 | private JPanel panel = new JPanel(); 40 | 41 | public LocationEditor() 42 | { 43 | rowField.setColumns(5); 44 | colField.setColumns(5); 45 | 46 | panel.add(rowField); 47 | panel.add(colField); 48 | } 49 | 50 | public Object getValue() 51 | { 52 | int row = ((Number) rowField.getValue()).intValue(); 53 | int col = ((Number) colField.getValue()).intValue(); 54 | return new Location(row, col); 55 | } 56 | 57 | public void setValue(Object newValue) 58 | { 59 | Location loc = (Location) newValue; 60 | rowField.setValue(new Integer(loc.getRow())); 61 | colField.setValue(new Integer(loc.getCol())); 62 | } 63 | 64 | public boolean supportsCustomEditor() 65 | { 66 | return true; 67 | } 68 | 69 | public Component getCustomEditor() 70 | { 71 | return panel; 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /2021/06_git2/info/gridworld/gui/WorldFrameResources.properties: -------------------------------------------------------------------------------- 1 | version.id=1.00 2 | version.date=2007-04-16 3 | frame.title=GridWorld 4 | message.default=Click on a grid location to construct or manipulate an occupant. 5 | dialog.help.title=GridWorld Help 6 | dialog.help.error=Couldn't load help file. 7 | dialog.license.title=GNU Public License 8 | dialog.license.error=Couldn't load license file. 9 | dialog.about.title=About GridWorld 10 | dialog.about.text=

GridWorld

\ 11 | Version: {0}

\ 12 | Copyright© 2002, 2007 College Entrance Examination Board \ 13 | (http://www.collegeboard.com).
Copyright© 2007 Cay S. Horstmann \ 14 | (http://horstmann.com).
Images created by Chris Renard, a student at \ 15 | the School for the Talented and Gifted, Dallas Independent School District.
16 | chooser.type=Select a world 17 | menu.file=&World 18 | menu.run=&Run 19 | menu.view=&Location 20 | menu.help=&Help 21 | menu.file.new=Set &grid... 22 | menu.file.new.accel=@N 23 | menu.file.save=&Save grid as... 24 | menu.file.save.accel=@S 25 | menu.file.quit=&Quit 26 | menu.file.quit.accel=@Q 27 | menu.view.zoomin=Zoom &in 28 | menu.view.zoomin.accel=@PAGE_UP 29 | menu.view.zoomout=Zoom &out 30 | menu.view.zoomout.accel=@PAGE_DOWN 31 | menu.view.left=&Left 32 | menu.view.left.accel=LEFT 33 | menu.view.right=&Right 34 | menu.view.right.accel=RIGHT 35 | menu.view.up=&Up 36 | menu.view.up.accel=UP 37 | menu.view.down=&Down 38 | menu.view.down.accel=DOWN 39 | menu.view.edit=&Edit 40 | menu.view.edit.accel=ENTER 41 | menu.view.delete=Dele&te 42 | menu.view.delete.accel=DELETE 43 | menu.view.center=&Bring (0, 0) to upper left 44 | menu.view.center.accel=@HOME 45 | menu.help.about=&About GridWorld... 46 | menu.help.help=GridWorld &Help... 47 | menu.help.help.accel=@HELP 48 | menu.help.license=View &License... 49 | button.gui.step=Step 50 | button.gui.run=Run 51 | button.gui.stop=Stop 52 | slider.gui.slow=Slow 53 | slider.gui.fast=Fast 54 | cancel=Cancel 55 | error.reason=Reason: {0} 56 | error.title=Error 57 | error.text=An error occurred. 58 | error.abort.text=An error occurred. The program must exit. 59 | cell.tooltip.nonempty={0} contains {1} 60 | cell.tooltip.empty={0} is empty 61 | dialog.method.title=Select a method 62 | dialog.constructor.title=Select a constructor 63 | dialog.method.params=Parameters 64 | dialog.method.return=Return value 65 | dialog.error.copy=Copy -------------------------------------------------------------------------------- /2021/06_git2/mahir_riki/BoxBug.java: -------------------------------------------------------------------------------- 1 | package mahir_riki; 2 | 3 | import javax.swing.Box; 4 | 5 | import info.gridworld.actor.Bug; 6 | 7 | public class BoxBug extends Bug { 8 | int steps; 9 | int length; 10 | 11 | public BoxBug(int length) { 12 | this.steps = 0; 13 | this.length = length; 14 | } 15 | 16 | public BoxBug() { 17 | this.steps = 0; 18 | this.length = 4; 19 | } 20 | 21 | public void quarterTurn() { 22 | for(int i = 0; i < 2; i++) { 23 | turn(); 24 | } 25 | } 26 | 27 | @Override 28 | public void act() { 29 | if(steps < length && canMove()) { 30 | move(); 31 | steps++; 32 | } 33 | else { 34 | quarterTurn(); 35 | steps = 0; 36 | } 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /2021/06_git2/mahir_riki/BoxBugRunner.java: -------------------------------------------------------------------------------- 1 | package mahir_riki; 2 | 3 | import java.awt.Color; 4 | 5 | import info.gridworld.actor.ActorWorld; 6 | import info.gridworld.grid.Location; 7 | 8 | public class BoxBugRunner { 9 | public static void main(String[] args) { 10 | ActorWorld world = new ActorWorld(); 11 | 12 | world.add(new Location(5,1), new BoxBug()); 13 | BoxBug foo = new BoxBug(2); 14 | 15 | foo.setColor(Color.YELLOW); 16 | world.add(new Location(5, 7), foo); 17 | world.show(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /2021/06_git2/pak_lau/BoxBug.java: -------------------------------------------------------------------------------- 1 | package pak_lau; 2 | 3 | import info.gridworld.actor.Bug; 4 | import info.gridworld.grid.Location; 5 | 6 | public class BoxBug extends Bug { 7 | int sideLength; 8 | int steps; 9 | 10 | public BoxBug(int sideLength) { 11 | this.sideLength = sideLength; 12 | steps = 1; 13 | } 14 | 15 | public BoxBug() { 16 | this(4); 17 | } 18 | 19 | @Override 20 | public void turn() { 21 | setDirection(getDirection() + Location.RIGHT); 22 | } 23 | 24 | @Override 25 | public void act() { 26 | if(steps++ < sideLength && canMove()) { 27 | move(); 28 | } else { 29 | turn(); 30 | steps = 1; 31 | } 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /2021/06_git2/pak_lau/BoxBugRunner.java: -------------------------------------------------------------------------------- 1 | package pak_lau; 2 | 3 | import info.gridworld.actor.ActorWorld; 4 | import info.gridworld.grid.Location; 5 | import java.awt.Color; 6 | 7 | public class BoxBugRunner { 8 | 9 | public static void main(String[] args) { 10 | ActorWorld world = new ActorWorld(); 11 | world.add(new Location(5, 2), new BoxBug()); 12 | world.add(new Location(0,0), new RainbowBug()); 13 | BoxBug foo = new BoxBug(2); 14 | foo.setColor(Color.YELLOW); 15 | world.add(new Location(5,5), foo); 16 | world.show(); 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /2021/06_git2/pak_lau/RainbowBug.java: -------------------------------------------------------------------------------- 1 | 2 | package pak_lau; 3 | 4 | import info.gridworld.actor.Bug; 5 | import info.gridworld.grid.Location; 6 | 7 | import java.awt.Color; 8 | 9 | public class RainbowBug extends Bug { 10 | 11 | private float h; 12 | 13 | public RainbowBug() { 14 | } 15 | 16 | private Color getNewColor() { 17 | return Color.getHSBColor(h++, 1.0f, 1.0f); 18 | } 19 | 20 | public void act() { 21 | setColor(getNewColor()); 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /2021/06_git2/run.sh: -------------------------------------------------------------------------------- 1 | javac ./*.java ./*/*.java ./info/*/*/*.java && java BugRunner 2 | -------------------------------------------------------------------------------- /2021/06_git2/scrots/default.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/06_git2/scrots/default.PNG -------------------------------------------------------------------------------- /2021/06_git2/scrots/line.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/06_git2/scrots/line.PNG -------------------------------------------------------------------------------- /2021/07_trialbyfire/Driver.java: -------------------------------------------------------------------------------- 1 | public class Driver { 2 | 3 | public static double distance(Point a, Point b){ 4 | return Math.sqrt(Math.pow(a.getX()-b.getX(),2)+Math.pow(a.getY()-b.getY(),2)); 5 | } 6 | 7 | public static void main(String[]args){ 8 | Point p1 = new Point(1,1); 9 | Point p2 = new Point(2,2); 10 | System.out.println("Testing the distance 3 ways, should all be sqrt(2)"); 11 | System.out.println(distance(p1,p2)); //static in the Driver class 12 | System.out.println(Point.distanceBetween(p1,p2)); //static in the Point class 13 | System.out.println(p1.distanceTo(p2)); //non-static in the Point class. 14 | 15 | System.out.println("\nTesting 2 identical triangles, perimeter is 2+sqrt(2)"); 16 | Triangle t1 = new Triangle(0,0, 0,1, 1,0); 17 | Triangle t2 = new Triangle(new Point(0,0),new Point(0,1),new Point(1,0)); 18 | System.out.println(t1); 19 | System.out.println(t1.getPerimeter()); 20 | System.out.println(t2); 21 | System.out.println(t2.getPerimeter()); 22 | 23 | System.out.println("\nTesting a 3/4/5 triangle"); 24 | t1 = new Triangle(-1,-1, 2,3, 2,-1); 25 | System.out.println(t1); 26 | System.out.println(t1.getPerimeter()); 27 | 28 | System.out.println("\nTesting getVertex in the 3/4/5 triangle"); 29 | System.out.println(t1.getVertex(0)); 30 | System.out.println(t1.getVertex(1)); 31 | System.out.println(t1.getVertex(2)); 32 | 33 | System.out.println("\nTesting setPoint in the 3/4/5 triangle"); 34 | t1.setVertex(0,new Point(9,9)); 35 | t1.setVertex(1,new Point(-9,9)); 36 | t1.setVertex(2,new Point(9,-9)); 37 | System.out.println(t1); 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /2021/08_newbierobot/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | 08_newbierobot 4 | Project 08_newbierobot created by Buildship. 5 | 6 | 7 | 8 | 9 | org.eclipse.buildship.core.gradleprojectbuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.buildship.core.gradleprojectnature 16 | 17 | 18 | 19 | 1733282330574 20 | 21 | 30 22 | 23 | org.eclipse.core.resources.regexFilterMatcher 24 | node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__ 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /2021/08_newbierobot/.settings/org.eclipse.buildship.core.prefs: -------------------------------------------------------------------------------- 1 | arguments=--init-script /var/folders/pc/l79h7f956zv8tpf_f7_h5d500000gn/T/db3b08fc4a9ef609cb16b96b200fa13e563f396e9bb1ed0905fdab7bc3bc513b.gradle 2 | auto.sync=false 3 | build.scans.enabled=false 4 | connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) 5 | connection.project.dir= 6 | eclipse.preferences.version=1 7 | gradle.user.home= 8 | java.home=/opt/homebrew/Cellar/openjdk/23.0.1/libexec/openjdk.jdk/Contents/Home 9 | jvm.arguments= 10 | offline.mode=false 11 | override.workspace.settings=true 12 | show.console.view=true 13 | show.executions.view=true 14 | -------------------------------------------------------------------------------- /2021/08_newbierobot/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2021/08_newbierobot/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /2021/08_newbierobot/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /2021/08_newbierobot/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2020' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | def homeRoot = new File(publicFolder, "wpilib") 15 | frcHome = new File(homeRoot, frcYear) 16 | } else { 17 | def userFolder = System.getProperty("user.home") 18 | def homeRoot = new File(userFolder, "wpilib") 19 | frcHome = new File(homeRoot, frcYear) 20 | } 21 | def frcHomeMaven = new File(frcHome, 'maven') 22 | maven { 23 | name 'frcHome' 24 | url frcHomeMaven 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /2021/08_newbierobot/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /2021/08_newbierobot/src/main/java/frc/robot/Constants.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot; 9 | 10 | import com.stuypulse.stuylib.network.SmartNumber; 11 | 12 | /** 13 | * This contains all of the ports for motors, gamepads, etc. 14 | * 15 | * Try to avoid having random constants around your code. 16 | * 17 | * The reason its an interface is so that all the values are constant 18 | */ 19 | public interface Constants { 20 | 21 | interface Ports { 22 | interface Drivetrain { 23 | int FRONT_LEFT = 1; 24 | int FRONT_RIGHT = 3; 25 | int BACK_LEFT = 4; 26 | int BACK_RIGHT = 2; 27 | } 28 | 29 | int SHOOTER = 13; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /2021/08_newbierobot/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot; 9 | 10 | import edu.wpi.first.wpilibj.RobotBase; 11 | 12 | /** 13 | * This class is JUST to initialize the robot. 14 | * There is nothing to look at here 15 | */ 16 | public final class Main { 17 | private Main() { 18 | } 19 | 20 | public static void main(String... args) { 21 | RobotBase.startRobot(Robot::new); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /2021/08_newbierobot/src/main/java/frc/robot/commands/DrivetrainDriveCommand.java: -------------------------------------------------------------------------------- 1 | package frc.robot.commands; 2 | 3 | import frc.robot.subsystems.Drivetrain; 4 | 5 | import edu.wpi.first.wpilibj2.command.CommandBase; 6 | import com.stuypulse.stuylib.input.Gamepad; 7 | 8 | public class DrivetrainDriveCommand extends CommandBase { 9 | 10 | // TODO: Make Drivetrain Drive Command 11 | private Drivetrain drivetrain; 12 | private Gamepad gamepad; 13 | 14 | public DrivetrainDriveCommand(Drivetrain drivetrain, Gamepad gamepad) { 15 | // TODO: Add requirements 16 | this.drivetrain = drivetrain; 17 | this.gamepad = gamepad; 18 | 19 | // add requirements takes in Subsystems 20 | // gamepad is not a subsystem!!! :D :O :) >:() ;-; -_- (~_~) 21 | 22 | addRequirements(drivetrain); 23 | } 24 | 25 | public void initialize() { 26 | drivetrain.tankDrive(0, 0); //looks legit 27 | 28 | }// 29 | 30 | public void execute() { 31 | double speed = gamepad.getRightTrigger() - gamepad.getLeftTrigger(); 32 | double turning = gamepad.getLeftX(); 33 | 34 | drivetrain.arcadeDrive(speed, turning); 35 | 36 | /* 37 | WARNING: 38 | 39 | double leftSpeed = gamepad.getLeftTrigger(); 40 | double rightSpeed = gamepad.getRightTrigger(); 41 | drivetrain.tankDrive(leftSpeed, rightSpeed); 42 | */ 43 | } 44 | 45 | 46 | public void end(boolean interrupted) { 47 | 48 | } 49 | 50 | private static volatile boolean MY_TRUE = true; 51 | public boolean isFinished() { 52 | if (MY_TRUE == true) { 53 | return false; 54 | } 55 | else { 56 | // this is how people die 57 | // if 0 > 1 then we should die 58 | // what if a gamma ray hits the CPU while it's doing 1 > 0 and we get an unexpected value 59 | // and someone dies 60 | // that would be unfortunate but risks will be taken 61 | // someone has to bite the bullet for true production to happen (not me) 62 | // amen 63 | // amen 64 | // so sad how sam cant see this lmao 65 | //hi sam 66 | drivetrain.tankDrive(100.0, 100.0); 67 | // :( 68 | // why is sam a bully 69 | } 70 | } 71 | 72 | } -------------------------------------------------------------------------------- /2021/08_newbierobot/src/main/java/frc/robot/commands/DrivetrainSpinCommand.java: -------------------------------------------------------------------------------- 1 | package frc.robot.commands; 2 | 3 | import frc.robot.subsystems.Drivetrain; 4 | 5 | import edu.wpi.first.wpilibj2.command.CommandBase; 6 | import com.stuypulse.stuylib.input.Gamepad; 7 | 8 | public class DrivetrainDriveCommand extends CommandBase { 9 | 10 | // TODO: Make Drivetrain Drive Command 11 | private Drivetrain drivetrain; 12 | 13 | public DrivetrainDriveCommand(Drivetrain drivetrain) { 14 | // TODO: Add requirements 15 | this.drivetrain = drivetrain; 16 | 17 | addRequirements(drivetrain); 18 | } 19 | 20 | public void initialize() { 21 | 22 | } 23 | 24 | public void execute() { 25 | drivetrain.tankDrive(-1, 1); 26 | } 27 | 28 | public boolean isFinished() { 29 | if ((1 > 0) == true) { 30 | return false; 31 | } 32 | else { 33 | // this is how people die 34 | // if 0 > 1 then we should die 35 | // what if a 36 | drivetrain.tankDrive(1, 1); 37 | } 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /2021/08_newbierobot/src/main/java/frc/robot/commands/ShooterShootCommand.java: -------------------------------------------------------------------------------- 1 | package frc.robot.commands; 2 | 3 | import frc.robot.subsystems.Shooter; 4 | 5 | import edu.wpi.first.wpilibj2.command.InstantCommand; 6 | 7 | public class ShooterShootCommand extends InstantCommand { 8 | 9 | // TODO: make shooter shoot command 10 | private Shooter shooter; 11 | 12 | public ShooterShootCommand(Shooter shooter) { 13 | // TODO: add requirements 14 | this.shooter = shooter; 15 | 16 | addRequirements(shooter); 17 | } 18 | 19 | public void initialize() { 20 | shooter.set(1.0); 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /2021/08_newbierobot/src/main/java/frc/robot/commands/ShooterStopCommand.java: -------------------------------------------------------------------------------- 1 | package frc.robot.commands; 2 | 3 | import frc.robot.subsystems.Shooter; 4 | 5 | import edu.wpi.first.wpilibj2.command.InstantCommand; 6 | 7 | public class ShooterStopCommand extends InstantCommand { 8 | 9 | // TODO: make shooter shoot command 10 | private Shooter shooter; 11 | 12 | public ShooterStopCommand(Shooter shooter) { 13 | // TODO: add requirements 14 | this.shooter = shooter; 15 | 16 | addRequirements(shooter); 17 | } 18 | 19 | public void initialize() { 20 | shooter.set(0.0); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /2021/08_newbierobot/src/main/java/frc/robot/commands/autos/DoNothingAutonCommand.java: -------------------------------------------------------------------------------- 1 | package frc.robot.commands.autos; 2 | 3 | import edu.wpi.first.wpilibj2.command.SequentialCommandGroup; 4 | 5 | public class DoNothingAutonCommand extends SequentialCommandGroup { 6 | 7 | public DoNothingAutonCommand() { 8 | addCommands( 9 | // new DrivetrainDriveCommand() ... 10 | ); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /2021/08_newbierobot/src/main/java/frc/robot/subsystems/Drivetrain.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot.subsystems; 9 | 10 | import edu.wpi.first.wpilibj.SpeedControllerGroup; 11 | import edu.wpi.first.wpilibj.drive.DifferentialDrive; 12 | import edu.wpi.first.wpilibj2.command.SubsystemBase; 13 | 14 | import com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX; 15 | 16 | import frc.robot.Constants.Ports; 17 | 18 | public class Drivetrain extends SubsystemBase { 19 | 20 | WPI_VictorSPX frontLeft = new WPI_VictorSPX(Ports.Drivetrain.FRONT_LEFT); 21 | WPI_VictorSPX backLeft = new WPI_VictorSPX(Ports.Drivetrain.BACK_LEFT); 22 | WPI_VictorSPX backRight = new WPI_VictorSPX(Ports.Drivetrain.BACK_RIGHT); 23 | WPI_VictorSPX frontRight = new WPI_VictorSPX (Ports.Drivetrain.FRONT_RIGHT); 24 | 25 | SpeedControllerGroup left = new SpeedControllerGroup(frontLeft,backLeft); 26 | SpeedControllerGroup right = new SpeedControllerGroup(frontRight,backRight); 27 | 28 | DifferentialDrive drive = new DifferentialDrive(left, right); 29 | 30 | public Drivetrain() { 31 | 32 | } 33 | 34 | public void tankDrive(double leftSpeed, double rightSpeed) { 35 | drive.tankDrive(leftSpeed, rightSpeed); 36 | } 37 | 38 | public void arcadeDrive(double speed, double turn) { 39 | drive.arcadeDrive(speed, turn); 40 | } 41 | } 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /2021/08_newbierobot/src/main/java/frc/robot/subsystems/Shooter.java: -------------------------------------------------------------------------------- 1 | /*----------------------------------------------------------------------------*/ 2 | /* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */ 3 | /* Open Source Software - may be modified and shared by FRC teams. The code */ 4 | /* must be accompanied by the FIRST BSD license file in the root directory of */ 5 | /* the project. */ 6 | /*----------------------------------------------------------------------------*/ 7 | 8 | package frc.robot.subsystems; 9 | 10 | import edu.wpi.first.wpilibj2.command.SubsystemBase; 11 | 12 | import com.ctre.phoenix.motorcontrol.can.WPI_VictorSPX; 13 | 14 | import frc.robot.Constants.Ports; 15 | 16 | public class Shooter extends SubsystemBase { 17 | WPI_TalonSPX motor; 18 | 19 | public Shooter() { 20 | motor = new WPI_VictorSPX(Ports.SHOOTER); 21 | } 22 | 23 | public void set(double speed) { 24 | motor.set(speed); 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /2021/08_newbierobot/vendordeps/WPILibNewCommands.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "WPILibNewCommands.json", 3 | "name": "WPILib-New-Commands", 4 | "version": "2020.0.0", 5 | "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", 6 | "mavenUrls": [], 7 | "jsonUrl": "", 8 | "javaDependencies": [ 9 | { 10 | "groupId": "edu.wpi.first.wpilibNewCommands", 11 | "artifactId": "wpilibNewCommands-java", 12 | "version": "wpilib" 13 | } 14 | ], 15 | "jniDependencies": [], 16 | "cppDependencies": [ 17 | { 18 | "groupId": "edu.wpi.first.wpilibNewCommands", 19 | "artifactId": "wpilibNewCommands-cpp", 20 | "version": "wpilib", 21 | "libName": "wpilibNewCommands", 22 | "headerClassifier": "headers", 23 | "sourcesClassifier": "sources", 24 | "sharedLibrary": true, 25 | "skipInvalidPlatforms": true, 26 | "binaryPlatforms": [ 27 | "linuxathena", 28 | "linuxraspbian", 29 | "linuxaarch64bionic", 30 | "windowsx86-64", 31 | "windowsx86", 32 | "linuxx86-64", 33 | "osxx86-64" 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /2021/08_newbierobot/vendordeps/navx_frc.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "navx_frc.json", 3 | "name": "KauaiLabs_navX_FRC", 4 | "version": "3.1.405", 5 | "uuid": "cb311d09-36e9-4143-a032-55bb2b94443b", 6 | "mavenUrls": [ 7 | "https://repo1.maven.org/maven2/" 8 | ], 9 | "jsonUrl": "https://www.kauailabs.com/dist/frc/2020/navx_frc.json", 10 | "javaDependencies": [ 11 | { 12 | "groupId": "com.kauailabs.navx.frc", 13 | "artifactId": "navx-java", 14 | "version": "3.1.405" 15 | } 16 | ], 17 | "jniDependencies": [], 18 | "cppDependencies": [ 19 | { 20 | "groupId": "com.kauailabs.navx.frc", 21 | "artifactId": "navx-cpp", 22 | "version": "3.1.405", 23 | "headerClassifier": "headers", 24 | "sourcesClassifier": "sources", 25 | "sharedLibrary": false, 26 | "libName": "navx_frc", 27 | "skipInvalidPlatforms": true, 28 | "binaryPlatforms": [ 29 | "linuxathena", 30 | "linuxraspbian", 31 | "windowsx86-x64" 32 | ] 33 | } 34 | ] 35 | } -------------------------------------------------------------------------------- /2021/README.md: -------------------------------------------------------------------------------- 1 | # Newbie Ed. 2021 2 | 3 | Here lives all the stuff for the 2021 newbie ed. 4 | 5 | ## Format 6 | 7 | Each dirctory is organized by lesson, with the following format: `_`.
8 | Inside each lesson there is `README.md` with an assignment.
9 | For each assingment please make a folder for yourself like so: `_`.
10 | If a lesson has parts they should be named so: `_`.
11 | 12 | ### Example 13 | 14 | ``` 15 | newbie-ed 16 | ├─ 2020 17 | ├─ 2021 18 | ├─ 01_cmd 19 | ├─ 02_git 20 | ├─ john_doe 21 | └─ README.md 22 | └─ README.md 23 | ├─ 03_java 24 | ├─ john_doe 25 | └─ Main.java 26 | ├─ 04_oops 27 | ├─ 05_inheritance 28 | └─ 06_git2 29 | ``` 30 | 31 | ## Order 32 | 33 | The order for newbie ed can be found [here](https://docs.google.com/document/d/1B7yyqWRYecFkDHLbK46FZrSarQgD_g4x_QwnTIkw2F4/edit?usp=sharing). 34 | 35 | ## Mandatory? 36 | 37 | None of this is mandatory! The entire point is to give you Java practice as well as git practice. 38 | 39 | # How to set up Java (For Windows (x64), updated 11/03/20) 40 | (adoptopenjdk.net link is by the courtesy of our mentor, Jeanne Boyarsky) 41 | 42 | You should first check if Java is already installed with step 4 and type in `java --version` into Git Bash and make sure your version is java 11 43 | 1. Go here: https://adoptopenjdk.net/?variant=openjdk11&jvmVariant=hotspot, and download `OpenJDK 11 (LTS)` with `HotSpot` JVM 44 | 2. Run the `OpenJDK11U-jdk_x64_windows_hotspot_11.0.9_11.msi` 45 | 1. Click `Next` 46 | 2. Check the `I accept the terms in the License Agreement` box and click `Next` 47 | 3. Click the box next to `Set JAVA_HOME variable` and click `Entire feature will be installed on local hard drive` 48 | 4. Click `Next` then `Install` and give it permission 49 | 3. To check if this worked, open (or reopen) Git Bash and type in `javac` and press `Enter` 50 | 4. If command is not found, contact an oldbie and set up a meeting with them. 51 | * The command is found if Git Bash spits out a bunch of stuff with -- 52 | 53 | # How to set up Java (for all other operating systems) 54 | Go here: and follow the instruction for you specific operating system: https://adoptopenjdk.net/installation.html?variant=openjdk11&jvmVariant=hotspot (I would recommend you to use the same version and JVM as the one mentioned above) 55 | -------------------------------------------------------------------------------- /2022/01_CommandLine/README.md: -------------------------------------------------------------------------------- 1 | # 01_CommandLine 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1yl0_ZZ3r-0sbl-ysxdpFArPzqlsayc-Aw1_A5CC5eVA/edit) 4 | 2. [Activity](https://drive.google.com/file/d/19hTGEnRzGGan0QzCa16XHqnn1kLvLGnb/view) 5 | 3. [Cheat Sheet](https://docs.google.com/document/d/1Loqr7MtpDtYee4bcSpuPFgPPQyoo9JZoZI79HCnbwCk/edit) 6 | -------------------------------------------------------------------------------- /2022/02_JavaBasics/README.md: -------------------------------------------------------------------------------- 1 | # 02_JavaBasics 2 | 3 | 1. [Week 1 Lesson Slides](https://docs.google.com/presentation/d/1FBkgqQfGXg0vPp0GTR6SE8dErRoHfiTfYP9lLm4px6U/edit) 4 | 2. [Week 2 Lesson Slides](https://docs.google.com/presentation/d/18yGJYc7Smld79WcnJvQ08uxlZosipNIc0hQZ4TxCtt8/edit) 5 | 3. [Week 3 Lesson Slides](https://docs.google.com/presentation/d/1SWvCGiW-gO-QLk1b7tuH7HaSKk8GmivWhizNVysOT80/edit) 6 | -------------------------------------------------------------------------------- /2022/03_GitBasics/README.md: -------------------------------------------------------------------------------- 1 | # 03_GitBasics 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1hPkmVCb7XJuE-Kbb_apk0PicVLmaolZxj3dEWZgZV8Q/edit) 4 | -------------------------------------------------------------------------------- /2022/04_AdvancedJava/README.md: -------------------------------------------------------------------------------- 1 | # 04_AdvancedJava 2 | 3 | 1. [Week 1 Lesson Slides](https://docs.google.com/presentation/d/14kLJjgbK7U9y4RwNF7HCAwX3ROql3coPsGXy7VFGw4c/edit) 4 | 2. [Week 2 Lesson Slides](https://docs.google.com/presentation/d/1yMBYyff0aaqAQfARDBqKbiEGHmZBJ3c1kIuQsubFGHA/edit) 5 | -------------------------------------------------------------------------------- /2022/05_AdvancedGit/README.md: -------------------------------------------------------------------------------- 1 | # 05_AdvancedGit 2 | -------------------------------------------------------------------------------- /2022/06_RobotCode/README.md: -------------------------------------------------------------------------------- 1 | # 06_RobotCode 2 | 3 | ## [Sample Romi Code](https://github.com/StuyPulse/newbie-ed/tree/main/2022/RichieBot) 4 | 5 | ## [Robot Code Crash Course: Basics + Subsystems](https://docs.google.com/presentation/d/1ReqjRCnUtxCp35dnbyVxcEvVo_W2st1EY_g1cKGHZcc/edit) 6 | 7 | ## [Robot Code Crash Course: Commands](https://docs.google.com/presentation/d/1QpH_4QUwo9mfX5rCZOvSirsOu7A58skEvV2Y1eQAFDc/edit) 8 | -------------------------------------------------------------------------------- /2022/README.md: -------------------------------------------------------------------------------- 1 | # Newbie Ed. 2022 2 | 3 | ## Current Topic: [Robot Code](https://github.com/StuyPulse/newbie-ed/blob/main/2022/06_RobotCode/README.md) 4 | 5 | ## [Sample Romi Code](https://github.com/StuyPulse/newbie-ed/tree/main/2022/RichieBot) 6 | -------------------------------------------------------------------------------- /2022/RichieBot/WPILib-License.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2021 FIRST and other WPILib contributors 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | * Redistributions of source code must retain the above copyright 7 | notice, this list of conditions and the following disclaimer. 8 | * Redistributions in binary form must reproduce the above copyright 9 | notice, this list of conditions and the following disclaimer in the 10 | documentation and/or other materials provided with the distribution. 11 | * Neither the name of FIRST, WPILib, nor the names of other WPILib 12 | contributors may be used to endorse or promote products derived from 13 | this software without specific prior written permission. 14 | 15 | THIS SOFTWARE IS PROVIDED BY FIRST AND OTHER WPILIB CONTRIBUTORS "AS IS" AND 16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 17 | WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR 18 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR 19 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /2022/RichieBot/bin/main/frc/robot/subsystems/Note.txt: -------------------------------------------------------------------------------- 1 | arcade 2 | - speed 3 | - turn 4 | 5 | arcade -> tank 6 | - left: speed + turn 7 | - right: speed - turn 8 | 9 | arcade(0.5, 0.25) --> 10 | tank(0.75, 0.25) 11 | 12 | Subsystem <--- addRequirements 13 | | 14 | SubsystemBase 15 | / | 16 | Bread RomiDrivetrain 17 | 18 | Command <-- Command getAutonomousCommand 19 | | 20 | CommandBase 21 | | 22 | DriveForwardCommand -------------------------------------------------------------------------------- /2022/RichieBot/build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id "java" 3 | id "edu.wpi.first.GradleRIO" version "2021.3.1" 4 | } 5 | 6 | sourceCompatibility = JavaVersion.VERSION_11 7 | targetCompatibility = JavaVersion.VERSION_11 8 | 9 | 10 | allprojects { 11 | repositories { 12 | maven { url 'https://jitpack.io' } 13 | } 14 | } 15 | 16 | def ROBOT_MAIN_CLASS = "frc.robot.Main" 17 | 18 | // Set this to true to enable desktop support. 19 | def includeDesktopSupport = true 20 | 21 | // Defining my dependencies. In this case, WPILib (+ friends), and vendor libraries. 22 | // Also defines JUnit 4. 23 | dependencies { 24 | implementation wpi.deps.wpilib() 25 | nativeDesktopZip wpi.deps.wpilibJni(wpi.platforms.desktop) 26 | 27 | 28 | implementation wpi.deps.vendor.java() 29 | nativeDesktopZip wpi.deps.vendor.jni(wpi.platforms.desktop) 30 | 31 | testImplementation 'junit:junit:4.12' 32 | 33 | // Enable simulation gui support. Must check the box in vscode to enable support 34 | // upon debugging 35 | simulation wpi.deps.sim.gui(wpi.platforms.desktop, false) 36 | simulation wpi.deps.sim.driverstation(wpi.platforms.desktop, false) 37 | 38 | // Websocket extensions require additional configuration. 39 | // simulation wpi.deps.sim.ws_server(wpi.platforms.desktop, false) 40 | simulation wpi.deps.sim.ws_client(wpi.platforms.desktop, false) 41 | 42 | implementation 'com.github.StuyPulse:StuyLib:v2021.2.2' 43 | } 44 | 45 | // Set the websocket remote host (the Romi IP address). 46 | sim { 47 | envVar "HALSIMWS_HOST", "10.6.94.2" 48 | } 49 | 50 | // Setting up my Jar File. In this case, adding all libraries into the main jar ('fat jar') 51 | // in order to make them all available at runtime. Also adding the manifest so WPILib 52 | // knows where to look for our Robot Class. 53 | jar { 54 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 55 | manifest edu.wpi.first.gradlerio.GradleRIOPlugin.javaManifest(ROBOT_MAIN_CLASS) 56 | } 57 | -------------------------------------------------------------------------------- /2022/RichieBot/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/StuyPulse/newbie-ed/0e6c4fffc9f33e9c1f953667b1e7efe237e0b434/2022/RichieBot/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /2022/RichieBot/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=permwrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=permwrapper/dists 6 | -------------------------------------------------------------------------------- /2022/RichieBot/settings.gradle: -------------------------------------------------------------------------------- 1 | import org.gradle.internal.os.OperatingSystem 2 | 3 | pluginManagement { 4 | repositories { 5 | mavenLocal() 6 | gradlePluginPortal() 7 | String frcYear = '2021' 8 | File frcHome 9 | if (OperatingSystem.current().isWindows()) { 10 | String publicFolder = System.getenv('PUBLIC') 11 | if (publicFolder == null) { 12 | publicFolder = "C:\\Users\\Public" 13 | } 14 | def homeRoot = new File(publicFolder, "wpilib") 15 | frcHome = new File(homeRoot, frcYear) 16 | } else { 17 | def userFolder = System.getProperty("user.home") 18 | def homeRoot = new File(userFolder, "wpilib") 19 | frcHome = new File(homeRoot, frcYear) 20 | } 21 | def frcHomeMaven = new File(frcHome, 'maven') 22 | maven { 23 | name 'frcHome' 24 | url frcHomeMaven 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /2022/RichieBot/src/main/deploy/example.txt: -------------------------------------------------------------------------------- 1 | Files placed in this directory will be deployed to the RoboRIO into the 2 | 'deploy' directory in the home folder. Use the 'Filesystem.getDeployDirectory' wpilib function 3 | to get a proper path relative to the deploy directory. -------------------------------------------------------------------------------- /2022/RichieBot/src/main/java/frc/robot/Constants.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | /** 8 | * The Constants class provides a convenient place for teams to hold robot-wide numerical or boolean 9 | * constants. This class should not be used for any other purpose. All constants should be declared 10 | * globally (i.e. public static). Do not put anything functional in this class. 11 | * 12 | *

It is advised to statically import this class (or one of its inner classes) wherever the 13 | * constants are needed, to reduce verbosity. 14 | */ 15 | public final class Constants {} 16 | -------------------------------------------------------------------------------- /2022/RichieBot/src/main/java/frc/robot/Main.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot; 6 | 7 | import edu.wpi.first.wpilibj.RobotBase; 8 | 9 | /** 10 | * Do NOT add any static variables to this class, or any initialization at all. Unless you know what 11 | * you are doing, do not modify this file except to change the parameter class to the startRobot 12 | * call. 13 | */ 14 | public final class Main { 15 | private Main() {} 16 | 17 | /** 18 | * Main initialization function. Do not perform any initialization here. 19 | * 20 | *

If you change your main robot class, change the parameter type. 21 | */ 22 | public static void main(String... args) { 23 | RobotBase.startRobot(Robot::new); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /2022/RichieBot/src/main/java/frc/robot/commands/Cook.java: -------------------------------------------------------------------------------- 1 | package frc.robot.commands; 2 | 3 | import edu.wpi.first.wpilibj2.command.CommandBase; 4 | import frc.robot.subsystems.Bread; 5 | 6 | public class Cook extends CommandBase { 7 | private Bread bread; 8 | 9 | public Cook(Bread bread) { 10 | this.bread = bread; 11 | addRequirements(bread); 12 | } 13 | 14 | public void initialize() { 15 | 16 | } 17 | 18 | @Override 19 | public void execute() { 20 | bread.bake(1,1); 21 | } 22 | 23 | public boolean isFinished() { 24 | return false; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /2022/RichieBot/src/main/java/frc/robot/commands/DriveDistanceCommand.java: -------------------------------------------------------------------------------- 1 | package frc.robot.commands; 2 | 3 | import edu.wpi.first.wpilibj2.command.CommandBase; 4 | import frc.robot.subsystems.RomiDrivetrain; 5 | 6 | public class DriveDistanceCommand extends CommandBase { 7 | private RomiDrivetrain richie; 8 | private double goalDistance; 9 | 10 | public DriveDistanceCommand(RomiDrivetrain richie, double goalDistance) { 11 | this.richie = richie; 12 | this.goalDistance = goalDistance; 13 | 14 | addRequirements(richie); 15 | } 16 | 17 | public void initialize() { 18 | richie.resetEncoders(); 19 | } 20 | 21 | public void execute() { 22 | richie.tankDrive(1,1); 23 | } 24 | 25 | public boolean isFinished() { 26 | if (richie.getLeftDistanceInch() < goalDistance) { 27 | return false; 28 | } else { 29 | return true; 30 | } 31 | // return richie.getLeftDistanceInch() > goalDistance; 32 | } 33 | 34 | public void end(boolean interrupted) { 35 | // richie.tankDrive(0, 0); 36 | richie.stop(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /2022/RichieBot/src/main/java/frc/robot/commands/DriveForwardCommand.java: -------------------------------------------------------------------------------- 1 | package frc.robot.commands; 2 | 3 | import edu.wpi.first.wpilibj2.command.CommandBase; 4 | import frc.robot.subsystems.RomiDrivetrain; 5 | 6 | public class DriveForwardCommand extends CommandBase { 7 | private RomiDrivetrain drivetrain; 8 | 9 | public DriveForwardCommand(RomiDrivetrain drivetrain) { 10 | this.drivetrain = drivetrain; 11 | 12 | addRequirements(drivetrain); 13 | } 14 | 15 | // started: 16 | // 1 initialize runs once 17 | // 2 checks if isFinished() is true 18 | // 3 runs execute if not finished & goes to 2 19 | // 4 calls end if finished 20 | 21 | // initialize - runs once when command is started 22 | public void initialize() { 23 | drivetrain.stop(); 24 | 25 | } 26 | 27 | // execute - runs repeatedly every 50ms until command ends 28 | public void execute() { 29 | drivetrain.tankDrive(-0.25, 0.25); 30 | } 31 | 32 | // isFinished - returns if command should end 33 | // (stop calling execute) 34 | public boolean isFinished() { 35 | return false; 36 | } 37 | 38 | // end 39 | public void end(boolean interrupted) { 40 | 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /2022/RichieBot/src/main/java/frc/robot/commands/ExampleCommand.java: -------------------------------------------------------------------------------- 1 | // Copyright (c) FIRST and other WPILib contributors. 2 | // Open Source Software; you can modify and/or share it under the terms of 3 | // the WPILib BSD license file in the root directory of this project. 4 | 5 | package frc.robot.commands; 6 | 7 | import frc.robot.subsystems.RomiDrivetrain; 8 | import edu.wpi.first.wpilibj2.command.CommandBase; 9 | 10 | /** An example command that uses an example subsystem. */ 11 | public class ExampleCommand extends CommandBase { 12 | @SuppressWarnings({"PMD.UnusedPrivateField", "PMD.SingularField"}) 13 | private final RomiDrivetrain m_subsystem; 14 | 15 | /** 16 | * Creates a new ExampleCommand. 17 | * 18 | * @param subsystem The subsystem used by this command. 19 | */ 20 | public ExampleCommand(RomiDrivetrain subsystem) { 21 | m_subsystem = subsystem; 22 | // Use addRequirements() here to declare subsystem dependencies. 23 | addRequirements(subsystem); 24 | } 25 | 26 | // Called when the command is initially scheduled. 27 | @Override 28 | public void initialize() {} 29 | 30 | // Called every time the scheduler runs while the command is scheduled. 31 | @Override 32 | public void execute() {} 33 | 34 | // Called once the command ends or is interrupted. 35 | @Override 36 | public void end(boolean interrupted) {} 37 | 38 | // Returns true when the command should end. 39 | @Override 40 | public boolean isFinished() { 41 | return false; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /2022/RichieBot/src/main/java/frc/robot/commands/TankDriveCommand.java: -------------------------------------------------------------------------------- 1 | package frc.robot.commands; 2 | 3 | import com.stuypulse.stuylib.input.Gamepad; 4 | 5 | import edu.wpi.first.wpilibj2.command.CommandBase; 6 | import frc.robot.subsystems.RomiDrivetrain; 7 | 8 | public class TankDriveCommand extends CommandBase { 9 | private RomiDrivetrain andrew; 10 | private Gamepad driver; 11 | 12 | public TankDriveCommand(RomiDrivetrain driveTrain, Gamepad gamepad) 13 | { 14 | andrew = driveTrain; 15 | driver = gamepad; 16 | 17 | addRequirements(andrew); 18 | } 19 | 20 | public void execute() { 21 | andrew.tankDrive( 22 | driver.getLeftY(), 23 | driver.getRightY() 24 | ); 25 | } 26 | 27 | public boolean isFinished() { 28 | return false; 29 | } 30 | 31 | 32 | } 33 | -------------------------------------------------------------------------------- /2022/RichieBot/src/main/java/frc/robot/subsystems/Bread.java: -------------------------------------------------------------------------------- 1 | package frc.robot.subsystems; 2 | 3 | import edu.wpi.first.wpilibj.Spark; 4 | import edu.wpi.first.wpilibj2.command.SubsystemBase; 5 | 6 | public class Bread extends SubsystemBase { 7 | private Spark wheat; // = new Spark(-1); 8 | private Spark flour; 9 | 10 | public Bread(){ 11 | wheat = new Spark(0); 12 | flour = new Spark(1); 13 | 14 | flour.setInverted(true); 15 | } 16 | 17 | @Override 18 | public void periodic() { 19 | } 20 | 21 | public void bake(double wheatSpeed, double flourSpeed) { 22 | wheat.set(wheatSpeed); 23 | flour.set(flourSpeed); 24 | } 25 | 26 | public void fry(double wheatness, double flourness){ 27 | bake( 28 | wheatness+flourness, 29 | wheatness-flourness 30 | ); 31 | } 32 | 33 | public void freeze() { 34 | wheat.set(0.0); 35 | flour.set(0.0); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /2022/RichieBot/src/main/java/frc/robot/subsystems/Note.txt: -------------------------------------------------------------------------------- 1 | arcade 2 | - speed 3 | - turn 4 | 5 | arcade -> tank 6 | - left: speed + turn 7 | - right: speed - turn 8 | 9 | arcade(0.5, 0.25) --> 10 | tank(0.75, 0.25) 11 | 12 | Subsystem <--- addRequirements 13 | | 14 | SubsystemBase 15 | / | 16 | Bread RomiDrivetrain 17 | 18 | Command <-- Command getAutonomousCommand 19 | | 20 | CommandBase 21 | | 22 | DriveForwardCommand -------------------------------------------------------------------------------- /2022/RichieBot/vendordeps/WPILibNewCommands.json: -------------------------------------------------------------------------------- 1 | { 2 | "fileName": "WPILibNewCommands.json", 3 | "name": "WPILib-New-Commands", 4 | "version": "2020.0.0", 5 | "uuid": "111e20f7-815e-48f8-9dd6-e675ce75b266", 6 | "mavenUrls": [], 7 | "jsonUrl": "", 8 | "javaDependencies": [ 9 | { 10 | "groupId": "edu.wpi.first.wpilibNewCommands", 11 | "artifactId": "wpilibNewCommands-java", 12 | "version": "wpilib" 13 | } 14 | ], 15 | "jniDependencies": [], 16 | "cppDependencies": [ 17 | { 18 | "groupId": "edu.wpi.first.wpilibNewCommands", 19 | "artifactId": "wpilibNewCommands-cpp", 20 | "version": "wpilib", 21 | "libName": "wpilibNewCommands", 22 | "headerClassifier": "headers", 23 | "sourcesClassifier": "sources", 24 | "sharedLibrary": true, 25 | "skipInvalidPlatforms": true, 26 | "binaryPlatforms": [ 27 | "linuxathena", 28 | "linuxraspbian", 29 | "linuxaarch64bionic", 30 | "windowsx86-64", 31 | "windowsx86", 32 | "linuxx86-64", 33 | "osxx86-64" 34 | ] 35 | } 36 | ] 37 | } 38 | -------------------------------------------------------------------------------- /2023/00_CommandLine/README.md: -------------------------------------------------------------------------------- 1 | # 00_CommandLine 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1yl0_ZZ3r-0sbl-ysxdpFArPzqlsayc-Aw1_A5CC5eVA/edit?usp=sharing) 4 | 2. [Activity](https://drive.google.com/file/d/19hTGEnRzGGan0QzCa16XHqnn1kLvLGnb/view) 5 | 3. [Cheat Sheet](https://docs.google.com/document/d/1Loqr7MtpDtYee4bcSpuPFgPPQyoo9JZoZI79HCnbwCk/edit) 6 | -------------------------------------------------------------------------------- /2023/01_JavaBasics/README.md: -------------------------------------------------------------------------------- 1 | # 01_JavaBasics 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/15_3ZqScZnz1fLmZukU98dWWGJXZ79nsk8lzViBeVru0/edit?usp=sharing) -------------------------------------------------------------------------------- /2023/02_GitEducation/README.md: -------------------------------------------------------------------------------- 1 | # 02_GitEducation 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1quMdVVCcxI2e5iicxcKL2Rrj5PxuE6phpH09Ov_QYeg/edit?usp=sharing) 4 | 2. [WPILibs VSC + GitBash Download Guide](https://docs.google.com/presentation/d/1zaNArZgX6TMUJyGRfIUztPQpo4sQX7BtXzcykSBXAS0/edit?usp=sharing) 5 | 3. [Penguin Of Liberty] -------------------------------------------------------------------------------- /2023/03_ConditionalsAndArrays/README.md: -------------------------------------------------------------------------------- 1 | # 03_ConditionalsAndArrays 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1JLy3o_Aj5o4-2mbiKz4Zh_So9dpOrGd2n3JG00wmNew/edit?usp=sharing) -------------------------------------------------------------------------------- /2023/04_Looping/README.md: -------------------------------------------------------------------------------- 1 | # 04_Looping 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1OiaQ1NRiAdSb8NFCjQy_iC7LyAeiI8Od8ZAQaNF1Wrk/edit?usp=sharing) 4 | -------------------------------------------------------------------------------- /2023/05_Functions/Lesson5.java: -------------------------------------------------------------------------------- 1 | public class Lesson5 { 2 | public static void main(String[] args) { 3 | } 4 | // True if even function 5 | public static boolean isEven(int n) { 6 | return n % 2 == 0; 7 | } 8 | 9 | // Avg of 3 nums 10 | public static double avg3(int a, int b, int c) { 11 | return (a + b + c) / 3.0; 12 | } 13 | 14 | // Person description function 15 | public static String personDescription(String name, int age, int grade) { 16 | return name + " is " + age + " years old and is in grade " + grade; 17 | } 18 | 19 | // Exponent function 20 | public static double exponent(double base, int power) { 21 | double result = 1; 22 | for (int i = 0; i < power; i++) { 23 | result *= base; 24 | } 25 | return result; 26 | } 27 | 28 | // Avg of 3 nums to the nth power 29 | public static double avg3ToTheNthPower(int a, int b, int c, int n) { 30 | return exponent(avg3(a, b, c), n); 31 | } 32 | 33 | // Factorial function 34 | public static int factorial(int n) { 35 | for (int i = 0; i < n; i++) { 36 | n *= i; 37 | } 38 | return n; 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /2023/05_Functions/README.md: -------------------------------------------------------------------------------- 1 | # 05_Functions 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1btbPreSwgyWBCvDpK17OmRPPFbji8mK9nVVNtmvu1l4/edit?usp=sharing) 4 | 5 | -------------------------------------------------------------------------------- /2023/06_OOP1/README.md: -------------------------------------------------------------------------------- 1 | # 06_OOP1 (Classes, Objects, Constructors, this Keyword) 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1MpNrX5zbE7zGE_19x9pnz0DAaD8D-NFO5MBUMAhguCw/edit?usp=sharing) 4 | 5 | -------------------------------------------------------------------------------- /2023/07OOP2/Car.java: -------------------------------------------------------------------------------- 1 | public class Car extends Vehicle{ 2 | String hasHood; 3 | 4 | public Car(double weight, String manufacturer, int numOfSeats, String hasHood) { 5 | super(weight, manufacturer, numOfSeats); 6 | this.hasHood = hasHood; 7 | } 8 | 9 | @Override 10 | public void startEngine() { 11 | System.out.println("Super fast"); 12 | } 13 | 14 | @Override 15 | public void stopEngine() { 16 | System.out.println("Super Fast"); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /2023/07OOP2/Lesson7.java: -------------------------------------------------------------------------------- 1 | public class Lesson7 { 2 | public static void main(String[] args) { 3 | Car car1 = new Car(1, "nissan", 2, "altima"); 4 | Car car2 = new Car(2, "Honda", 4, "Recent"); 5 | Truck truck1 = new Truck(1, "monster", 4, "Richie"); 6 | Truck truck2 = new Truck(7, "Tesla", 1, "Fatou"); 7 | 8 | Vehicle[] garage = {car1, car2, truck1, truck2}; 9 | int[] arr = {1,2,3,4}; 10 | 11 | for (int i = 0; i < garage.length; i++) { 12 | garage[i].startEngine(); 13 | } 14 | 15 | for (int i = 0; i < garage.length; i++) { 16 | garage[i].stopEngine(); 17 | } 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /2023/07OOP2/README.md: -------------------------------------------------------------------------------- 1 | # 07_OOP2 (Private/Public, Static/Instance, Practice) 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1gPsAa8aQfTmRRf-fevyO5TsezWpxrtTAVup2M3JcVdY/edit?usp=sharing) 4 | -------------------------------------------------------------------------------- /2023/07OOP2/Truck.java: -------------------------------------------------------------------------------- 1 | public class Truck extends Vehicle{ 2 | String driverName; 3 | 4 | public Truck(double weight, String manufacturer, int numOfSeats, String driverName) { 5 | super(weight, manufacturer, numOfSeats); 6 | this.driverName = driverName; 7 | } 8 | 9 | @Override 10 | public void startEngine() { 11 | System.out.println("start engine..."); 12 | } 13 | 14 | @Override 15 | public void stopEngine() { 16 | System.out.println("stop engine..."); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /2023/07OOP2/Vehicle.java: -------------------------------------------------------------------------------- 1 | public abstract class Vehicle { 2 | double weight; 3 | String manufacturer; 4 | int numOfSeats; 5 | 6 | public Vehicle(double weight, String manufacturer, int numOfSeats){ 7 | this.weight = weight; 8 | this.manufacturer = manufacturer; 9 | this.numOfSeats = numOfSeats; 10 | } 11 | 12 | public abstract void startEngine(); 13 | public abstract void stopEngine(); 14 | 15 | } 16 | 17 | -------------------------------------------------------------------------------- /2023/08_OOP3/Account.java: -------------------------------------------------------------------------------- 1 | public class Account { 2 | private String id; 3 | private String name; 4 | private int balance; 5 | 6 | // Constructors 7 | public Account (String id, String name) { 8 | this.id = id; 9 | this.name = name; 10 | this.balance = 0; 11 | } 12 | public Account (String id, String name, int balance) { 13 | this.id = id; 14 | this.name = name; 15 | this.balance = balance; 16 | } 17 | // Getters 18 | public String getID() { 19 | return this.id; 20 | } 21 | public String getName() { 22 | return this.name; 23 | } 24 | public int getBalance() { 25 | return this.balance; 26 | } 27 | 28 | // Methods 29 | public int credit(int amount) { 30 | this.balance += amount; 31 | return this.balance; 32 | } 33 | public int debit(int amount) { 34 | if (this.balance >= amount) { 35 | this.balance -= amount; 36 | } else { 37 | System.out.println("Amount exceeded balance"); 38 | } 39 | return this.balance; 40 | } 41 | public int transferTo(Account another, int amount) { 42 | if (this.balance >= amount) { 43 | this.balance -= amount; 44 | another.balance += amount; 45 | } else { 46 | System.out.println("Amount exceeded balance"); 47 | } 48 | return this.balance; 49 | } 50 | } -------------------------------------------------------------------------------- /2023/08_OOP3/Ball.java: -------------------------------------------------------------------------------- 1 | public class Ball { 2 | private double x; 3 | private double y; 4 | private double z; 5 | 6 | // Constructor 7 | public Ball(double x, double y, double z) { 8 | this.x = x; 9 | this.y = y; 10 | this.z = z; 11 | } 12 | 13 | // Getters 14 | public double getX() { 15 | return this.x; 16 | } 17 | public double getY() { 18 | return this.y; 19 | } 20 | public double getZ() { 21 | return this.z; 22 | } 23 | 24 | // Methods 25 | public void setXYZ(double x, double y, double z) { 26 | this.x = x; 27 | this.y = y; 28 | this.z = z; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /2023/08_OOP3/Circle.java: -------------------------------------------------------------------------------- 1 | public class Circle { 2 | private double radius; 3 | private String color; 4 | public Circle(double radius,String color){ 5 | this.radius = radius; 6 | this.color = color; 7 | 8 | } 9 | public Circle(double radius){ 10 | this.radius = radius; 11 | this.color = "Red"; 12 | 13 | } 14 | public Circle() { 15 | this.radius = 1; 16 | this.color = "Red"; 17 | } 18 | public double getRadius(){ 19 | return this.radius; 20 | } 21 | public String getColor(){ 22 | return this.color; 23 | } 24 | public void setRadius(double radius){ 25 | this.radius = radius; 26 | } 27 | public void setColor(String color){ 28 | this.color = color; 29 | } 30 | 31 | public double getArea() { 32 | return Math.PI * Math.pow(this.radius,2); 33 | } 34 | 35 | public double getCircumference() { 36 | return Math.PI * 2 * this.radius; 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /2023/08_OOP3/Lesson8.java: -------------------------------------------------------------------------------- 1 | public class Lesson8 { 2 | public static void main(String[] args) { 3 | 4 | // Test Account class 5 | Account a1 = new Account("A101", "Elon", 1000000); 6 | Account a2 = new Account("A102", "Freshman"); // default balance 7 | // Test Getters and display info 8 | System.out.println("ID: " + a1.getID()); 9 | System.out.println("Name: " + a1.getName()); 10 | System.out.println("Balance: " + a1.getBalance()); 11 | System.out.println("ID: " + a2.getID()); 12 | System.out.println("Name: " + a2.getName()); 13 | System.out.println("Balance: " + a2.getBalance()); 14 | // Test credit() and debit() 15 | a1.credit(100); 16 | System.out.println("Balance: " + a1.getBalance()); 17 | a1.debit(50); 18 | System.out.println("Balance: " + a1.getBalance()); 19 | a2.debit(500); // debit() error because balance < amount 20 | System.out.println("Balance: " + a1.getBalance()); // balance unchanged 21 | // Test transferTo() 22 | a2.transferTo(a1, 100); 23 | System.out.println("Balance: " + a1.getBalance()); 24 | System.out.println("Balance: " + a2.getBalance()); 25 | a2.transferTo(a1, 1000000); // transferTo() error because balance < amount 26 | System.out.println("Balance: " + a1.getBalance()); 27 | System.out.println("Balance: " + a2.getBalance()); 28 | 29 | // Test Ball and Player classes 30 | Ball b1 = new Ball(0, 0, 0); 31 | Ball b2 = new Ball(10, 10, 10); 32 | Player p1 = new Player(1, 0, 0); 33 | Player p3 = new Player(3, 10, 10, 10); 34 | // Test setXYZ() and getters 35 | b1.setXYZ(1, 1, 1); 36 | System.out.println("X: " + b1.getX()); 37 | System.out.println("Y: " + b1.getY()); 38 | System.out.println("Z: " + b1.getZ()); 39 | // Test isNear() 40 | System.out.println("Is p1 near b1? " + p1.isNear(b1)); // true because z = 0 41 | System.out.println("Is p3 near b1? " + p3.isNear(b1)); // false because z = 10 42 | // Test kick() 43 | p1.kick(b1); 44 | System.out.println("X: " + b1.getX()); 45 | System.out.println("Y: " + b1.getY()); 46 | System.out.println("Z: " + b1.getZ()); 47 | } 48 | } 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /2023/08_OOP3/Main.java: -------------------------------------------------------------------------------- 1 | public class Main { 2 | public static void main(String[] args) { 3 | Circle c1 = new Circle(); 4 | // Invoke public methods on instance c1, via dot operator. 5 | System.out.println("The circle has radius of " 6 | + c1.getRadius() + " and area of " + c1.getArea()); 7 | //The circle has radius of 1.0 and area of 3.141592653589793 8 | 9 | // Declare an instance of class circle called c2. 10 | // Construct the instance c2 by invoking the second constructor 11 | // with the given radius and default color. 12 | Circle c2 = new Circle(2.0); 13 | // Invoke public methods on instance c2, via dot operator. 14 | System.out.println("The circle has radius of " 15 | + c2.getRadius() + " and circumference of " + c2.getCircumference()); 16 | //The circle has radius of 2.0 and circumference of 12.566370614359172 17 | 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /2023/08_OOP3/Player.java: -------------------------------------------------------------------------------- 1 | public class Player { 2 | private int number; 3 | private double x; 4 | private double y; 5 | private double z; 6 | 7 | // Constructors 8 | public Player(int number, double x, double y) { 9 | this.number = number; 10 | this.x = x; 11 | this.y = y; 12 | this.z = 0; // default value of z because people are on the floor 13 | } 14 | 15 | public Player(int number, double x, double y, double z) { 16 | this.number = number; 17 | this.x = x; 18 | this.y = y; 19 | this.z = z; 20 | } 21 | 22 | public void move(double xDisp, double yDisp) { 23 | this.x += xDisp; 24 | this.y += yDisp; 25 | } 26 | 27 | public void jump(double zDisp) { 28 | this.z += zDisp; 29 | } 30 | 31 | public boolean isNear(Ball ball) { 32 | // return true if distance between player and ball is less than 8 33 | return Math.sqrt(Math.pow(this.x - ball.getX(), 2) + Math.pow(this.y - ball.getY(), 2) + Math.pow(this.z - ball.getZ(), 2)) < 8; 34 | } 35 | 36 | public void kick(Ball ball) { 37 | if (isNear(ball)) { 38 | ball.setXYZ(this.x, this.y, this.z + 5); // kicks the ball up from where the player is 39 | } 40 | else { 41 | System.out.println("Player " + this.number + " is not near the ball"); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /2023/08_OOP3/README.md: -------------------------------------------------------------------------------- 1 | # 08_OOP2 (Overloading constructors, Class Design, Testing, Practice) 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1lJ_rRVgu4Cp08MRGUuXGCXtv6S2QSJh5LytmJhyI9x0/edit?usp=sharing) 4 | -------------------------------------------------------------------------------- /2023/09_OOP4/Lesson9.java: -------------------------------------------------------------------------------- 1 | // notice how you only import the Shooter class from the robot package because you only create objects of that class, not the AbstractRobot class 2 | import robot.Shooter; 3 | 4 | // notice how you import Car, Truck, and Vehicle from the vehicles package because you create objects of those classes 5 | import vehicles.Car; 6 | import vehicles.Truck; 7 | import vehicles.Vehicle; 8 | 9 | public class Lesson9 { 10 | public static void main(String[] args) { 11 | Vehicle[] vehicles = new Vehicle[5]; 12 | vehicles[0] = new Car(1000, "Toyota", 5, "Camry"); 13 | vehicles[1] = new Car(2000, "Honda", 5, "Civic"); 14 | vehicles[2] = new Car(3000, "Ford", 5, "Focus"); 15 | vehicles[3] = new Truck(4000, "Chevy", 2, "Bob"); 16 | vehicles[4] = new Truck(5000, "Dodge", 2, "Joe"); 17 | // a for-each loop, where you don't need to know the size of the array, and you don't need to use the index 18 | // (only use this when you don't need the index) 19 | for (Vehicle v : vehicles) { 20 | v.startEngine(); 21 | v.stopEngine(); 22 | } 23 | 24 | // Create an instance of the Shooter class 25 | Shooter shooter = new Shooter("TeamA", 123, 5.0, 45.0); 26 | // Access fields from the AbstractRobot (parent) class 27 | System.out.println("Team Name (AbstractRobot): " + shooter.getTeamName()); 28 | System.out.println("Team Number (AbstractRobot): " + shooter.getTeamNumber()); 29 | // Access fields from the Shooter (child) class 30 | System.out.println("Shooter Speed: " + shooter.getShooterSpeed()); 31 | System.out.println("Hood Angle: " + shooter.getHoodAngle()); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /2023/09_OOP4/README.md: -------------------------------------------------------------------------------- 1 | # 09_OOP4 (Inheritance, Abstract Classes, & Interfaces) 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1cMIgXtSWCv21Er0sVmTZEZq_hcxNpAj5tq31ISwTCwE/edit?usp=sharing) 4 | -------------------------------------------------------------------------------- /2023/09_OOP4/robot/AbstractRobot.java: -------------------------------------------------------------------------------- 1 | package robot; 2 | public abstract class AbstractRobot implements Robot { 3 | private String teamName; 4 | private int teamNumber; 5 | public AbstractRobot(String teamName, int teamNumber) { 6 | this.teamName = teamName; 7 | this.teamNumber = teamNumber; 8 | } 9 | // Implementing methods from the Robot interface 10 | public void setTeamName(String teamName) { 11 | this.teamName = teamName; 12 | } 13 | 14 | public void setTeamNumber(int teamNumber) { 15 | this.teamNumber = teamNumber; 16 | } 17 | 18 | public String getTeamName() { 19 | return teamName; 20 | } 21 | 22 | public int getTeamNumber() { 23 | return teamNumber; 24 | } 25 | } -------------------------------------------------------------------------------- /2023/09_OOP4/robot/Robot.java: -------------------------------------------------------------------------------- 1 | package robot; 2 | public interface Robot { 3 | void setTeamName(String teamName); 4 | void setTeamNumber(int teamNumber); 5 | String getTeamName(); 6 | int getTeamNumber(); 7 | } 8 | -------------------------------------------------------------------------------- /2023/09_OOP4/robot/Shooter.java: -------------------------------------------------------------------------------- 1 | package robot; 2 | public class Shooter extends AbstractRobot { 3 | private double shooterSpeed; 4 | private double hoodAngle; 5 | 6 | // Constructor for Shooter class 7 | public Shooter(String teamName, int teamNumber, double shooterSpeed, double hoodAngle) { 8 | super(teamName, teamNumber); 9 | this.shooterSpeed = shooterSpeed; 10 | this.hoodAngle = hoodAngle; 11 | } 12 | 13 | public double getShooterSpeed() { 14 | return shooterSpeed; 15 | } 16 | public void setShooterSpeed(double shooterSpeed) { 17 | this.shooterSpeed = shooterSpeed; 18 | } 19 | public double getHoodAngle() { 20 | return hoodAngle; 21 | } 22 | public void setHoodAngle(double hoodAngle) { 23 | this.hoodAngle = hoodAngle; 24 | } 25 | } -------------------------------------------------------------------------------- /2023/09_OOP4/vehicles/Car.java: -------------------------------------------------------------------------------- 1 | package vehicles; 2 | public class Car extends Vehicle { 3 | private String model; 4 | 5 | public Car(double weight, String manufacturer, int numOfSeats, String model) { 6 | super(weight, manufacturer, numOfSeats); 7 | this.model = model; 8 | } 9 | 10 | @Override 11 | public void startEngine() { 12 | System.out.println("Starting" + this.model + "'s engine"); 13 | } 14 | 15 | @Override 16 | public void stopEngine() { 17 | System.out.println("Stopping" + this.model + "'s engine"); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /2023/09_OOP4/vehicles/Truck.java: -------------------------------------------------------------------------------- 1 | package vehicles; 2 | public class Truck extends Vehicle{ 3 | private String driverName; 4 | 5 | public Truck(double weight, String manufacturer, int numOfSeats, String driverName) { 6 | super(weight, manufacturer, numOfSeats); 7 | this.driverName = driverName; 8 | } 9 | 10 | @Override 11 | public void startEngine() { 12 | System.out.println(this.driverName + " is starting the engine"); 13 | 14 | } 15 | 16 | @Override 17 | public void stopEngine() { 18 | System.out.println(this.driverName + " is stopping the engine"); 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /2023/09_OOP4/vehicles/Vehicle.java: -------------------------------------------------------------------------------- 1 | package vehicles; 2 | public abstract class Vehicle { 3 | double weight; 4 | String manufacturer; 5 | int numOfSeats; 6 | 7 | public Vehicle(double weight, String manufacturer, int numOfSeats) { 8 | this.weight = weight; 9 | this.manufacturer = manufacturer; 10 | this.numOfSeats = numOfSeats; 11 | } 12 | 13 | public abstract void startEngine(); 14 | public abstract void stopEngine(); 15 | } 16 | -------------------------------------------------------------------------------- /2023/10_MotorLabs/README.md: -------------------------------------------------------------------------------- 1 | # 10_MotorLabs 2 | 3 | 1. [MotorLabs Repository](https://github.com/StuyPulse/MotorLab) 4 | 2. [MotorLabs Guide] (https://docs.google.com/document/d/1jdfxj9Nu2IgoPEUOYdsv6O2Ke6_kR-LyUUz0fArGj8s/edit?usp=sharing) 5 | -------------------------------------------------------------------------------- /2023/11_Hardware/README.md: -------------------------------------------------------------------------------- 1 | # 011_Hardware 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1cnmhPE3-xi8YRSC8oA8Pke0P2aIj_9NcdZeX45N41jo/edit?usp=sharing) 4 | -------------------------------------------------------------------------------- /2023/11_Hardware/outtake/Outtake.java: -------------------------------------------------------------------------------- 1 | //copy pasted from our activities today, can be placed in Jim's subsystems folder to see work 2 | package com.stuypulse.robot.subsystems.outtake; 3 | import com.revrobotics.CANSparkMax; 4 | 5 | import edu.wpi.first.wpilibj.Encoder; 6 | import edu.wpi.first.wpilibj2.command.SubsystemBase; 7 | 8 | public class Outtake extends SubsystemBase { 9 | private CANSparkMax backMotor; 10 | 11 | private Encoder encoder; 12 | 13 | private double targetOuttakeSpeed; 14 | 15 | public Outtake() { 16 | backMotor = new CANSparkMax(1, CANSparkMax.MotorType.kBrushless); 17 | encoder = new Encoder(0, 1); 18 | targetOuttakeSpeed = 0.0; 19 | } 20 | 21 | public void setOutTakeSpeed(double outtakeSpeed) { 22 | backMotor.set(targetOuttakeSpeed); 23 | } 24 | 25 | public double getOuttakeSpeed() { 26 | return backMotor.get(); 27 | } 28 | 29 | public void setTargetOutTakeSpeed(double targetOutTakeSpeed) { 30 | this.targetOuttakeSpeed = targetOutTakeSpeed; 31 | } 32 | 33 | public double getTargetOutTakeSpeed() { 34 | return this.targetOuttakeSpeed; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /2023/12_Software/README.md: -------------------------------------------------------------------------------- 1 | # 012_Software 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1dQkCXAaVu_AuN7sJGxGd8MTfupEgaEHYKf0tJRP9kdo/edit?usp=sharing) 4 | 5 | 2. [ShooterLabs Repo](https://github.com/Keobkeig/ShooterLabs) -------------------------------------------------------------------------------- /2023/13_CommandsNShooterLabs/README.md: -------------------------------------------------------------------------------- 1 | # 013_CommandsNShooterLabs 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1cnmhPE3-xi8YRSC8oA8Pke0P2aIj_9NcdZeX45N41jo/edit?usp=sharing) 4 | 5 | 2.[ShooterLabs](https://github.com/Keobkeig/ShooterLabs) 6 | 7 | -------------------------------------------------------------------------------- /2023/14_AutonsNPaths/README.md: -------------------------------------------------------------------------------- 1 | # 014_AutonsNPaths 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1QyxyZjFxa22UC-z5IP72QkSpEEKNNV6eL5VHZjmEq8U/edit?usp=sharing) 4 | 5 | 6 | -------------------------------------------------------------------------------- /2023/15_ControlTheory/Controller.java: -------------------------------------------------------------------------------- 1 | public abstract class Controller { 2 | protected final double dt; 3 | 4 | 5 | public Controller() { 6 | this.dt = 0.02; 7 | } 8 | 9 | public Controller(double dt) { 10 | this.dt = dt; 11 | } 12 | 13 | public double getdt() { 14 | return dt; 15 | } 16 | 17 | public abstract double getOutput(double error); 18 | } 19 | -------------------------------------------------------------------------------- /2023/15_ControlTheory/FeedForwardController.java: -------------------------------------------------------------------------------- 1 | public class FeedForwardController extends Controller { 2 | private final double kV; 3 | private final double kA; 4 | private final double kS; 5 | 6 | public FeedForwardController(double kV, double kA, double kS) { 7 | super(); 8 | this.kV = kV; 9 | this.kA = kA; 10 | this.kS = kS; 11 | } 12 | 13 | //getters for constants 14 | public double getkV() { 15 | return kV; 16 | } 17 | public double getkA() { 18 | return kA; 19 | } 20 | public double getkS() { 21 | return kS; 22 | } 23 | 24 | //you don't make setters for constants because you don't want them to change 25 | 26 | //FeedForward controller's getOutput methods (notice how there are two because sometimes you don't have acceleration) 27 | public double getOutput(double velocity, double acceleration) { 28 | return kV * velocity + kA * acceleration + kS; 29 | } 30 | 31 | @Override 32 | public double getOutput(double velocity) { 33 | return getOutput(velocity, getAcceleration(velocity)); 34 | } 35 | 36 | //getAcceleration using the slope of the line between the current velocity and the previous velocity 37 | public double getAcceleration(double velocity) { 38 | return velocity / dt; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /2023/15_ControlTheory/PIDController.java: -------------------------------------------------------------------------------- 1 | public class PIDController extends Controller { 2 | //PID constants 3 | private final double kP; 4 | private final double kI; 5 | private final double kD; 6 | 7 | public PIDController(double kP, double kI, double kD) { 8 | super(); 9 | this.kP = kP; 10 | this.kI = kI; 11 | this.kD = kD; 12 | } 13 | 14 | //getters for PID constants 15 | public double getkP() { 16 | return kP; 17 | } 18 | public double getkI() { 19 | return kI; 20 | } 21 | public double getkD() { 22 | return kD; 23 | } 24 | 25 | //you don't make setters for PID constants because you don't want them to change 26 | 27 | //PID controller's getOutput method 28 | @Override 29 | public double getOutput(double error) { 30 | double p = kP * error; 31 | double i = kI * integral(error); 32 | double d = kD * deriviative(error); 33 | return p + i + d; 34 | } 35 | 36 | //integral will basically find the sum of all the errors over time (area under the curve), which I simplified to error * dt 37 | public double integral(double error) { 38 | return error * this.dt; 39 | } 40 | 41 | //deriviative will find the slope of the line between the current error and the previous error, which I simplified to error / dt 42 | public double deriviative(double error) { 43 | return error / this.dt; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /2023/15_ControlTheory/README.md: -------------------------------------------------------------------------------- 1 | # 015_ControlTheory 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1lfFCCr7bFWtfK-sj8w2-Ha-2HndvZV4agL8kuTOkOu4/edit?usp=sharing) 4 | 5 | 6 | -------------------------------------------------------------------------------- /2023/16_StuyLib/README.md: -------------------------------------------------------------------------------- 1 | # 016_StuyLib 2 | 3 | 1. [Lesson Slides](https://docs.google.com/presentation/d/1PoTOk4YtT_wzjZqerYkeOPjsGDaksVxvHPyO_uAKxlU/edit?usp=sharing) 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 StuyPulse 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # newbie-ed 2 | 3 | This is a permenent repo for all things related to newbie ed. 4 | 5 | Years are by the season's competition year, rather than the current year. 6 | 7 | I made this change to screw w pak. 8 | 9 | These are charges for impeachment - Pak 10 | --------------------------------------------------------------------------------