Day01 - code restructure

This commit is contained in:
2024-12-09 01:35:23 +01:00
parent 2cda847908
commit e6fdf88f0d
3 changed files with 5 additions and 2 deletions

View File

@@ -11,8 +11,7 @@ func main() {
fmt.Printf("|| AdventOfCode 2024 - Day %02d ||\n", DAY) fmt.Printf("|| AdventOfCode 2024 - Day %02d ||\n", DAY)
fmt.Println("||++++++++++++++++++++++++++++||\n") fmt.Println("||++++++++++++++++++++++++++++||\n")
fmt.Println("Original Code")
original() original()
fmt.Println("\nOptimized Code by ChatGPT") fmt.Println()
optimized() optimized()
} }

View File

@@ -9,6 +9,8 @@ import (
) )
func optimized() { func optimized() {
fmt.Println("Optimized Code by ChatGPT")
// Read the file in one step // Read the file in one step
content, err := os.ReadFile("./input.json") content, err := os.ReadFile("./input.json")
if err != nil { if err != nil {

View File

@@ -9,6 +9,8 @@ import (
) )
func original() { func original() {
fmt.Println("Original Code")
content, err := ioutil.ReadFile("./input.json") content, err := ioutil.ReadFile("./input.json")
if err != nil { if err != nil {
log.Fatal("Error when opening input.json: ", err) log.Fatal("Error when opening input.json: ", err)