Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/100-doors/GDScript/100-doors.gd
Normal file
23
Task/100-doors/GDScript/100-doors.gd
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
func Doors(door_count:int) -> void :
|
||||
var doors : Array
|
||||
doors.resize(door_count)
|
||||
|
||||
# Note : Initialization is not necessarily mandatory (by default values are false)
|
||||
# Intentionally left here
|
||||
for i in door_count :
|
||||
doors[i] = false
|
||||
|
||||
# do visits
|
||||
for i in door_count :
|
||||
for j in range(i,door_count,i+1) :
|
||||
doors[j] = not doors[j]
|
||||
|
||||
# print results
|
||||
var results : String = ""
|
||||
for i in door_count :
|
||||
results += str(i+1) + " " if doors[i] else ""
|
||||
print("Doors open : %s" % [results] )
|
||||
|
||||
# calling the function from the _ready function
|
||||
func _ready() -> void :
|
||||
Doors(100)
|
||||
Loading…
Add table
Add a link
Reference in a new issue