2nd commit

This commit is contained in:
Araozu 2023-10-31 06:22:09 -05:00
parent 8bda4fa726
commit abc35536e4
4 changed files with 13 additions and 22 deletions

1
.gitignore vendored
View File

@ -14,6 +14,7 @@ project/local-plugins.sbt
.ensime_cache/ .ensime_cache/
.sbt-scripted/ .sbt-scripted/
local.sbt local.sbt
inputs
# Bloop # Bloop
.bsp .bsp

View File

@ -0,0 +1,6 @@
object Day01 extends Solution:
override def part_01() =
"part 1 :D"
override def part_02() =
"part 2 :O"

View File

@ -3,27 +3,7 @@ import scala.util.Random
// Number guessing game // Number guessing game
@main def hello: Unit = @main def hello: Unit =
val right_answer = Random().nextInt(101) println("Advent of code 2022 with Scala")
var attempts = 0 println(Day01.part_01())
println(s"Hello, you have <unlimited> attempts")
while true do
attempts += 1
print("Enter a number: ")
readLine().toIntOption match
case Some(n) if n == right_answer =>
println(s"yeh, the number was $n. you win. you took $attempts attempts")
return
case Some(n) if n > right_answer =>
println("you too high mah man")
case Some(n) if n < right_answer =>
println("a litte too low mate")
case Some(_) =>
println("??? why are you even seeing this message???")
case None =>
println("that ain't a numbah. you wasted an attempt!")
println(s"you outta attemps. you lost. the numbah was $right_answer btw")
println("kthxbye")

View File

@ -0,0 +1,4 @@
trait Solution:
def part_01(): String
def part_02(): String