126 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Svelte
		
	
			
		
		
	
	
			126 lines
		
	
	
		
			4.0 KiB
		
	
	
	
		
			Svelte
		
	
<script lang="ts">
 | 
						|
	import SvelteMarkdown from 'svelte-markdown';
 | 
						|
 | 
						|
	const about = `
 | 
						|
### About 
 | 
						|
 | 
						|
CodeQuest is a programming contest that was designed and created as a CAS
 | 
						|
project. The project was primarily created by [Hamza
 | 
						|
Ali](https://github.com/hhhapz), Smriti Srinivasan, Iona Campbell and Aaliyah
 | 
						|
Aman. The development of this website and the design of the puzzles was done
 | 
						|
by Hamza Ali.
 | 
						|
 | 
						|
**CodeQuest** is designed to be a programming competition that is approachable
 | 
						|
by all programmers. The puzzles are designed to be able to be solved using
 | 
						|
any programming language you like, and can use any method you wish. The first
 | 
						|
two problems designed for this competition were able to be solved without any
 | 
						|
programming at all, just using excel spreadsheets and WolframAlpha.
 | 
						|
 | 
						|
This contest was heavily inspired by the [Advent of
 | 
						|
Code](https://adventofcode.com), a competition I have been participating in
 | 
						|
yearly since 2017. I hope to be able to continue the ethos and the passion for
 | 
						|
programming that the advent of code gave me through this competition.
 | 
						|
 | 
						|
If you have any questions, feel free to reach out at hello@<this website's
 | 
						|
domain>.
 | 
						|
 | 
						|
### How Do I Begin?
 | 
						|
 | 
						|
If you are looking at the calendar, and can see that the current time is after
 | 
						|
the 29th of April 2022, that most likely means that the official competition is
 | 
						|
already over, and you will not be able to participate for prizes.
 | 
						|
 | 
						|
However, if you register an account, you should still be able to see all of the
 | 
						|
puzzles as well as try to solve them. Each puzzle is split into 2 different
 | 
						|
parts, the first part is generally a simpler version of the second.
 | 
						|
 | 
						|
Once you solve a puzzle, you simply need to submit the final answer. Your code
 | 
						|
nor the method you took to get the answer are checked, however each user gets a
 | 
						|
unique input and the answer they will obtain is specific to them.
 | 
						|
 | 
						|
### General Tips and Advice
 | 
						|
 | 
						|
#### I'm stuck - what do I do?
 | 
						|
 | 
						|
Each puzzle will come with at least one example. Does your answer for the
 | 
						|
example input match? Make sure you fully understand what the puzzle is asking.
 | 
						|
One common mistake is that while copying the input, some of it is left over.
 | 
						|
Double check you have the full input.
 | 
						|
 | 
						|
Try building your own examples and solving them, see if your program does as
 | 
						|
you expected. If you're still having difficulties, try solving a different
 | 
						|
problem and circling back.
 | 
						|
 | 
						|
If you still have difficulties and the contest is finished, try asking a friend
 | 
						|
for assistance, see if they can help you understand what's going on.
 | 
						|
 | 
						|
#### I'm programming in Java, how do I read the user input in my program?
 | 
						|
 | 
						|
Unlike in other programming languages, where you have strings with new lines in
 | 
						|
them, Java makes that a little bit more difficult to do.
 | 
						|
 | 
						|
For example, in Python you can do:
 | 
						|
 | 
						|
\`\`\`py
 | 
						|
input = """this is
 | 
						|
a multi line
 | 
						|
string literal"""
 | 
						|
\`\`\`
 | 
						|
 | 
						|
and in JavaScript, you can do: 
 | 
						|
 | 
						|
\`\`\`
 | 
						|
const input = \`this is
 | 
						|
a multi line
 | 
						|
string literal\`
 | 
						|
\`\`\`
 | 
						|
 | 
						|
In Java you have two options:
 | 
						|
 | 
						|
1. Keep reading from your Scanner until you reach an empty line.
 | 
						|
2. Read input from a file
 | 
						|
 | 
						|
(These solutions will work in other languages too!).
 | 
						|
 | 
						|
Here is an example for the first option:
 | 
						|
 | 
						|
\`\`\`
 | 
						|
Scanner sc = new Scanner(System.in);
 | 
						|
 | 
						|
/* either */
 | 
						|
String input = "";
 | 
						|
while(true) {
 | 
						|
  String line = sc.nextLine(); // Get the next line of user input.
 | 
						|
  if (line.equals("") { // If the line is empty, we have read everything.
 | 
						|
    break; // Jump out of the while loop.
 | 
						|
  }
 | 
						|
  input += line + "\n"; // If not, add the input line to the input string.
 | 
						|
}
 | 
						|
\`\`\`
 | 
						|
 | 
						|
or
 | 
						|
 | 
						|
\`\`\`
 | 
						|
Scanner sc = new Scanner(System.in);
 | 
						|
ArrayList<String> input = new ArrayList<>();
 | 
						|
while(true) {
 | 
						|
  String line = sc.nextLine(); // Get the next line of user input.
 | 
						|
  if (line.equals("") { // If the line is empty, we have read everything.
 | 
						|
    break; // Jump out of the while loop.
 | 
						|
  }
 | 
						|
  input.add(line); // If not, add the line to the input array list.
 | 
						|
}
 | 
						|
\`\`\`
 | 
						|
`;
 | 
						|
</script>
 | 
						|
 | 
						|
<svelte:head>
 | 
						|
	<title>CodeQuest</title>
 | 
						|
</svelte:head>
 | 
						|
 | 
						|
<main class="min-h-screen">
 | 
						|
	<section class="mx-auto py-[7vw] prose prose-lg">
 | 
						|
		<SvelteMarkdown source={about} />
 | 
						|
	</section>
 | 
						|
</main>
 |