diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6b3783a --- /dev/null +++ b/LICENSE @@ -0,0 +1,11 @@ +Copyright (c) 2023 Zakary Timson + +All Rights Reserved. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.md b/README.md index bbb82f8..186b29a 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,87 @@ -# Waterloo 2014 -In 2014, while I was in grade 12, I competed in Waterloo's senior programing cometition. + +
+
-These promgrams correspond to the problems found inside [Waterloo-2014.pdf](./Waterloo-2014.pdf). + + Logo + + + ### Waterloo-2014 + + + Simple repository template + + + [![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/waterloo-2014/tags&query=$[0].name)](https://git.zakscode.com/ztimson/waterloo-2014/tags) + [![Pull Requests](https://img.shields.io/badge/dynamic/json.svg?label=Pull%20Requests&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/waterloo-2014&query=open_pr_counter)](https://git.zakscode.com/ztimson/waterloo-2014/pulls) + [![Issues](https://img.shields.io/badge/dynamic/json.svg?label=Issues&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/waterloo-2014&query=open_issues_count)](https://git.zakscode.com/ztimson/waterloo-2014/issues) + + + + --- +
+ Release Notes + • Report a Bug + • Request a Feature +
+ + --- +
## Table of Contents -[[_TOC_]] +- [Waterloo-2014](#top) + - [About](#about) + - [Built With](#built-with) + - [Setup](#setup) + - [Development](#development) + - [License](#license) -## Rules: - - 3 hours to complete as many problems as possible; only completed programs count - - Only writen resorces are allowed to be brought in and used (No internet/search engine) - - Every file must use file input and standard output (Names correspond (S1.java < S1.txt)) - - Some programs are rated on efficency +## About -## Results - - 1st place in local area, doubling 2nd place's score - - S1 completed every test & recieved full marks (40 points) - - S2 completed every test & recieved full marks (40 points) - - S3 only halfed worked (15 points), I rushed to move onto S4 - - S4 didn't have time to complete +In 2014 I competed in Waterloo's senior programing cometition. + +These programs correspond to the problems found inside [Waterloo-2014.pdf](./Waterloo-2014.pdf). + +#### Rules: +- 3 hours to complete as many problems as possible; only completed programs count +- Only writen resorces are allowed to be brought in and used (No internet/search engine) +- Every file must use file input and standard output (Names correspond (src.S1.java < src.S1.txt)) +- Some programs are rated on efficency + +#### Results +- 1st place in local area, doubling 2nd place's score +- src.S1 completed every test & recieved full marks (40 points) +- src.S2 completed every test & recieved full marks (40 points) +- src.S3 only halfed worked (15 points), I rushed to move onto src.S4 +- src.S4 didn't have time to complete In hindsight, knowing I only needed to pass 3 problems to advance to nationals, I should have focused on the 3 easiest problems & ensured they all worked instead of rushing through all of the problems & ending up with two half-complete. + +### Built With +[![Java](https://img.shields.io/badge/Java-5382A1?style=for-the-badge&logo=coffeescript&logoColor=F8981D)](https://java.com/) + +## Setup + +
+ +

+ Development +

+
+ +#### Prerequisites +- [Java SDK](https://www.oracle.com/ca-en/java/technologies/downloads) + +#### Instructions +1. Compile & run each program: + - `javac src/S1.java && java src/S1 << data/S1.txt` + - `javac src/S2.java && java src/S2 << data/S2.txt` + - `javac src/S3.java && java src/S3 << data/S3.txt` + - `javac src/S4.java && java src/S4 << data/S4.txt` + +
+ +## License +Copyright © 2023 Zakary Timson | All Rights Reserved + +See the [license](./LICENSE) for more information. diff --git a/Tint.java b/Tint.java deleted file mode 100644 index 69d21fc..0000000 --- a/Tint.java +++ /dev/null @@ -1,31 +0,0 @@ -// Class -public class Tint { - - // Fields - double x1, x2, y1, y2; - int tint; - - // Constructor - public Tint(int x1, int y1, int x2, int y2, int tint) { - this.x1 = x1; - this.x2 = x2; - this.y1 = y1; - this.y2 = y2; - this.tint = tint; - } - - // helper to see if coordinate is within bounds of object - public boolean within(double x, double y) { - boolean flag = false; - - if (x > this.x1 && x < this.x2 && y > this.y1 && y < this.y2) - flag = true; - - return flag; - } - - // Accessor - public int getTint() { - return this.tint; - } -} diff --git a/S1.txt b/data/S1.txt similarity index 100% rename from S1.txt rename to data/S1.txt diff --git a/S2.txt b/data/S2.txt similarity index 100% rename from S2.txt rename to data/S2.txt diff --git a/S3.txt b/data/S3.txt similarity index 100% rename from S3.txt rename to data/S3.txt diff --git a/S4.txt b/data/S4.txt similarity index 100% rename from S4.txt rename to data/S4.txt diff --git a/S1.java b/src/S1.java similarity index 97% rename from S1.java rename to src/S1.java index b9f649a..ed02163 100644 --- a/S1.java +++ b/src/S1.java @@ -1,4 +1,4 @@ -// Zak Timson +package src;// Zak Timson // Libraries import java.io.File; @@ -17,7 +17,7 @@ public class S1 { // A dynamic array might be nice ArrayList list = new ArrayList(); - // Import dummy data from S1.txt + // Import dummy data from src.S1.txt final String dir = new File(" ").getAbsolutePath().trim(); FileReader fr = new FileReader(dir + "S1.txt"); Scanner scan = new Scanner(fr); @@ -40,12 +40,12 @@ public class S1 { for (int i = 0; i < m; i++) { // Remember the size of the dynamic array during this pass int size = list.size(); - + // Instead of looping through and testing each number in the array // some preliminary math can determine the exact number of passes // needed to increase the efficiency. for (int x = 0; x < size / remove[i]; x++) { - + /* This next part is where a quarter of the competition went well * I over thought how to solve this bug. Because I am removing, * lets say person 5 and 10, as soon as I remove person 5 person 10 diff --git a/S2.java b/src/S2.java similarity index 98% rename from S2.java rename to src/S2.java index 4f80ef6..3e58adc 100644 --- a/S2.java +++ b/src/S2.java @@ -1,4 +1,4 @@ -// Zak Timson +package src;// Zak Timson // Libraries import java.io.File; @@ -11,7 +11,7 @@ public class S2 { // Main method public static void main(String[] args) throws FileNotFoundException { - + // Load in dummy data from file final String dir = new File(" ").getAbsolutePath().trim(); FileReader fr = new FileReader(dir + "S2.txt"); @@ -19,11 +19,11 @@ public class S2 { // Get the number of names (never used this information) String n = scan.nextLine(); - + // Get the names from file and split the line into an array by white space String names1 = scan.nextLine(); String[] nameSet1 = names1.split(" "); - + // Same as above for second set of names. String names2 = scan.nextLine(); String[] nameSet2 = names2.split(" "); diff --git a/S3.java b/src/S3.java similarity index 98% rename from S3.java rename to src/S3.java index 7bfc9b1..c4faa9c 100644 --- a/S3.java +++ b/src/S3.java @@ -1,4 +1,4 @@ -// Zak Timson +package src;// Zak Timson // Libraries import java.io.File; @@ -12,7 +12,7 @@ public class S3 { // Main method public static void main(String[] args) throws FileNotFoundException { - + // Load dummy data final String dir = new File(" ").getAbsolutePath().trim(); FileReader fr = new FileReader(dir + "S3.txt"); diff --git a/S4.java b/src/S4.java similarity index 98% rename from S4.java rename to src/S4.java index ce1f0e3..b12c71e 100644 --- a/S4.java +++ b/src/S4.java @@ -1,4 +1,4 @@ -// Zak Timson +package src;// Zak Timson // Uses Tint.java (Object) /* I didn't finish this program because I got stuck up on the first program trying to fix a bug so I ran out of time. @@ -21,7 +21,7 @@ public class S4 { // Main method public static void main(String[] args) throws FileNotFoundException { - + // Load dummy data final String dir = new File(" ").getAbsolutePath().trim(); FileReader fr = new FileReader(dir + "S4.txt"); @@ -45,7 +45,7 @@ public class S4 { Integer.parseInt(stats[1]), Integer.parseInt(stats[2]), Integer.parseInt(stats[3]), Integer.parseInt(stats[4])); } - + // Loop through coordinates for (int x = 0; x < 1000000000; x++){ // X coordinate int totalTint = 0; // Reset the total tint on this coordinate