hiyosilver
hiyosilver
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
Feel free to hit me up if you are stuck on anything else. No guarantees I can help, but I can atleast take a look.
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
Good luck with any further projects!
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
Happy to help 🙂
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
No just kidding, yes I'm pretty confident in claiming that returning boolean expressions directly is the idiomatic way of doing it.
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
In my capacity as just some guy hobbyist amateur, I say yes.
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
My suggestion just shortens it a little more. If you are evaluating a boolean expression and returning a boolean based on the result, you can just return the expression directly in a single line.
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
yes you could just change that too 🙂
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
if (leftDiagonal == "XXX" || leftDiagonal == "OOO")
return true;
if (rightDiagonal == "XXX" || leftDiagonal == "OOO")
return true;
if (leftDiagonal == "XXX" || leftDiagonal == "OOO")
return true;
if (rightDiagonal == "XXX" || leftDiagonal == "OOO")
return true;
should be
return leftDiagonal == "XXX" || leftDiagonal == "OOO" || rightDiagonal == "XXX" || rightDiagonal== "OOO";
return leftDiagonal == "XXX" || leftDiagonal == "OOO" || rightDiagonal == "XXX" || rightDiagonal== "OOO";
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
yes it is
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
It might be as easy a flipped condition somewhere.
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
Where the result of this is actually checked.
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
Where is the comparison?
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
Remember to clean up any superfluous console writes afterwards 🙂
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
Looks good-ish?
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
or switch the other one maybe. I always get confused by what is what in 2d arrays.
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
Yes I believe that should do it.
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
So sorry, I got distracted
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
GetRow and GetColumn both access the first dimension of the board array.
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
I saw it earlier and forgot to mention.
428 replies
CC#
Created by pikau on 3/29/2024 in #help
Defining and checking a 2D string array
FYI, there might be a bug in your code for getting rows and columns, but we'll see when we get there.
428 replies