 # Code giving wrong answer for Advent of Code 2015 day 6

I was trying to write a solution to Advent of Code 2015 day 6 and I am getting a wring answer.

``````function solve()
path = pwd() * "/AoC/input.txt"

lights = BitArray(zeros(1000,1000))

for i in instructions
if split(i," ") == "turn"
start_x,start_y = map(x -> parse(Int64,x),split(split(i," "),','))
end_x,end_y = map(x -> parse(Int64,x),split(split(i," "),','))
start_x += 1
start_y += 1
end_y += 1
end_x += 1

if split(i," ") == "on"

lights[start_x:start_y,end_x:end_y] .= 1

elseif split(i," ") == "off"

lights[start_x:start_y,end_x:end_y] .= 0

end
elseif split(i," ") == "toggle"

start_x,start_y = map(x -> parse(Int64,x),split(split(i," "),','))
end_x,end_y = map(x -> parse(Int64,x),split(split(i," "),','))
start_x += 1
start_y += 1
end_y += 1
end_x += 1
lights[start_x:start_y,end_x:end_y] = .!lights[start_x:start_y,end_x:end_y]

end
end

return sum(lights)

end

println(solve())
``````

Also, I would like to know if there is better way to achieve the same task in more “julia-way” .