Hi, another program by me, this one recognises ANY letter you want him to recognise!

Only bug is that you can't input a letter, you will have to do it you're self.

Do you like it?Code:#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <time.h> float weight[100]; bool percept[100]; int input[100]; int goal; int lc; float threshold = 0.5f; int successive_right = 0; int total_go_round = 1; const float learning_rate = 0.1f; int educate() { int sign = goal ? 1 : -1; //sign of (y-f(x)) weight[0] += learning_rate*sign*input[0]; weight[1] += learning_rate*sign*input[1]; weight[2] += learning_rate*sign*input[2]; weight[3] += learning_rate*sign*input[3]; weight[4] += learning_rate*sign*input[4]; weight[5] += learning_rate*sign*input[5]; weight[6] += learning_rate*sign*input[6]; weight[7] += learning_rate*sign*input[7]; weight[8] += learning_rate*sign*input[8]; weight[9] += learning_rate*sign*input[9]; weight[10] += learning_rate*sign*input[10]; weight[11] += learning_rate*sign*input[11]; weight[12] += learning_rate*sign*input[12]; weight[13] += learning_rate*sign*input[13]; weight[14] += learning_rate*sign*input[14]; weight[15] += learning_rate*sign*input[15]; weight[16] += learning_rate*sign*input[16]; weight[17] += learning_rate*sign*input[17]; weight[18] += learning_rate*sign*input[18]; weight[19] += learning_rate*sign*input[19]; weight[20] += learning_rate*sign*input[20]; weight[21] += learning_rate*sign*input[21]; weight[22] += learning_rate*sign*input[22]; weight[23] += learning_rate*sign*input[23]; weight[24] += learning_rate*sign*input[24]; weight[25] += learning_rate*sign*input[25]; weight[26] += learning_rate*sign*input[26]; weight[27] += learning_rate*sign*input[27]; weight[28] += learning_rate*sign*input[28]; weight[29] += learning_rate*sign*input[29]; weight[30] += learning_rate*sign*input[30]; weight[31] += learning_rate*sign*input[31]; weight[32] += learning_rate*sign*input[32]; weight[33] += learning_rate*sign*input[33]; weight[34] += learning_rate*sign*input[34]; weight[35] += learning_rate*sign*input[35]; weight[36] += learning_rate*sign*input[36]; weight[37] += learning_rate*sign*input[37]; weight[38] += learning_rate*sign*input[38]; weight[39] += learning_rate*sign*input[39]; weight[40] += learning_rate*sign*input[40]; weight[41] += learning_rate*sign*input[41]; weight[42] += learning_rate*sign*input[42]; weight[43] += learning_rate*sign*input[43]; weight[44] += learning_rate*sign*input[44]; weight[45] += learning_rate*sign*input[45]; weight[46] += learning_rate*sign*input[46]; weight[47] += learning_rate*sign*input[47]; weight[48] += learning_rate*sign*input[48]; weight[49] += learning_rate*sign*input[49]; weight[50] += learning_rate*sign*input[50]; weight[51] += learning_rate*sign*input[51]; weight[52] += learning_rate*sign*input[52]; weight[53] += learning_rate*sign*input[53]; weight[54] += learning_rate*sign*input[54]; weight[55] += learning_rate*sign*input[55]; weight[56] += learning_rate*sign*input[56]; weight[57] += learning_rate*sign*input[57]; weight[58] += learning_rate*sign*input[58]; weight[59] += learning_rate*sign*input[59]; weight[60] += learning_rate*sign*input[60]; weight[61] += learning_rate*sign*input[61]; weight[62] += learning_rate*sign*input[62]; weight[63] += learning_rate*sign*input[63]; weight[64] += learning_rate*sign*input[64]; weight[65] += learning_rate*sign*input[65]; weight[66] += learning_rate*sign*input[66]; weight[67] += learning_rate*sign*input[67]; weight[68] += learning_rate*sign*input[68]; weight[69] += learning_rate*sign*input[69]; weight[70] += learning_rate*sign*input[70]; weight[71] += learning_rate*sign*input[71]; weight[72] += learning_rate*sign*input[72]; weight[73] += learning_rate*sign*input[73]; weight[74] += learning_rate*sign*input[74]; weight[75] += learning_rate*sign*input[75]; weight[76] += learning_rate*sign*input[76]; weight[77] += learning_rate*sign*input[77]; weight[78] += learning_rate*sign*input[78]; weight[79] += learning_rate*sign*input[79]; weight[80] += learning_rate*sign*input[80]; weight[81] += learning_rate*sign*input[81]; weight[82] += learning_rate*sign*input[82]; weight[83] += learning_rate*sign*input[83]; weight[84] += learning_rate*sign*input[84]; weight[85] += learning_rate*sign*input[85]; weight[86] += learning_rate*sign*input[86]; weight[87] += learning_rate*sign*input[87]; weight[88] += learning_rate*sign*input[88]; weight[89] += learning_rate*sign*input[89]; weight[90] += learning_rate*sign*input[90]; weight[91] += learning_rate*sign*input[91]; weight[92] += learning_rate*sign*input[92]; weight[93] += learning_rate*sign*input[93]; weight[94] += learning_rate*sign*input[94]; weight[95] += learning_rate*sign*input[95]; weight[96] += learning_rate*sign*input[96]; weight[97] += learning_rate*sign*input[97]; weight[98] += learning_rate*sign*input[98]; weight[99] += learning_rate*sign*input[99]; printf("%d", percept[0]); return; } int main(){ srand(time(NULL)); scanf("%d", &lc); while(total_go_round <= lc){ //letter input, 10x10 pixels percept[0] = (weight[0]*input[0]+weight[1]*input[1]+weight[2]*input[2]+weight[3]*input[3]+weight[4]*input[4]+weight [5]*input[5]+weight[6]*input[6]+weight[7]*input[7]+weight[8]*input[8]+weight[9]*input[9]+weight[10]*input[10]+weight[11]*input[11]+weight[12]*input[12]+weight[13]*input[13]+weight[14]*input[14]+weight[15]*input[15]+weight[16]*input[16]+weight[17]*input[17]+weight[18]*input[18]+weight[19]*input[19]+weight[20]*input[20]+weight[21]*input[21]+weight[22]*input[22]+weight[23]*input[23]+weight[24]*input[24]+weight[25]*input[25]+weight[26]*input[26]+weight[27]*input[27]+weight[28]*input[28]+weight[29]*input[29]+weight[30]*input[30]+weight[31]*input[31]+weight[32]*input[32]+weight[33]*input[33]+weight[34]*input[34]+weight[35]*input[35]+weight[36]*input[36]+weight[37]*input[37]+weight[38]*input[38]+weight[39]*input[39]+weight[40]*input[40]+weight[41]*input[41]+weight[42]*input[42]+weight[43]*input[43]+weight[44]*input[44]+weight[45]*input[45]+weight[46]*input[46]+weight[47]*input[47]+weight[48]*input[48]+weight[49]*input[49]+weight[50]*input[50]+weight[51]*input[51]+weight[52]*input[52]+weight[53]*input[53]+weight[54]*input[54]+weight[55]*input[55]+weight[56]*input[56]+weight[57]*input[57]+weight[58]*input[58]+weight[59]*input[59]+weight[60]*input[60]+weight[61]*input[61]+weight[62]*input[62]+weight[63]*input[63]+weight[64]*input[64]+weight[65]*input[65]+weight[66]*input[66]+weight[67]*input[67]+weight[68]*input[68]+weight[69]*input[69]+weight[70]*input[70]+weight[71]*input[71]+weight[72]*input[72]+weight[73]*input[73]+weight[74]*input[74]+weight[75]*input[75]+weight[76]*input[76]+weight[77]*input[77]+weight[78]*input[78]+weight[79]*input[79]+weight[80]*input[80]+weight[81]*input[81]+weight[82]*input[82]+weight[83]*input[83]+weight[84]*input[84]+weight[85]*input[85]+weight[86]*input[86]+weight[87]*input[87]+weight[88]*input[88]+weight[89]*input[89]+weight[90]*input[90]+weight[91]*input[91]+weight[92]*input[92]+weight[93]*input[93]+weight[94]*input[94]+weight[95]*input[95]+weight[96]*input[96]+weight[97]*input[97]+weight[98]*input[98]+weight[99]*input[99]) > threshold; printf("perceptron: "); printf("%d\n", percept[0]); scanf("%d", &goal); switch(goal){ case 1: educate(); break; default: educate(); } total_go_round++; } return 0; }