Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: N5110 SDFileSystem mbed
Patterns.cpp
00001 #include "Patterns.h" 00002 00003 // type rotation y x 00004 int pattern[7][4][6][6] = { 00005 //type 0: L 00006 //type 1: L mirrored 00007 //type 2: I 00008 //type 3: T 00009 //type 4: square 00010 //type 5: N 00011 //type 6: N mirrored 00012 { 00013 //L 00014 { 00015 {1,1,0,0,0,0}, 00016 {1,1,0,0,0,0}, 00017 {1,1,0,0,0,0}, 00018 {1,1,0,0,0,0}, 00019 {1,1,1,1,0,0}, 00020 {1,1,1,1,0,0} 00021 }, { 00022 {0,0,0,0,0,0}, 00023 {0,0,0,0,0,0}, 00024 {0,0,0,0,1,1}, 00025 {0,0,0,0,1,1}, 00026 {1,1,1,1,1,1}, 00027 {1,1,1,1,1,1} 00028 }, { 00029 {0,0,1,1,1,1}, 00030 {0,0,1,1,1,1}, 00031 {0,0,0,0,1,1}, 00032 {0,0,0,0,1,1}, 00033 {0,0,0,0,1,1}, 00034 {0,0,0,0,1,1} 00035 }, { 00036 {1,1,1,1,1,1}, 00037 {1,1,1,1,1,1}, 00038 {1,1,0,0,0,0}, 00039 {1,1,0,0,0,0}, 00040 {0,0,0,0,0,0}, 00041 {0,0,0,0,0,0} 00042 } 00043 }, 00044 00045 { 00046 //L mirrored 00047 { 00048 {0,0,0,0,1,1}, 00049 {0,0,0,0,1,1}, 00050 {0,0,0,0,1,1}, 00051 {0,0,0,0,1,1}, 00052 {0,0,1,1,1,1}, 00053 {0,0,1,1,1,1} 00054 }, { 00055 {1,1,1,1,1,1}, 00056 {1,1,1,1,1,1}, 00057 {0,0,0,0,1,1}, 00058 {0,0,0,0,1,1}, 00059 {0,0,0,0,0,0}, 00060 {0,0,0,0,0,0} 00061 }, { 00062 {1,1,1,1,0,0}, 00063 {1,1,1,1,0,0}, 00064 {1,1,0,0,0,0}, 00065 {1,1,0,0,0,0}, 00066 {1,1,0,0,0,0}, 00067 {1,1,0,0,0,0} 00068 }, { 00069 {0,0,0,0,0,0}, 00070 {0,0,0,0,0,0}, 00071 {1,1,0,0,0,0}, 00072 {1,1,0,0,0,0}, 00073 {1,1,1,1,1,1}, 00074 {1,1,1,1,1,1} 00075 } 00076 }, 00077 00078 { 00079 //I 00080 { 00081 {0,0,0,0,0,0}, 00082 {0,0,0,0,0,0}, 00083 {1,1,1,1,1,1}, 00084 {1,1,1,1,1,1}, 00085 {0,0,0,0,0,0}, 00086 {0,0,0,0,0,0} 00087 }, { 00088 {0,0,1,1,0,0}, 00089 {0,0,1,1,0,0}, 00090 {0,0,1,1,0,0}, 00091 {0,0,1,1,0,0}, 00092 {0,0,1,1,0,0}, 00093 {0,0,1,1,0,0} 00094 }, { 00095 {0,0,0,0,0,0}, 00096 {0,0,0,0,0,0}, 00097 {1,1,1,1,1,1}, 00098 {1,1,1,1,1,1}, 00099 {0,0,0,0,0,0}, 00100 {0,0,0,0,0,0} 00101 }, { 00102 {0,0,1,1,0,0}, 00103 {0,0,1,1,0,0}, 00104 {0,0,1,1,0,0}, 00105 {0,0,1,1,0,0}, 00106 {0,0,1,1,0,0}, 00107 {0,0,1,1,0,0} 00108 } 00109 }, 00110 00111 { 00112 //T 00113 { 00114 {0,0,0,0,0,0}, 00115 {0,0,0,0,0,0}, 00116 {0,0,1,1,0,0}, 00117 {0,0,1,1,0,0}, 00118 {1,1,1,1,1,1}, 00119 {1,1,1,1,1,1} 00120 }, { 00121 {0,0,0,0,1,1}, 00122 {0,0,0,0,1,1}, 00123 {0,0,1,1,1,1}, 00124 {0,0,1,1,1,1}, 00125 {0,0,0,0,1,1}, 00126 {0,0,0,0,1,1} 00127 }, { 00128 {1,1,1,1,1,1}, 00129 {1,1,1,1,1,1}, 00130 {0,0,1,1,0,0}, 00131 {0,0,1,1,0,0}, 00132 {0,0,0,0,0,0}, 00133 {0,0,0,0,0,0} 00134 }, { 00135 {1,1,0,0,0,0}, 00136 {1,1,0,0,0,0}, 00137 {1,1,1,1,0,0}, 00138 {1,1,1,1,0,0}, 00139 {1,1,0,0,0,0}, 00140 {1,1,0,0,0,0} 00141 } 00142 }, 00143 00144 { 00145 //square 00146 { 00147 {1,1,1,1,0,0}, 00148 {1,1,1,1,0,0}, 00149 {1,1,1,1,0,0}, 00150 {1,1,1,1,0,0}, 00151 {0,0,0,0,0,0}, 00152 {0,0,0,0,0,0} 00153 }, { 00154 {1,1,1,1,0,0}, 00155 {1,1,1,1,0,0}, 00156 {1,1,1,1,0,0}, 00157 {1,1,1,1,0,0}, 00158 {0,0,0,0,0,0}, 00159 {0,0,0,0,0,0} 00160 }, { 00161 {1,1,1,1,0,0}, 00162 {1,1,1,1,0,0}, 00163 {1,1,1,1,0,0}, 00164 {1,1,1,1,0,0}, 00165 {0,0,0,0,0,0}, 00166 {0,0,0,0,0,0} 00167 }, { 00168 {1,1,1,1,0,0}, 00169 {1,1,1,1,0,0}, 00170 {1,1,1,1,0,0}, 00171 {1,1,1,1,0,0}, 00172 {0,0,0,0,0,0}, 00173 {0,0,0,0,0,0} 00174 } 00175 }, 00176 00177 { 00178 //N 00179 { 00180 {1,1,0,0,0,0}, 00181 {1,1,0,0,0,0}, 00182 {1,1,1,1,0,0}, 00183 {1,1,1,1,0,0}, 00184 {0,0,1,1,0,0}, 00185 {0,0,1,1,0,0} 00186 }, { 00187 {0,0,0,0,0,0}, 00188 {0,0,0,0,0,0}, 00189 {0,0,1,1,1,1}, 00190 {0,0,1,1,1,1}, 00191 {1,1,1,1,0,0}, 00192 {1,1,1,1,0,0} 00193 }, { 00194 {0,0,1,1,0,0}, 00195 {0,0,1,1,0,0}, 00196 {0,0,1,1,1,1}, 00197 {0,0,1,1,1,1}, 00198 {0,0,0,0,1,1}, 00199 {0,0,0,0,1,1} 00200 }, { 00201 {0,0,1,1,1,1}, 00202 {0,0,1,1,1,1}, 00203 {1,1,1,1,0,0}, 00204 {1,1,1,1,0,0}, 00205 {0,0,0,0,0,0}, 00206 {0,0,0,0,0,0} 00207 } 00208 }, 00209 00210 { 00211 //N mirrored 00212 { 00213 {0,0,1,1,0,0}, 00214 {0,0,1,1,0,0}, 00215 {1,1,1,1,0,0}, 00216 {1,1,1,1,0,0}, 00217 {1,1,0,0,0,0}, 00218 {1,1,0,0,0,0} 00219 }, { 00220 {0,0,0,0,0,0}, 00221 {0,0,0,0,0,0}, 00222 {1,1,1,1,0,0}, 00223 {1,1,1,1,0,0}, 00224 {0,0,1,1,1,1}, 00225 {0,0,1,1,1,1} 00226 }, { 00227 {0,0,0,0,1,1}, 00228 {0,0,0,0,1,1}, 00229 {0,0,1,1,1,1}, 00230 {0,0,1,1,1,1}, 00231 {0,0,1,1,0,0}, 00232 {0,0,1,1,0,0} 00233 }, { 00234 {1,1,1,1,0,0}, 00235 {1,1,1,1,0,0}, 00236 {0,0,1,1,1,1}, 00237 {0,0,1,1,1,1}, 00238 {0,0,0,0,0,0}, 00239 {0,0,0,0,0,0} 00240 } 00241 } 00242 00243 }; 00244 00245 int Patterns::getPatterns(int type, int rotation, int y, int x) 00246 { 00247 return pattern[type][rotation][y][x]; 00248 }
Generated on Mon Sep 12 2022 12:25:09 by
1.7.2