Timeline for answer to 2D Array Middle Point by Lycea
Current License: CC BY-SA 4.0
Post Revisions
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jul 4, 2018 at 14:49 | comment | added | Jo King |
It's been a while since I've done anything in Lua, but it has the // operator yes? So you don't need the floor function
|
|
| Jul 4, 2018 at 14:45 | comment | added | Sundar R |
You can extend the condition to check that too, here's my attempt: Try it online! (also changed x%2+y%2 to x*y%2 after seeing Arnauld's answer.)
|
|
| Jul 4, 2018 at 14:32 | comment | added | Sundar R |
Also, this doesn't return 0,0 when x is 1, which is one of the question's requirements
|
|
| Jul 4, 2018 at 14:30 | comment | added | Sundar R |
I don't know much Lua (although I wish I did!), but I believe you can replace the oddness check x%2==1 and y%2==1 with x%2+y%2>1 Try it online!
|
|
| Jul 4, 2018 at 14:23 | history | answered | Lycea | CC BY-SA 4.0 |