Updated documentation
This commit is contained in:
parent
efc2c55e21
commit
646027ee1d
11
LICENSE
Normal file
11
LICENSE
Normal file
@ -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.
|
95
README.md
95
README.md
@ -1,22 +1,87 @@
|
|||||||
# Waterloo 2014
|
<!-- Header -->
|
||||||
In 2014, while I was in grade 12, I competed in Waterloo's senior programing cometition.
|
<div id="top" align="center">
|
||||||
|
<br />
|
||||||
|
|
||||||
These promgrams correspond to the problems found inside [Waterloo-2014.pdf](./Waterloo-2014.pdf).
|
<!-- Logo -->
|
||||||
|
<img src="https://git.zakscode.com/repo-avatars/2b4ee6ba1f2e2618bf7694e4a52fb56d1d0ea6abafa2dcbe496ab786b86d5a76" alt="Logo" width="200" height="200">
|
||||||
|
|
||||||
|
<!-- Title -->
|
||||||
|
### Waterloo-2014
|
||||||
|
|
||||||
|
<!-- Description -->
|
||||||
|
Simple repository template
|
||||||
|
|
||||||
|
<!-- Repo badges -->
|
||||||
|
[![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)
|
||||||
|
|
||||||
|
<!-- Links -->
|
||||||
|
|
||||||
|
---
|
||||||
|
<div>
|
||||||
|
<a href="https://git.zakscode.com/ztimson/waterloo-2014/releases" target="_blank">Release Notes</a>
|
||||||
|
• <a href="https://git.zakscode.com/ztimson/waterloo-2014/issues/new?template=.github%2fissue_template%2fbug.md" target="_blank">Report a Bug</a>
|
||||||
|
• <a href="https://git.zakscode.com/ztimson/waterloo-2014/issues/new?template=.github%2fissue_template%2fenhancement.md" target="_blank">Request a Feature</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
---
|
||||||
|
</div>
|
||||||
|
|
||||||
## Table of Contents
|
## Table of Contents
|
||||||
[[_TOC_]]
|
- [Waterloo-2014](#top)
|
||||||
|
- [About](#about)
|
||||||
|
- [Built With](#built-with)
|
||||||
|
- [Setup](#setup)
|
||||||
|
- [Development](#development)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
## Rules:
|
## About
|
||||||
- 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
|
|
||||||
|
|
||||||
## Results
|
In 2014 I competed in Waterloo's senior programing cometition.
|
||||||
- 1st place in local area, doubling 2nd place's score
|
|
||||||
- S1 completed every test & recieved full marks (40 points)
|
These programs correspond to the problems found inside [Waterloo-2014.pdf](./Waterloo-2014.pdf).
|
||||||
- S2 completed every test & recieved full marks (40 points)
|
|
||||||
- S3 only halfed worked (15 points), I rushed to move onto S4
|
#### Rules:
|
||||||
- S4 didn't have time to complete
|
- 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.
|
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
|
||||||
|
|
||||||
|
<details>
|
||||||
|
<summary>
|
||||||
|
<h3 id="development" style="display: inline">
|
||||||
|
Development
|
||||||
|
</h3>
|
||||||
|
</summary>
|
||||||
|
|
||||||
|
#### 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`
|
||||||
|
|
||||||
|
</details>
|
||||||
|
|
||||||
|
## License
|
||||||
|
Copyright © 2023 Zakary Timson | All Rights Reserved
|
||||||
|
|
||||||
|
See the [license](./LICENSE) for more information.
|
||||||
|
31
Tint.java
31
Tint.java
@ -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;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +1,4 @@
|
|||||||
// Zak Timson
|
package src;// Zak Timson
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -17,7 +17,7 @@ public class S1 {
|
|||||||
// A dynamic array might be nice
|
// A dynamic array might be nice
|
||||||
ArrayList list = new ArrayList();
|
ArrayList list = new ArrayList();
|
||||||
|
|
||||||
// Import dummy data from S1.txt
|
// Import dummy data from src.S1.txt
|
||||||
final String dir = new File(" ").getAbsolutePath().trim();
|
final String dir = new File(" ").getAbsolutePath().trim();
|
||||||
FileReader fr = new FileReader(dir + "S1.txt");
|
FileReader fr = new FileReader(dir + "S1.txt");
|
||||||
Scanner scan = new Scanner(fr);
|
Scanner scan = new Scanner(fr);
|
||||||
@ -40,12 +40,12 @@ public class S1 {
|
|||||||
for (int i = 0; i < m; i++) {
|
for (int i = 0; i < m; i++) {
|
||||||
// Remember the size of the dynamic array during this pass
|
// Remember the size of the dynamic array during this pass
|
||||||
int size = list.size();
|
int size = list.size();
|
||||||
|
|
||||||
// Instead of looping through and testing each number in the array
|
// Instead of looping through and testing each number in the array
|
||||||
// some preliminary math can determine the exact number of passes
|
// some preliminary math can determine the exact number of passes
|
||||||
// needed to increase the efficiency.
|
// needed to increase the efficiency.
|
||||||
for (int x = 0; x < size / remove[i]; x++) {
|
for (int x = 0; x < size / remove[i]; x++) {
|
||||||
|
|
||||||
/* This next part is where a quarter of the competition went well
|
/* This next part is where a quarter of the competition went well
|
||||||
* I over thought how to solve this bug. Because I am removing,
|
* 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
|
* lets say person 5 and 10, as soon as I remove person 5 person 10
|
@ -1,4 +1,4 @@
|
|||||||
// Zak Timson
|
package src;// Zak Timson
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -11,7 +11,7 @@ public class S2 {
|
|||||||
|
|
||||||
// Main method
|
// Main method
|
||||||
public static void main(String[] args) throws FileNotFoundException {
|
public static void main(String[] args) throws FileNotFoundException {
|
||||||
|
|
||||||
// Load in dummy data from file
|
// Load in dummy data from file
|
||||||
final String dir = new File(" ").getAbsolutePath().trim();
|
final String dir = new File(" ").getAbsolutePath().trim();
|
||||||
FileReader fr = new FileReader(dir + "S2.txt");
|
FileReader fr = new FileReader(dir + "S2.txt");
|
||||||
@ -19,11 +19,11 @@ public class S2 {
|
|||||||
|
|
||||||
// Get the number of names (never used this information)
|
// Get the number of names (never used this information)
|
||||||
String n = scan.nextLine();
|
String n = scan.nextLine();
|
||||||
|
|
||||||
// Get the names from file and split the line into an array by white space
|
// Get the names from file and split the line into an array by white space
|
||||||
String names1 = scan.nextLine();
|
String names1 = scan.nextLine();
|
||||||
String[] nameSet1 = names1.split(" ");
|
String[] nameSet1 = names1.split(" ");
|
||||||
|
|
||||||
// Same as above for second set of names.
|
// Same as above for second set of names.
|
||||||
String names2 = scan.nextLine();
|
String names2 = scan.nextLine();
|
||||||
String[] nameSet2 = names2.split(" ");
|
String[] nameSet2 = names2.split(" ");
|
@ -1,4 +1,4 @@
|
|||||||
// Zak Timson
|
package src;// Zak Timson
|
||||||
|
|
||||||
// Libraries
|
// Libraries
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -12,7 +12,7 @@ public class S3 {
|
|||||||
|
|
||||||
// Main method
|
// Main method
|
||||||
public static void main(String[] args) throws FileNotFoundException {
|
public static void main(String[] args) throws FileNotFoundException {
|
||||||
|
|
||||||
// Load dummy data
|
// Load dummy data
|
||||||
final String dir = new File(" ").getAbsolutePath().trim();
|
final String dir = new File(" ").getAbsolutePath().trim();
|
||||||
FileReader fr = new FileReader(dir + "S3.txt");
|
FileReader fr = new FileReader(dir + "S3.txt");
|
@ -1,4 +1,4 @@
|
|||||||
// Zak Timson
|
package src;// Zak Timson
|
||||||
// Uses Tint.java (Object)
|
// 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.
|
/* 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
|
// Main method
|
||||||
public static void main(String[] args) throws FileNotFoundException {
|
public static void main(String[] args) throws FileNotFoundException {
|
||||||
|
|
||||||
// Load dummy data
|
// Load dummy data
|
||||||
final String dir = new File(" ").getAbsolutePath().trim();
|
final String dir = new File(" ").getAbsolutePath().trim();
|
||||||
FileReader fr = new FileReader(dir + "S4.txt");
|
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[1]), Integer.parseInt(stats[2]),
|
||||||
Integer.parseInt(stats[3]), Integer.parseInt(stats[4]));
|
Integer.parseInt(stats[3]), Integer.parseInt(stats[4]));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop through coordinates
|
// Loop through coordinates
|
||||||
for (int x = 0; x < 1000000000; x++){ // X coordinate
|
for (int x = 0; x < 1000000000; x++){ // X coordinate
|
||||||
int totalTint = 0; // Reset the total tint on this coordinate
|
int totalTint = 0; // Reset the total tint on this coordinate
|
Loading…
Reference in New Issue
Block a user