D5: Made Godot scripts runnable from the command line
This commit is contained in:
parent
b9a86c612c
commit
9a2564986b
2 changed files with 59 additions and 55 deletions
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/godot -s
|
||||
#d5p1.gd
|
||||
extends Node3D
|
||||
#extends Node3D
|
||||
extends SceneTree
|
||||
|
||||
enum Maps {
|
||||
seeds,
|
||||
|
@ -76,7 +77,7 @@ func map_input(data, seed):
|
|||
func _init():
|
||||
print("Hello!")
|
||||
|
||||
var temp = file_load("res://input.txt").split("\n\n")
|
||||
var temp = file_load(OS.get_cmdline_user_args()[0]).split("\n\n")
|
||||
input_clean(temp)
|
||||
|
||||
var input = input_format(temp)
|
||||
|
@ -97,3 +98,4 @@ func _init():
|
|||
minval = location
|
||||
|
||||
print("Answer: %s" % minval)
|
||||
quit()
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/godot -s
|
||||
#d5p2.gd
|
||||
extends Node3D
|
||||
#extends Node3D
|
||||
extends SceneTree
|
||||
|
||||
enum Maps {
|
||||
seeds,
|
||||
|
@ -91,7 +92,7 @@ func revmap_input(data, location):
|
|||
func _init():
|
||||
print("Hello!")
|
||||
|
||||
var temp = file_load("res://input.txt").split("\n\n")
|
||||
var temp = file_load(OS.get_cmdline_user_args()[0]).split("\n\n")
|
||||
input_clean(temp)
|
||||
|
||||
var input = input_format(temp)
|
||||
|
@ -113,6 +114,7 @@ func _init():
|
|||
if seed >= seeds[i*2] && seed <= seeds[i*2]+seeds[i*2+1]:
|
||||
print("Answer 2: %s" % testlocation)
|
||||
print("Value is between seed %s and %s" % [seeds[i*2], seeds[i*2]+seeds[i*2+1]])
|
||||
quit()
|
||||
return
|
||||
|
||||
testlocation+=1
|
||||
|
|
Loading…
Reference in a new issue