If anyone wants to take a quick look maybe someone will see something that I am not.
#1 Members - Reputation: 282
Posted 08 December 2012 - 02:24 PM
If anyone wants to take a quick look maybe someone will see something that I am not.
WARNING: I edit my posts constantly.
#2 Members - Reputation: 507
Posted 08 December 2012 - 05:04 PM
#3 Members - Reputation: 282
Posted 08 December 2012 - 05:48 PM
EDIT: I figured it out. Now my math may be wrong but I thought this was correct.
HasSelection = X * 8 + Y Then X = HasSelection / 8 Y = HasSelection % 8
Is that not right?
Basically to fix it I eliminated HasSelection and instead put a X and Y placeholder that is transfered. That works. Something with this line
CheckY = ToLookUp % 8;Guess that is not correct? Yet it works for every other square except the last row the 8th row.
Edited by 0Circle0, 08 December 2012 - 06:12 PM.
WARNING: I edit my posts constantly.
#4 Members - Reputation: 1840
Posted 09 December 2012 - 01:16 PM
x = (y % 8) + 1
or if you count from 1-8 not 0-7
x = ((y-1)%8) + 1
#5 Members - Reputation: 282
Posted 11 December 2012 - 12:49 AM
Do you want to return a number fro 1-8? The modulo (%) operator always returns a number from 0-7 for modulo 8, you probably want
x = (y % 8) + 1
or if you count from 1-8 not 0-7
x = ((y-1)%8) + 1
Not sure what you mean. HasSelection = X * 8 + Y. You don't know Y to get X from HasSelection.
Only way I can think of is to do it by hand rather than letting the computer do it for me.
//Like say x = 5 and y = 6 int HasSelection = 5 * 8 + 6; // or 46 int HSHolder = 0; HSHolder = HasSelection / 8; // 46 / 8 = (int)5.75 = 5 y = ((HasSelection - 1) / 8 - HSHolder) * 8 + 1; // 45 / 8 = 5.625 - 5 = .625 * 8 = 5 + 1 = 6
Edited by 0Circle0, 11 December 2012 - 01:31 AM.
WARNING: I edit my posts constantly.







