#include #include #include #include #include #define POCET 209 #define UHEL 30 #define DELKA 50 #define NFI 14 #define NL 14 #define START 0 short polygons[POCET][14][2] = { { {-1,0},{0,1},{3,2},{-3,1},{3,2},{1,3},{4,3},{0,3},{0,3},{4,3} }, /* 1 */ { {-1,0},{0,1},{3,2},{-1,3},{0,1},{3,2},{3,3},{0,3},{0,3},{4,3} }, { {-1,0},{0,1},{3,2},{-1,3},{1,2},{3,1},{2,3},{0,3},{0,3},{4,3} }, { {-1,0},{0,1},{3,2},{-1,3},{2,3},{3,2},{3,1},{-2,3},{0,3},{4,3} }, { {-1,0},{1,2},{3,1},{-2,3},{1,2},{3,1},{2,3},{0,3},{0,3},{4,3} }, { {-2,0},{3,1},{-1,2},{3,1},{-2,3},{2,3},{4,3},{0,3},{0,3},{3,2} }, /* 6 */ { {-1,0},{2,3},{0,3},{0,1},{3,2},{3,3},{-2,1},{3,2},{-1,3},{4,3} }, { {-1,0},{2,3},{0,3},{1,2},{3,1},{0,1},{3,2},{-1,3},{0,3},{4,3} }, { {-1,0},{2,3},{0,3},{1,2},{3,1},{2,3},{-2,1},{3,2},{-1,3},{4,3} }, { {-1,0},{2,3},{0,3},{1,2},{3,1},{2,3},{0,3},{-2,1},{3,2},{3,3} }, { {-1,0},{0,3},{2,1},{3,2},{-4,2},{3,1},{2,3},{2,3},{0,3},{4,3} }, /* 11 */ { {-1,0},{0,3},{2,1},{3,2},{-3,3},{3,2},{3,1},{0,3},{0,3},{4,3} }, { {-1,0},{0,3},{2,1},{3,2},{-3,3},{4,3},{1,2},{3,1},{-2,3},{4,3} }, { {-2,0},{3,1},{-2,3},{2,1},{3,2},{-3,3},{4,3},{2,3},{0,3},{3,2} }, { {-1,0},{0,3},{3,2},{3,1},{-4,3},{2,1},{3,2},{1,3},{0,3},{4,3} }, { {-1,0},{0,3},{3,2},{3,1},{-4,3},{4,3},{0,1},{3,2},{-1,3},{4,3} }, /* 16 */ { {-1,0},{0,3},{3,2},{3,1},{-4,3},{4,3},{1,2},{3,1},{-2,3},{4,3} }, { {-2,0},{3,1},{-2,3},{3,2},{3,1},{-4,3},{4,3},{2,3},{0,3},{3,2} }, { {-3,0},{3,2},{2,2},{3,1},{-4,3},{4,3},{2,3},{0,3},{4,3},{-2,1} }, { {-1,0},{0,3},{4,1},{-3,2},{4,2},{-3,1},{4,3},{2,3},{0,3},{4,3} }, { {-1,0},{0,3},{4,3},{-4,1},{3,2},{3,3},{0,1},{3,2},{-1,3},{4,3} }, /* 21 */ { {-2,0},{3,1},{-2,3},{4,3},{-4,1},{3,2},{3,3},{2,3},{0,3},{3,2} }, { {-1,0},{-2,1},{3,2},{3,3},{-4,1},{3,2},{3,3},{2,3},{0,3},{4,3} }, { {-1,0},{0,3},{4,3},{-2,3},{3,2},{3,1},{0,3},{-2,1},{3,2},{3,3} }, { {-3,0},{3,2},{-1,3},{4,3},{-2,3},{3,2},{3,1},{0,3},{0,3},{2,1} }, { {-1,0},{0,3},{4,3},{-2,3},{4,3},{0,1},{3,2},{-3,1},{3,2},{3,3} }, /* 26 */ { {-2,0},{3,1},{-2,3},{4,3},{-2,3},{4,3},{0,1},{3,2},{-1,3},{3,2} }, { {-3,0},{3,2},{-1,3},{4,3},{-2,3},{4,3},{2,3},{-2,1},{3,2},{1,1} }, { {-4,0},{3,3},{-1,2},{3,1},{2,3},{-2,3},{4,3},{2,3},{-2,1},{3,2} }, { {-3,0},{3,2},{-3,1},{3,2},{3,3},{-2,3},{4,3},{2,3},{0,3},{2,1} }, { {-3,0},{3,2},{-2,2},{3,1},{2,3},{-2,3},{4,3},{2,3},{0,3},{2,1} }, /* 31 */ { {-3,0},{2,3},{2,1},{3,2},{-3,3},{0,1},{3,2},{3,3},{0,3},{2,3} }, { {-3,0},{2,3},{2,1},{3,2},{-3,3},{1,2},{3,1},{2,3},{0,3},{2,3} }, { {-3,0},{0,1},{3,2},{1,1},{3,2},{-3,3},{2,3},{4,3},{0,3},{2,3} }, { {-3,0},{2,3},{3,2},{0,2},{1,3},{4,3},{0,3},{2,3},{2,3} }, { {-3,0},{2,3},{3,2},{3,1},{-4,3},{2,3},{2,1},{3,2},{-1,3},{2,3} }, /* 36 */ { {-3,0},{2,3},{3,2},{3,1},{-4,3},{2,3},{3,2},{3,1},{-2,3},{2,3} }, { {-3,0},{1,2},{3,1},{1,2},{3,1},{-4,3},{2,3},{4,3},{0,3},{2,3} }, { {-3,0},{2,3},{4,1},{-3,2},{4,2},{-3,1},{2,3},{4,3},{0,3},{2,3} }, { {-3,0},{2,3},{4,3},{-4,1},{3,2},{0,2},{3,1},{2,3},{0,3},{2,3} }, { {-5,0},{2,3},{2,3},{4,3},{-4,1},{3,2},{1,3},{3,2},{3,1},{-2,3} }, /* 41 */ { {-4,0},{3,1},{0,3,},{4,3},{-4,1},{3,2},{1,3},{4,3},{0,3},{1,2} }, { {-3,0},{1,2},{3,1},{2,3},{-4,1},{3,2},{1,3},{4,3},{0,3},{2,3} }, { {-3,0},{3,2},{3,3},{-2,3},{0,1,},{3,2},{3,3},{0,3},{2,3},{0,1} }, { {-3,0},{2,3},{4,3},{-2,3},{1,2},{3,1},{0,1,},{3,2},{-1,3},{2,3} }, { {-3,0},{1,2},{3,1},{2,3},{-2,3},{1,2},{3,1},{2,3},{0,3},{2,3} }, /* 46 */ { {-5,0},{3,2},{1,3},{4,3},{-2,3},{2,3},{2,1},{3,2},{-1,3},{0,1} }, { {-3,0},{2,3},{4,3},{-2,3},{2,3},{3,2},{3,1},{-4,1},{3,2},{1,3} }, { {-1,0},{0,3},{4,3},{-2,3},{2,3},{4,3},{-2,1},{3,2},{0,2},{3,1} }, { {-3,0},{0,1},{3,2},{3,3},{-2,3},{2,3},{4,3},{-2,1},{3,2},{1,3} }, { {-3,0},{1,2},{3,1},{0,3},{2,3},{2,3},{4,1},{-3,2},{3,3} }, /* 51 */ { {-3,0},{2,3},{0,1},{3,2},{1,3},{2,3},{4,1},{-3,2},{3,3} }, { {-3,0},{2,3},{2,3},{0,1},{3,2},{1,3},{4,1},{-3,2},{3,3} }, { {-3,0},{2,3},{2,3},{1,2},{3,1},{0,3},{4,1},{-3,2},{3,3} }, { {-2,0},{-1,1},{3,2},{1,3},{2,3},{2,3},{4,3},{-4,3},{2,1},{3,2} }, { {-2,0},{0,2},{3,1},{0,3},{2,3},{2,3},{4,3},{-4,3},{2,1},{3,2} }, /* 56 */ { {-2,0},{1,3},{2,3},{1,2},{3,1},{0,3},{4,3},{-4,3},{2,1},{3,2} }, { {-4,0},{3,1},{-2,1},{3,2},{1,3},{2,3},{2,3},{4,3},{-4,3},{3,2} }, { {-4,0},{3,1},{-1,2},{3,1},{0,3},{2,3},{2,3},{4,3},{-4,3},{3,2} }, { {-4,0},{3,1},{0,3},{1,2},{3,1},{0,3},{2,3},{4,3},{-4,3},{3,2} }, { {-4,0},{3,1},{0,3},{2,3},{0,1},{3,2},{1,3},{4,3},{-4,3},{3,2} }, /* 61 */ { {-3,0},{0,1},{3,2},{-1,1},{3,2},{1,3},{2,3},{4,3},{-4,3},{4,3} }, { {-3,0},{0,1},{3,2},{0,2},{3,1},{0,3},{2,3},{4,3},{-4,3},{4,3} }, { {-3,0},{0,1},{3,2},{1,3},{0,1},{3,2},{1,3},{4,3},{-4,3},{4,3} }, { {-3,0},{1,2},{3,1},{-1,2},{3,1},{0,3},{2,3},{4,3},{-4,3},{4,3} }, { {-3,0},{3,1},{-2,1},{3,2},{-3,1},{3,2},{2,2},{3,1},{0,3},{0,3},{3,2} }, /* 66 */ { {-4,0},{3,2},{1,3},{-2,1},{3,2},{1,1},{3,2},{1,3},{-1,2},{3,1},{0,1} }, { {-1,0},{-1,1},{3,2},{-3,1},{3,2},{1,1},{3,2},{1,3},{0,3},{2,1},{3,2} }, { {-1,0},{-1,1},{3,2},{-1,3},{2,1},{3,2},{1,3},{-1,2},{3,1},{0,1},{3,2} }, { {-1,0},{0,2},{3,1},{-3,2},{3,1},{0,1},{3,2},{1,3},{0,3},{2,1},{3,2} }, { {-3,0},{3,1},{-2,1},{3,2},{-3,1},{3,2},{2,2},{3,1},{0,3},{0,3},{3,2} }, /* 71 */ { {0,0},{-2,1},{3,2},{-1,3},{2,1},{3,2},{1,3},{-1,2},{3,1},{1,2},{3,1} }, { {-3,0},{3,1},{-2,1},{3,2},{-1,3},{2,1},{3,2},{0,2},{3,1},{-2,3},{3,2} }, { {-3,0},{3,1},{-1,2},{3,1},{-4,1},{3,2},{1,1},{3,2},{1,3},{0,3},{3,2} }, { {-3,0},{3,1},{0,3},{0,3},{2,1},{3,2},{0,2},{3,1},{-3,2},{3,1},{1,2} }, { {-3,0},{3,1},{-2,1},{3,2},{-3,1},{3,2},{3,3},{2,3},{-2,1},{3,2},{2,2} }, /* 76 */ { {-3,0},{3,1},{-1,2},{3,1},{-4,1},{3,2},{3,3},{1,2},{3,1},{-2,3},{3,2} }, { {-3,0},{3,1},{-1,2},{3,1},{-3,2},{3,1},{2,3},{0,1},{3,2},{-1,3},{3,2} }, { {-3,0},{3,1},{-1,2},{3,1},{-2,3},{4,3},{0,1},{3,2},{-2,2},{3,1},{1,2} }, { {-3,0},{3,1},{0,3},{-2,1},{3,2},{3,3},{1,2},{3,1},{-3,2},{3,1},{1,2} }, { {-2,0},{1,2},{-3,1},{4,3},{2,3},{3,2},{-3,1},{4,3},{0,3},{4,3} }, /* 81 */ { {-2,0},{1,2},{0,2},{4,2},{-3,1},{2,1},{3,2},{2,2},{-3,1},{1,2},{3,1},{2,3} }, { {-4,0},{3,2},{0,2},{0,2},{4,2},{-3,1},{3,2},{3,1},{1,2},{-3,1},{2,3},{2,1} }, { {-4,0},{3,2},{0,2},{0,2},{4,2},{-3,1},{4,3},{3,2},{-3,1},{1,2},{3,1},{0,1} }, { {-3,0},{1,1},{3,2},{-1,1},{3,2},{2,2},{-3,1},{2,1},{3,2},{2,2},{0,2} }, { {-5,0},{3,1},{2,1},{-3,2},{1,1},{3,2},{3,1},{-3,2},{4,2},{-3,1},{3,2},{3,1},{-1,2} }, /* 86 */ { {-3,0},{3,3},{3,2},{-3,1},{2,3},{2,1},{3,2},{-1,3},{3,2},{0,2} }, { {-3,0},{3,3},{3,2},{-3,1},{2,3},{4,3},{-1,2},{3,1},{1,2},{0,2} }, { {-3,0},{3,3},{4,1},{-3,2},{1,3},{2,1},{3,2},{-1,3},{3,2},{0,2} }, { {-4,0},{3,2},{-1,1},{3,2},{1,3},{4,1},{-3,2},{3,3},{3,2},{-3,1},{2,1} }, { {-4,0},{3,2},{0,2},{3,1},{0,3},{4,1},{-3,2},{3,3},{3,2},{-3,1},{2,1} }, /* 91 */ { {-6,0},{3,2},{3,1},{-2,1},{3,2},{1,3},{4,1},{-3,2},{3,3},{3,2},{-3,1} }, { {-4,0},{3,2},{-1,1},{3,2},{1,3},{3,2},{-3,1},{4,3},{3,2},{-3,1},{2,1} }, { {-3,0},{3,1,},{-2,1},{3,2},{1,3},{3,2},{-3,1},{4,3},{3,2},{-3,1},{3,2} }, { {-3,0},{3,1},{0,3},{0,1},{3,2},{2,2},{-3,1},{4,3},{3,2},{-3,1},{3,2} }, { {-2,0},{0,1},{3,2},{0,2},{3,1},{1,2},{-3,1},{4,3},{3,2},{-3,1},{4,3} }, /* 96 */ { {-2,0},{1,2},{3,1},{-1,2},{3,1},{1,2},{-3,1},{4,3},{3,2},{-3,1},{4,3} }, { {-2,0},{0,1},{3,2},{1,3},{3,2},{-3,1},{2,1},{3,2},{2,2},{-3,1},{4,3} }, { {-6,0},{4,3},{2,3},{1,2},{3,1},{1,2},{-3,1},{2,1},{3,2},{2,2},{-3,1},{4,3} }, { {-2,0},{1,2},{0,2},{1,1},{3,2},{3,1},{-3,2},{4,2},{-3,1},{1,2},{3,1},{2,3} }, { {-4,0},{3,2},{0,2},{0,2},{3,3},{3,2},{0,2},{-1,1},{3,2},{1,1} }, /* 101 */ { {-6,0},{4,3},{3,2},{-3,1},{2,3},{2,1},{3,2},{0,2},{-3,1},{4,3},{3,2},{-3,1} }, { {-6,0},{4,3},{3,2},{-3,1},{2,3},{3,2},{3,1},{-1,2},{-3,1},{4,3},{3,2},{-3,1} }, { {-5,0},{3,3},{2,1},{-3,2},{4,2},{-3,1},{4,3},{3,2},{-3,1},{4,3},{-2,1},{3,2} }, { {-4,0},{2,3},{2,1},{-3,2},{4,2},{-3,1},{4,3},{3,2},{-3,1},{4,3},{-1,2},{3,1} }, { {-2,0},{1,2},{0,2},{3,3},{4,1},{-3,2},{1,1},{3,2},{-1,3},{4,3} }, /* 106 */ { {-6,0},{4,3},{1,2},{0,2},{3,3},{4,1},{-3,2},{2,2},{3,1},{-2,3} }, { {-4,0},{3,2},{0,2},{0,2},{3,3},{4,1},{-3,2},{3,3},{0,3},{2,1} }, { {-3,0},{3,1},{-1,2},{0,2},{3,3},{4,1},{-3,2},{3,3},{0,3},{3,2} }, { {-4,0},{2,3},{1,2},{0,2},{3,3},{3,2},{-3,1},{4,3},{-1,2},{3,1} }, { {-4,0},{3,2},{0,2},{0,2},{3,3},{3,2},{-3,1},{4,3},{0,3},{2,1} }, /* 111 */ { {-3,0},{3,1},{-1,2},{0,2},{3,3},{3,2},{-3,1},{4,3},{0,3},{3,2} }, { {-2,0},{1,2},{0,2},{2,2},{3,1},{0,3},{3,2},{-3,1},{2,3},{4,3} }, { {-4,0},{3,2},{0,2},{0,2},{3,3},{2,3},{3,2},{-3,1},{2,3},{2,1} }, { {-2,0},{1,2},{0,2},{1,1},{3,2},{1,3},{4,1},{-3,2},{1,3},{4,3} }, { {-6,0},{4,3},{1,2},{0,2},{3,3},{0,1},{3,2},{3,1},{-3,2},{1,3} }, /* 116 */ { {-6,0},{4,3},{1,2},{0,2},{3,3},{1,2},{3,1},{2,1},{-3,2},{1,3} }, { {-5,0},{3,3},{1,2},{0,2},{3,3},{2,3},{4,1},{-3,2},{-1,1},{3,2} }, { {-4,0},{2,3},{1,2},{0,2},{3,3},{2,3},{4,1},{-3,2},{0,2},{3,1} }, { {-4,0},{3,2},{0,2},{0,2},{3,3},{2,3},{4,1},{-3,2},{1,3},{2,1} }, { {-4,0},{3,2},{-1,1},{3,2},{-3,1},{3,2},{3,3},{0,1},{3,2},{-1,3},{2,1} }, /* 121 */ { {-4,0},{3,2},{-1,1},{3,2},{-2,2},{3,1},{2,3},{0,1},{3,2},{-1,3},{2,1} }, { {-5,0},{3,3},{2,3},{-2,1},{3,2},{1,1},{3,2},{0,2},{3,1},{-4,1},{3,2} }, { {-4,0},{3,2},{0,2},{3,1},{-3,2},{3,1},{2,3},{1,2},{3,1},{-2,3},{2,1} }, { {-4,0},{3,2},{1,3},{-2,1},{3,2},{3,3},{0,1},{3,2},{-2,2},{3,1},{0,1} }, { {-4,0},{3,2},{1,3},{-2,1},{3,2},{3,3},{1,2},{3,1},{-3,2},{3,1},{0,1} }, /* 126 */ { {-4,0},{3,2},{1,3},{-1,2},{3,1},{2,3},{1,2},{3,1},{-4,1},{3,2},{1,1} }, { {-4,0},{3,2},{1,3},{-1,2},{3,1},{2,3},{1,2},{3,1},{-3,2},{3,1},{0,1} }, { {-3,0},{0,2},{3,3},{0,3},{2,3},{4,3},{-1,2},{0,2},{4,2} }, { {-4,0},{4,3},{0,3},{1,2},{3,1},{1,2},{0,2},{4,2},{-3,1},{2,3} }, { {-4,0},{4,3},{0,3},{0,1},{3,2},{2,2},{0,2},{4,2},{-3,1},{2,3} }, /* 131 */ { {-4,0},{3,2},{3,1},{-2,3},{2,3},{3,2},{0,2},{4,2},{-3,1},{2,3} }, { {-4,0},{2,1},{3,2},{-1,3},{2,3},{3,2},{0,2},{4,2},{-3,1},{2,3} }, { {-6,0},{3,2},{3,3},{0,3},{2,3},{3,2},{0,2},{4,2},{-3,1},{0,1} }, { {-6,0},{4,3},{2,3},{0,3},{2,1},{3,2},{0,2},{0,2},{4,2},{-3,1} }, { {-6,0},{4,3},{2,3},{0,3},{3,2},{3,1},{-1,2},{0,2},{4,2},{-3,1} }, /* 136 */ { {-5,0},{3,3},{2,3},{0,3},{4,3},{2,1},{-3,2},{3,3},{4,1},{-3,2} }, { {-3,0},{3,1},{-2,3},{4,3},{-1,2},{3,1},{1,2},{3,1},{-3,2},{3,1},{1,2} }, { {0,0},{2,3},{-1,2},{3,1},{2,3},{-2,1},{3,2},{2,2},{3,1},{-3,2},{3,1} }, { {-4,0},{3,2},{-1,3},{3,2},{3,1},{-2,3},{2,1},{3,2},{-2,2},{3,1},{0,1} }, { {-4,0},{3,2},{-1,3},{4,3},{-2,1},{3,2},{1,1},{3,2},{-2,2},{3,1},{0,1} }, /* 141 */ { {-5,0},{3,3},{-2,1},{3,2},{1,1},{3,2},{-1,3},{3,2},{3,1},{-4,1},{3,2} }, { {-4,0},{3,2},{-3,1},{3,2},{1,1},{3,2},{-3,1},{3,2},{3,3},{0,3},{2,1} }, { {-4,0},{3,2},{-3,1},{3,2},{2,2},{3,1},{-4,1},{3,2},{3,3},{0,3},{2,1} }, { {-3,0},{3,1},{-4,1},{3,2},{1,1},{3,2},{-3,1},{3,2},{3,3},{0,3},{3,2} }, { {-4,0},{3,2},{-1,3},{4,3},{0,3},{3,2},{0,2},{4,2},{-3,1},{2,1} }, /* 146 */ { {-6,0},{3,2},{3,1},{-2,3},{4,3},{0,3},{3,2},{0,2},{4,2},{-3,1} }, { {-6,0},{4,3},{-2,1},{3,2},{3,3},{0,3},{3,2},{0,2},{4,2},{-3,1} }, { {-6,0},{4,3},{-1,2},{3,1},{2,3},{0,3},{3,2},{0,2},{4,2},{-3,1} }, { {-6,0},{4,3},{0,3},{2,1},{3,2},{-1,3},{3,2},{0,2},{4,2},{-3,1} }, { {-6,0},{4,3},{0,3},{4,3},{-2,1},{3,2},{2,2},{0,2},{4,2},{-3,1} }, /* 151 */ { {-4,0},{2,3},{0,1},{3,2},{-1,1},{3,2},{1,1},{3,2},{-4,2},{3,1},{2,3} }, { {-4,0},{2,3},{0,1},{3,2},{0,2},{3,1},{0,1},{3,2},{-4,2},{3,1},{2,3} }, { {-4,0},{3,2},{-1,1},{3,2},{1,3},{2,1},{3,2},{-4,2},{3,1},{2,3},{0,1} }, { {-4,0},{2,3},{1,2},{3,1},{-1,2},{3,1},{0,1},{3,2},{-4,2},{3,1},{2,3} }, { {-6,0},{3,2},{1,3},{1,2},{3,1},{0,3},{2,1},{3,2},{-4,2},{3,1},{0,1} }, /* 156 */ { {-5,0},{3,1},{0,3},{1,2},{3,1},{0,3},{2,1},{3,2},{-4,2},{3,1},{1,2} }, { {-6,0},{3,2},{1,3},{2,3},{0,1},{3,2},{1,1},{3,2},{-4,2},{3,1},{0,1} }, { {-4,0},{2,3},{0,1},{3,2},{-1,1},{3,2},{2,2},{0,2},{3,3} }, { {-5,0},{3,1},{0,3},{0,1},{3,2},{1,3},{3,2},{0,2},{2,2} }, { {-4,0},{3,2},{-1,1},{3,2},{1,3},{3,2},{0,2},{3,3},{0,1},{3,2} }, /* 161 */ { {-4,0},{2,3},{1,2},{3,1},{-2,1},{3,2},{2,2},{0,2},{3,3} }, { {-4,0},{2,3},{1,2},{3,1},{-1,2},{3,1},{1,2},{0,2},{3,3} }, { {-3,0},{1,3},{1,2},{3,1},{0,3},{3,2},{0,2},{1,1},{3,2} }, { {-3,0},{1,3},{2,3},{0,1},{3,2},{2,2},{0,2},{1,1},{3,2} }, { {-4,0},{2,3},{0,1},{3,2},{-1,1},{3,2},{3,1},{-3,2},{4,2},{-3,1},{4,3} }, /* 166 */ { {-5,0},{3,1},{0,3},{0,1},{3,2},{1,3},{4,1},{-3,2},{4,2},{-3,1},{3,2} }, { {-4,0},{2,3},{1,2},{3,1},{-1,2},{3,1},{2,1},{-3,2},{4,2},{-3,1},{4,3} }, { {-3,0},{1,3},{1,2},{3,1},{0,3},{4,1},{-3,2},{4,2},{-3,1},{2,1},{3,2} }, { {-3,0},{1,3},{0,1},{3,2},{-1,1},{3,2},{1,1},{3,2},{-3,3},{2,1},{3,2} }, { {-5,0},{3,1},{0,3},{0,1},{3,2},{-1,1},{3,2},{1,1},{3,2},{-3,3},{3,2} }, /* 171 */ { {-4,0},{1,2},{3,1},{-2,1},{3,2},{-1,1},{3,2},{1,1},{3,2},{-3,3},{4,3} }, { {-4,0},{3,2},{-1,1},{3,2},{0,2},{3,1},{0,1},{3,2},{-3,3},{4,3},{0,1} }, { {-3,0},{3,1},{-2,1},{3,2},{0,2},{3,1},{0,1},{3,2},{-3,3},{4,3},{1,2} }, { {-3,0},{1,3},{1,2},{3,1},{-1,2},{3,1},{0,1},{3,2},{-3,3},{2,1},{3,2} }, { {-5,0},{3,1},{0,3},{1,2},{3,1},{-1,2},{3,1},{0,1},{3,2},{-3,3},{3,2} }, /* 176 */ { {-4,0},{1,2},{3,1},{-1,2},{3,1},{-1,2},{3,1},{0,1},{3,2},{-3,3},{4,3} }, { {-3,0},{0,2},{3,1},{-2,1},{3,2},{1,3},{2,1},{3,2},{-3,3},{2,1},{3,2} }, { {-4,0},{3,2},{-1,1},{3,2},{1,3},{2,1},{3,2},{-3,3},{3,2},{3,1},{-2,1} }, { {-2,0},{-1,2},{3,1},{-2,1},{3,2},{1,3},{2,1},{3,2},{-3,3},{3,2},{3,1} }, { {-3,0},{0,2},{3,1},{-1,2},{3,1},{0,3},{2,1},{3,2},{-3,3},{2,1},{3,2} }, /* 181 */ { {-5,0},{3,1},{0,3},{0,1},{3,2},{0,2},{3,1},{1,2},{3,1},{-4,3},{3,2} }, { {-4,0},{3,2},{-1,1},{3,2},{-1,1},{3,2},{2,2},{3,1},{-4,3},{4,3},{0,1} }, { {-2,0},{-1,2},{3,1},{-2,1},{3,2},{1,3},{3,2},{3,1},{-4,3},{3,2},{3,1} }, { {-3,0},{-1,1},{3,2},{0,2},{3,1},{0,3},{3,2},{3,1},{-4,3},{2,1},{3,2} }, { {-5,0},{3,1},{-2,1},{3,2},{0,2},{3,1},{0,3},{3,2},{3,1},{-4,3},{3,2} }, /* 186 */ { {-3,0},{-1,1},{3,2},{-1,1},{3,2},{0,2},{3,1},{2,3},{-2,3},{2,1},{3,2} }, { {-5,0},{4,2},{0,2},{1,3},{2,3},{4,3},{-2,3},{3,2},{0,2} }, { {-4,0},{3,2},{-1,1},{3,2},{-1,1},{3,2},{3,1},{-3,2},{4,2},{0,2},{1,1} }, { {-5,0},{2,2},{3,1},{-2,1},{3,2},{-1,1},{3,2},{3,1},{-3,2},{4,2},{0,2} }, { {-5,0},{2,2},{3,1},{-2,1},{3,2},{0,2},{3,1},{2,1},{-3,2},{4,2},{0,2} }, /* 191 */ { {-6,0},{3,2},{0,2},{4,2},{0,2},{0,2},{3,1},{1,2},{3,1},{-2,3} }, { {-5,0},{2,2},{0,2},{4,2},{0,2},{0,2},{3,1},{2,3},{-2,1},{3,2} }, { {-4,0},{1,2},{0,2},{4,2},{0,2},{0,2},{3,1},{2,3},{-1,2},{3,1} }, { {-4,0},{1,2},{0,2},{4,2},{0,2},{1,3},{2,1},{3,2},{-2,2},{3,1} }, { {-4,0},{2,3},{2,3},{1,2},{0,2},{4,2},{0,2},{4,2},{-3,1},{-1,2},{3,1} }, /* 196 */ { {-6,0},{4,3},{1,2},{3,1},{0,1},{-3,2},{4,2},{0,2},{4,2},{0,2},{-1,3} }, { {-5,0},{4,2},{0,2},{4,2},{-3,1},{1,2},{3,1},{1,2},{3,1},{-2,3},{4,1},{-3,2} }, { {-6,0},{4,3},{2,3},{1,2},{0,2},{3,3},{4,1},{-3,2},{4,2},{-3,1},{0,3} }, { {-6,0},{4,3},{1,2},{-3,1},{4,3},{2,3},{4,1},{-3,2},{3,3},{0,3} }, { {-6,0},{4,3},{2,1},{-3,2},{4,2},{-3,1},{4,3},{0,1},{3,2},{3,1},{-3,2},{1,3} }, /* 201 */ { {-4,0},{2,3},{3,2},{-3,1},{2,1},{3,2},{-1,1},{3,2},{2,2},{-3,1},{4,3} }, { {-4,0},{2,3},{3,2},{-3,1},{2,1},{3,2},{0,2},{3,1},{1,2},{-3,1},{4,3} }, { {-5,0},{3,1},{0,3},{3,2},{-3,1},{2,1},{3,2},{1,3},{3,2},{-3,1},{3,2} }, { {-4,0},{2,3},{3,2},{-3,1},{3,2},{3,1},{-2,1},{3,2},{2,2},{-3,1},{4,3} }, { {-4,0},{1,2},{3,1},{1,2},{-3,1},{4,3},{0,1},{3,2},{2,2},{-3,1},{4,3} }, /* 206 */ { {-4,0},{2,3},{3,2},{-3,1},{2,1},{3,2},{-1,1},{3,2},{3,1},{-3,2},{3,1} }, { {-3,0},{1,3},{3,2},{-3,1},{2,1},{3,2},{1,3},{4,1},{-3,2},{1,1},{3,2} }, { {-3,0},{1,3},{3,2},{-3,1},{3,2},{3,1},{0,3},{4,1},{-3,2},{1,1},{3,2} } }; short construct[90][2] = { {-1,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2}, {-1,3},{0,3},{0,3},{0,3},{0,3},{0,3},{0,3}, {-1,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2}, {-1,3},{0,3},{0,3},{0,3},{0,3},{0,3},{0,3}, {-1,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2}, {-1,3},{0,3},{0,3},{0,3},{0,3},{0,3},{0,3}, {-1,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2}, {-1,3},{0,3},{0,3},{0,3},{0,3},{0,3},{0,3}, {-1,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2}, {-1,3},{0,3},{0,3},{0,3},{0,3},{0,3},{0,3}, {-1,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2},{0,2}, {-1,3},{0,3},{0,3},{0,3},{0,3},{0,3},{0,3} }; //void fit_two_best(int a; int b) //{ //} typedef struct bod { double x,y; struct bod *next; } point; int main(void) { double dfi = UHEL/180.*M_PI,x,y,xpoc,ypoc,r; double x1,x2,x3,y1,y2,y3,xa,ya,tria; double deg = UHEL; double area,obvod,celk_area = 0,celk_obvod = 0; int tr[6]; int sign; point *first,*cur,*end; int ifi,nfi,i,j,npoly = 0; /* request auto detection */ int gdriver = DETECT, gmode, errorcode; /* initialize graphics mode */ initgraph(&gdriver, &gmode, "EGAVGA.BGI"); /* read result of initialization */ errorcode = graphresult(); if (errorcode != grOk) /* an error occurred */ { printf("Graphics error: %s\n", grapherrormsg(errorcode)); printf("Press any key to halt:"); getch(); exit(1); /* return with error code */ } for (j = START ; j < POCET; j++ ) { { gotoxy(1,1); printf("polygon : %d\n",j+1); first = cur = end = NULL; setcolor(LIGHTGREEN); moveto(getmaxx()/2,getmaxy()/2); xpoc=x=getx();ypoc=y=gety(); nfi=0; ifi=polygons[j][0][0]; i=1; obvod = 0; do { nfi += polygons[j][i][0]; cur = calloc(1,sizeof(point)); if (first == NULL) { first = cur; end = cur; } else { end->next = cur; end = end->next; } switch (polygons[j][i++][1]) { case 1: { r = 0.5; break; } case 2: { r = sqrt(0.75); break; } case 3: { r = 1.0; } } cur->x = x += DELKA*r*cos((ifi+nfi)*dfi); cur->y = y += DELKA*r*sin((ifi+nfi)*dfi); obvod += r; lineto(x,y); if (i == NL) break; } while (i < 2 || fabs(xpoc-x) > 1e-6 || fabs(ypoc-y) > 1e-6); } if (i != 14 && fabs(nfi*dfi-2*M_PI) < 1e-6) { end->next = first; area = 0; cur = first; while (cur != cur->next->next) { tr[0] = x1 = cur->x; tr[2] = x2 = cur->next->x; tr[4] = x3 = cur->next->next->x; tr[1] = y1 = cur->y; tr[3] = y2 = cur->next->y; tr[5] = y3 = cur->next->next->y; if ( ( tria = (x2-x1)*(y3-y2)-(x3-x2)*(y2-y1) ) >= 0 ) { sign = 0; end = cur->next->next; while (cur != end->next) { xa = end->next->x; ya = end->next->y; if ( (xa-x1)*(y3-ya)-(x3-xa)*(ya-y1) > 0 && (xa-x2)*(y1-ya)-(x1-xa)*(ya-y2) > 0 && (xa-x3)*(y2-ya)-(x2-xa)*(ya-y3) > 0 ) { sign++; } end = end->next; } if ( !sign ) { setfillstyle(10,YELLOW); fillpoly(3,tr); area += tria/2/DELKA/DELKA; end = cur->next; cur->next = cur->next->next; free(end); } } cur = cur->next; } free(cur->next); free(cur); celk_area += area; celk_obvod += obvod; npoly++; printf("number of sides = %d\narea = %13.7f\n",i-1,area); printf("perimeter = %13.7f\n",obvod); delay(50); // getch(); } else { printf("ERROR\n"); getch(); } cleardevice(); } closegraph(); gotoxy(1,1); printf("whole perimeter = %13.7f\nwhole area = %13.7f\n",celk_obvod,celk_area); printf("number of polygons = %d\n",npoly); printf("perimeter of the final eight vertex polygon = %13.7f\n",6*(7+8*sqrt(0.75))); printf("area of the final eight vertex polygon = %13.7f\n",209*3*sqrt(0.75)); printf("predicted length border of two neighbours = %13.7f\n",celk_obvod/6/npoly); if (fabs(209*3*sqrt(0.75)-celk_area) < 1e-9) { printf("We can continue.\n"); } else { printf("We can not continue.\n"); } return 0; }