-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Day 23 | Part 1 - Refactored IntCodeComputer onNextBoot Functionality…
… (Accepts NetworkAddress)
- Loading branch information
Showing
9 changed files
with
101 additions
and
55 deletions.
There are no files selected for viewing
8 changes: 0 additions & 8 deletions
8
implementation/src/main/kotlin/com/aoc/intcode/computer/BootMode.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
implementation/src/main/kotlin/com/aoc/intcode/computer/boot/BootMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.aoc.intcode.computer.boot | ||
|
||
interface BootMode { | ||
fun getCode(): Long | ||
} |
22 changes: 22 additions & 0 deletions
22
implementation/src/main/kotlin/com/aoc/intcode/computer/boot/TestBootMode.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.aoc.intcode.computer.boot | ||
|
||
import com.aoc.intcode.computer.IntCodeComputer | ||
|
||
/** | ||
* The Thermal Environment Supervision Terminal (TEST) is capable of running diagnostic tests on an [IntCodeComputer]. | ||
* @see IntCodeComputer.onNextBoot | ||
*/ | ||
enum class TestBootMode : BootMode { | ||
AIR_CONDITIONER_DIAGNOSTIC_TEST { | ||
override fun getCode() = 1L | ||
}, | ||
THERMAL_RADIATOR_CONTROLLER_DIAGNOSTIC_TEST { | ||
override fun getCode() = 5L | ||
}, | ||
BOOST_TEST { | ||
override fun getCode() = 1L | ||
}, | ||
SENSOR_BOOST { | ||
override fun getCode() = 2L | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 5 additions & 1 deletion
6
implementation/src/main/kotlin/com/aoc/intcode/network/NetworkAddress.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
package com.aoc.intcode.network | ||
|
||
data class NetworkAddress(val value: Long) | ||
import com.aoc.intcode.computer.boot.BootMode | ||
|
||
data class NetworkAddress(val value: Long) : BootMode { | ||
override fun getCode() = value | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters