Last active
April 15, 2016 08:01
-
-
Save jwvg0425/1fed9754c7a70b91167c6ea3abfcdb54 to your computer and use it in GitHub Desktop.
8dir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <iostream> | |
| using namespace std; | |
| inline int deltaTable(int idx) { return (idx-4)%4 * (abs(i-4)-4) / 3; } | |
| int main() | |
| { | |
| for(int i =0; i < 8; i++) | |
| { | |
| int x = deltaTable(i); | |
| int y = deltaTable((i+6)%8); | |
| cout << "(" << x << "," << y << ")" << endl; | |
| } | |
| /* output | |
| (0,-1) | |
| (1,-1) | |
| (1,0) | |
| (1,1) | |
| (0,1) | |
| (-1,1) | |
| (-1,0) | |
| (-1,-1) | |
| */ | |
| //straight -> cross | |
| for(int i =0; i < 8; i++) | |
| { | |
| int idx = (i*2-1) % 7 + 1; | |
| int x = deltaTable(idx); | |
| int y = deltaTable((idx+6)%8); | |
| cout << "(" << x << "," << y << ")" << endl; | |
| } | |
| /* output | |
| (0,-1) | |
| (1,0) | |
| (0,1) | |
| (-1,0) | |
| (1,-1) | |
| (1,1) | |
| (-1,1) | |
| (-1,-1) | |
| */ | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment