#C++ troubleshooting (please and thank you!)

21 messages · Page 1 of 1 (latest)

static larkBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

vestal wolf
#

C++ troubleshooting (please and thank you!)

static larkBOT
#

@vestal wolf Has your question been resolved? If so, type !solved :)

twin ember
#

what's wrong with it? ah nevermind, you said that

#

my beamsplitter " | " would only go down, and my beamsplitter " " would only go right, I want it reflect both ways.
This is probably because you have this: c++ if (direction == "left" || direction == "right") { direction = "up"; direction = "down"; }

#

this doesn't do what you want it to do

#

but I'm not sure what that is. Do you want the beam to go in two directions simultaneously?

vestal wolf
#

I think its overriding to only using the down and right

twin ember
#

yeah that's what it's doing

#

this sounds like a typical DFS exercise

#

by the way, you should really use an enum class instead of strings for the directions

#

if you have a typo somewhere, like doen instead of down, then the compiler won't tell you if you're using strings

#

but with an enum class, it will

twin ember
vestal wolf
#

Is there anything way I can have it reflect both ways (up and down) and (left and right)?

twin ember
#

your function already takes a laserQueue as parameter

#

you can insert new nodes into that queue

#

if you're unsure how exactly you should do that, then it's probably a good idea to look up how BFS works

vestal wolf