I realized having to host this potentially indefinitely might not be the best idea, so I am going to shut down this gitea instance eventually.
You’ll have time, at least until the end of 2022, probably longer, but please just get all your stuff somewhere safe in case we ever disappear.

Refactor, updload additional files

master
Karl Spickermann 2 years ago
parent 74caa969d3
commit c0922a2942
  1. 8
      .idea/AoC2020.iml
  2. 8
      .idea/modules.xml
  3. 6
      .idea/vcs.xml
  4. 200
      .idea/workspace.xml
  5. BIN
      day1/go_build_day1_go.exe
  6. 10
      day2/day2.go
  7. BIN
      day2/go_build_day2_go.exe
  8. 1
      day3/day3.go
  9. 38
      day5/day5.go
  10. BIN
      day5/go_build_day5_go.exe

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/AoC2020.iml" filepath="$PROJECT_DIR$/.idea/AoC2020.iml" />
</modules>
</component>
</project>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

@ -0,0 +1,200 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="BranchesTreeState">
<expand>
<path>
<item name="ROOT" type="e8cecc67:BranchNodeDescriptor" />
<item name="LOCAL_ROOT" type="e8cecc67:BranchNodeDescriptor" />
</path>
</expand>
<select />
</component>
<component name="ChangeListManager">
<list default="true" id="400bdf61-8921-41d3-8f98-a0a1b0877f46" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/day2/day2.go" beforeDir="false" afterPath="$PROJECT_DIR$/day2/day2.go" afterDir="false" />
<change beforePath="$PROJECT_DIR$/day3/day3.go" beforeDir="false" afterPath="$PROJECT_DIR$/day3/day3.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="FileTemplateManagerImpl">
<option name="RECENT_TEMPLATES">
<list>
<option value="Go Application" />
</list>
</option>
</component>
<component name="GOROOT" path="C:\Users\karls\go\go1.15.5" />
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="1l1k6707hG5E8CQ1AvNgwJarheV" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="DefaultGoTemplateProperty" value="Go Application" />
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="configurable.Global.GOPATH.is.expanded" value="true" />
<property name="configurable.Module.GOPATH.is.expanded" value="true" />
<property name="configurable.Project.GOPATH.is.expanded" value="true" />
<property name="go.import.settings.migrated" value="true" />
<property name="go.sdk.automatically.set" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/day3" />
<property name="settings.editor.selected.configurable" value="com.goide.configuration.GoLibrariesConfigurableProvider" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="C:\Users\karls\go\src\AoC2020\day1" />
<recent name="C:\Users\karls\go\src\AoC2020" />
</key>
</component>
<component name="RunManager" selected="Go Build.go build day5.go">
<configuration name="go build day1.go" type="GoApplicationRunConfiguration" factoryName="Go Application" nameIsGenerated="true">
<module name="AoC2020" />
<working_directory value="$PROJECT_DIR$/day1" />
<parameters value="day1Test.txt" />
<kind value="FILE" />
<filePath value="$PROJECT_DIR$/day1/day1.go" />
<package value="AoC2020" />
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration name="go build day1.go" type="GoApplicationRunConfiguration" factoryName="Go Application" temporary="true" nameIsGenerated="true">
<module name="AoC2020" />
<working_directory value="$PROJECT_DIR$/day1" />
<parameters value="day1input.txt" />
<kind value="FILE" />
<filePath value="$PROJECT_DIR$/day1/day1.go" />
<package value="AoC2020" />
<directory value="$PROJECT_DIR$" />
<output_directory value="$PROJECT_DIR$/day1" />
<method v="2" />
</configuration>
<configuration name="go build day2.go" type="GoApplicationRunConfiguration" factoryName="Go Application" nameIsGenerated="true">
<module name="AoC2020" />
<working_directory value="$PROJECT_DIR$/day2" />
<parameters value="day2Input.txt" />
<kind value="FILE" />
<filePath value="$PROJECT_DIR$/day2/day2.go" />
<package value="AoC2020" />
<directory value="$PROJECT_DIR$" />
<output_directory value="$PROJECT_DIR$/day2" />
<method v="2" />
</configuration>
<configuration name="go build day3.go" type="GoApplicationRunConfiguration" factoryName="Go Application" nameIsGenerated="true">
<module name="AoC2020" />
<working_directory value="$PROJECT_DIR$/day3" />
<parameters value="day3Input.txt" />
<kind value="FILE" />
<filePath value="$PROJECT_DIR$/day3/day3.go" />
<package value="AoC2020" />
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration name="go build day4.go" type="GoApplicationRunConfiguration" factoryName="Go Application" nameIsGenerated="true">
<module name="AoC2020" />
<working_directory value="$PROJECT_DIR$/day4" />
<parameters value="day4Input.txt" />
<kind value="FILE" />
<filePath value="$PROJECT_DIR$/day4/day4.go" />
<package value="AoC2020" />
<directory value="$PROJECT_DIR$" />
<method v="2" />
</configuration>
<configuration name="go build day5.go" type="GoApplicationRunConfiguration" factoryName="Go Application" nameIsGenerated="true">
<module name="AoC2020" />
<working_directory value="$PROJECT_DIR$/day5" />
<parameters value="&quot;BFFFBBFRRR&quot;" />
<kind value="FILE" />
<filePath value="$PROJECT_DIR$/day5/day5.go" />
<package value="AoC2020" />
<directory value="$PROJECT_DIR$" />
<output_directory value="$PROJECT_DIR$/day5" />
<method v="2" />
</configuration>
<list>
<item itemvalue="Go Build.go build day1.go" />
<item itemvalue="Go Build.go build day2.go" />
<item itemvalue="Go Build.go build day3.go" />
<item itemvalue="Go Build.go build day4.go" />
<item itemvalue="Go Build.go build day5.go" />
</list>
<recent_temporary>
<list>
<item itemvalue="Go Build.go build day1.go" />
</list>
</recent_temporary>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
<component name="WindowStateProjectService">
<state x="448" y="103" width="1092" height="859" key="#com.intellij.execution.impl.EditConfigurationsDialog" timestamp="1607175613035">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="-1472" y="103" key="#com.intellij.execution.impl.EditConfigurationsDialog/-1920.0.1920.1040/0.0.1920.1040@-1920.0.1920.1040" timestamp="1607019292652" />
<state x="448" y="103" width="1092" height="859" key="#com.intellij.execution.impl.EditConfigurationsDialog/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1607175613035" />
<state x="661" y="322" key="#com.intellij.fileTypes.FileTypeChooser" timestamp="1606836882379">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="661" y="322" key="#com.intellij.fileTypes.FileTypeChooser/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1606836882379" />
<state x="739" y="287" key="FileChooserDialogImpl" timestamp="1607016918790">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="739" y="287" key="FileChooserDialogImpl/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1607016918790" />
<state width="1877" height="304" key="GridCell.Tab.0.bottom" timestamp="1607175589852">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="304" key="GridCell.Tab.0.bottom/-1920.0.1920.1040/0.0.1920.1040@-1920.0.1920.1040" timestamp="1607175230302" />
<state width="1877" height="304" key="GridCell.Tab.0.bottom/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1607175589852" />
<state width="1877" height="304" key="GridCell.Tab.0.center" timestamp="1607175589852">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="304" key="GridCell.Tab.0.center/-1920.0.1920.1040/0.0.1920.1040@-1920.0.1920.1040" timestamp="1607175230302" />
<state width="1877" height="304" key="GridCell.Tab.0.center/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1607175589852" />
<state width="1877" height="304" key="GridCell.Tab.0.left" timestamp="1607175589852">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="304" key="GridCell.Tab.0.left/-1920.0.1920.1040/0.0.1920.1040@-1920.0.1920.1040" timestamp="1607175230302" />
<state width="1877" height="304" key="GridCell.Tab.0.left/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1607175589852" />
<state width="1877" height="304" key="GridCell.Tab.0.right" timestamp="1607175589852">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state width="1877" height="304" key="GridCell.Tab.0.right/-1920.0.1920.1040/0.0.1920.1040@-1920.0.1920.1040" timestamp="1607175230302" />
<state width="1877" height="304" key="GridCell.Tab.0.right/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1607175589852" />
<state x="782" y="240" key="RollbackChangesDialog" timestamp="1607174263188">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="782" y="240" key="RollbackChangesDialog/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1607174263188" />
<state x="461" y="165" key="SettingsEditor" timestamp="1607081830252">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="461" y="165" key="SettingsEditor/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1607081830252" />
<state x="92" y="92" width="1736" height="856" key="com.intellij.history.integration.ui.views.FileHistoryDialog" timestamp="1607174299439">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="92" y="92" width="1736" height="856" key="com.intellij.history.integration.ui.views.FileHistoryDialog/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1607174299439" />
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup" timestamp="1607081728725">
<screen x="0" y="0" width="1920" height="1040" />
</state>
<state x="623" y="225" width="672" height="678" key="search.everywhere.popup/-1920.0.1920.1040/0.0.1920.1040@0.0.1920.1040" timestamp="1607081728725" />
</component>
</project>

Binary file not shown.

@ -18,10 +18,10 @@ func main() {
countPart2 := 0
for _, row := range input {
if checkPassword(disassembleRow(row)) {
count ++
count++
}
if checkPasswordPart2(disassembleRow(row)) {
countPart2 ++
countPart2++
}
}
fmt.Println(count)
@ -43,11 +43,11 @@ func checkPassword(min int, max int, char string, password string) bool {
func checkPasswordPart2(p1 int, p2 int, char string, password string) bool {
count := 0
if string(password[p1 - 1]) == char {
if string(password[p1-1]) == char {
count++
}
if string(password[p2 - 1]) == char {
count ++
if string(password[p2-1]) == char {
count++
}
return count == 1
}

Binary file not shown.

@ -14,7 +14,6 @@ func main() {
}
fmt.Println(day3(input, 3, 1))
fmt.Println(day3Part2(input, [][]int{{1, 1}, {3, 1}, {5, 1}, {7, 1}, {1, 2}}))
}
func day3Part2(input []string, slopes [][]int) int {

@ -0,0 +1,38 @@
package main
import (
"fmt"
"os"
)
func main() {
args := os.Args[1:]
input := args[0]
fmt.Println(input)
row, column := getRow(input)
fmt.Printf("|%d|%d|\n", row, column)
}
func getRow(boardingPass string) (int, int) {
rowP1 := 0
rowP2 := 127
for _,char := range boardingPass[:7] {
if char == 'F' {
rowP2 = rowP2 - (rowP2-rowP1)/2 - 1
}
if char == 'B' {
rowP1 = rowP1 + (rowP2-rowP1)/2 + 1
}
}
columnP1 := 0
columnP2 := 7
for _,char := range boardingPass[7:] {
if char == 'L' {
columnP2 = columnP2 - (columnP2-columnP1)/2 - 1
}
if char == 'R' {
columnP1 = columnP1 + (columnP2-columnP1)/2 + 1
}
}
return rowP1, columnP1
}

Binary file not shown.
Loading…
Cancel
Save