---
# System prepended metadata

title: Preparation for the Competition

---


# Part A: Installation Guide 
---

## Software Prerequisites

### Step 1: Install JDK 1.8 or Above

- Visit the Azul website: [Azul Downloads]
https://www.azul.com/downloads/?version=java-17-lts&package=jdk#zulu
- Download the JDK version 1.8 or above based on your operating system.
- Download and install it (as of 22-Jun, version up to 17.42.19). Follow the steps to complete the installation.
- **Apple chip**, go for **ARM 64-bit**
- **Intel chip**, go for **86 64-bit**
![](https://hackmd.io/_uploads/ByFFrakFn.png)

#### [Result check]
- Check the default java_home on Mac
```
 echo export "JAVA_HOME=\$(/usr/libexec/java_home)" >> ~/.zshrc 
```

```
/usr/libexec/java_home -V
```
![](https://hackmd.io/_uploads/r1Y9r6kY3.png)

- Setup environment variable for JAVA_HOME in ==.zshrc== in Home directory.
```
export JAVA_HOME=$(/usr/libexec/java_home)
```
![](https://hackmd.io/_uploads/HJijrakKh.png)

#### [result check]
- Check $JAVA_HOME, it should return the installed JDK
```
echo $JAVA_HOME
```
![](https://hackmd.io/_uploads/SyThBTkFn.png)

- Check Java Version
```
java --version
```
![](https://hackmd.io/_uploads/rkKTSaytn.png)

---
---

### Step 2: Install Maven with JAVA_HOME
- Approach 1
    - Visit the Apache Maven website: [Apache Maven Download]
https://maven.apache.org/download.cgi
    - Download the latest stable release of Maven.
    - Extract the downloaded archive to a preferred location on your laptop.
- Approach 2
    - `brew install maven`

#### [Result Check]
- Check maven version
  - "Java version" should be the current java version
  - "Runtime path" should be same as java_home
  - Maven home should be in opt/homebrew/.., as you install maven by brew
```
mvn -v
```
![](https://hackmd.io/_uploads/r1J4OayK3.png)

---
---

### Step 3: Install an IDE for Coding Competition

Choose one of the following IDEs: VSCode, IntelliJ, Eclipse.

#### For VSCode:

- Visit the VSCode website: [Visual Studio Code]
https://code.visualstudio.com/
- Download and install VSCode.
- Install relevant extensions for Java development.
    - ==Language Support for Java(TM) by Red Hat==
    - ==Extension Pack for Java (Install this, the other 4 Java== extensions will be installed automatically)
    - ==Maven for Java==
    - ==Debugger for Java==
    - ==Project Manager for Java==
    - ==Test Runner for Java==
#### For IntelliJ:

- Visit the IntelliJ IDEA website: [IntelliJ IDEA]
https://www.jetbrains.com/idea/
- Download and install IntelliJ IDEA.
- Configure the JDK in IntelliJ.

#### For Eclipse:

- Visit the Eclipse website: [Eclipse IDE]
https://www.eclipse.org/downloads/
- Download and install Eclipse IDE for Java Developers.
- Configure the JDK in Eclipse.

---
---

### Step 4: Set Up a GitHub Account with SSH

- Create a GitHub account: [GitHub]
https://github.com/
- Follow the instructions to set up SSH keys: [GitHub SSH Key Setup]
https://docs.github.com/en/authentication/connecting-to-github-with-ssh
1. Open Terminal
2. Generate SSH key (by ed25519)
```
# Type this command to generate ssh key in your laptop ~/.ssh
ssh-keygen -t ed25519 -C "your_email@example.com"
```
3. ==[Just Enter]== Prompted to "Enter a file in which to save the key," **press Enter**. Accept default location.
```
# Sample
> Enter a file in which to save the key 
(/Users/you/.ssh/id_algorithm): [Press enter]
```
4. [Just Enter] At the prompt, ask for a secure passphrase. Suggest to **press "enter" to skip.**
```
# Sample
> Enter passphrase (empty for no passphrase): [Type a passphrase]
> Enter same passphrase again: [Type passphrase again]
```
### [Result Check]
![](https://hackmd.io/_uploads/rkheP61F3.png)

## 7.4 Insert ssh key to Github a/c
1. Login your github account
2. Click the icon at the right top corner, Go to **Settings**.
![](https://hackmd.io/_uploads/By0bD6yFh.png)

3. Go to **SSH and GPG keys**, and press N**ew SSH key
![](https://hackmd.io/_uploads/rJQfPpkth.png)

4. Place the whole content of **==id_ed25519.pub==(public key)** to "Key" section shown below. (By Using ==VsCode==)

5. For title, simply put your email address.
![](https://hackmd.io/_uploads/SJaTvp1Yh.png)

### [Result Check]
After adding the ssh key, you can download the github repository by ==git clone== using ==SSH== (You will use it in later installation part).
![](https://hackmd.io/_uploads/SJmyu6kY2.png)

## 7.5 Git Config
```
- Execute the following commands in Terminal.
# set your name when using git
git config --global user.name =="your name"==
```
```
# set your email address when using git
git config --global user.email ==your_email@example.com==
```
```
# default branch name when using git (set to main)
git config --global init.defaultBranch main
```
```
# Set pager off for git branch
git config --global pager.branch false
```
```
# set pager off for git diff
git config --global pager.diff false
```
![](https://hackmd.io/_uploads/BJ8bupyFh.png)
---
---
## Simulated Competition Question

### Install Git
```
brew install git
```
#### [Result Check]
- "where git" to check what git versions are installed. There are 2 git versions installed below, /usr/bin/git is the apple-git where "/opt/homebrew/..." is the one you installed by brew.
- "which git" to check which git version you are currently using.
```
git --version
```
![](https://hackmd.io/_uploads/H1Ew8aJFh.png)

---
# Part B: Simulation Guide

### Step 1: Git Clone, Add, Commit, Push

- Open a terminal or command prompt.
- Navigate to the directory where you want to clone the repository.
- Run the following commands:

  ```bash
  git clone <repository_url>
  ```
  ```bash
  cd <repository_directory>
  ```

- Make changes to the code in the feature branch.
- Run the following commands to stage, commit, and push changes:

  ```bash
  git add .
  ```
  ```bash
  git commit -m "Your commit message"
  ```
  ```bash
  git push origin <feature_branch>
  ```

### Step 2: Maven Commands

- Open a terminal or command prompt.
- Navigate to the root directory of your project.
- Run the following Maven commands:

  ```bash
  mvn clean compile
  ```
  ```bash
  mvn clean test
  ```

---
# Step to git clone 
![step1](https://hackmd.io/_uploads/SJAzOyF_T.png)

![git_clone](https://hackmd.io/_uploads/BJZQdyK_T.png)

---

### 全部Testcase通過

![testCasePass2](https://hackmd.io/_uploads/SJQ00k4ua.png)

---

![testCasePass](https://hackmd.io/_uploads/Bydr6kEu6.png)

---

### Testcase Fail

![testCaseFail2](https://hackmd.io/_uploads/H1h0Rk4uT.png)

---
![testCaseFail](https://hackmd.io/_uploads/SykIpyEO6.png)
