Welcome to the 62nd #daily-challenge. Today’s task will be the following:
Create a procedure that asks for 2 inputs, x and y (0<x≤8 ,0<y≤8 [no need to check these in the program])
The program should return 0 if the square is white and 1 if the square is black.
It’s really easy to make a solution hardcoding the values. Isn’t it better to be a solution that works for the same pattern with any given number? Example x=1 and y=9 will also give 1 or x=9 and y=1 to give 1. I will not share a solution this time so early.
You can make If statements checking the numbers in the table. This is also hardcoding. Because if the table would be 100x100 with the same pattern always you had to make a lot of If statements. But there is a solution that works with any number without using list or check all the numbers in the table.
I am sooooo struggling! I think I need a right idea, because I am thinking in the wrong way. I believe that there is a too simplie soultion for this but I can’t get it!
Ok. my solution is here: tell me if something is wrong, because I have no emulator, and my companion is not useable now. So I couldn’t check the solution.