Whihc compiler did you use for Human OS V1.0? Didnt realize we had a CPP compiler out already....hmmmm
Jiri Jelinek <[EMAIL PROTECTED]> wrote: Matt, >Here is a program that feels pain. I got the logic, but no pain when processing the code in my mind. Maybe you should mention in the pain.cpp description that it needs to be processed for long enough - so whatever is gonna process it, it will eventually get to the 'I don't "feel" like doing this any more' point. ;-)) Looks like the entropy is kind of "pain" to us (& to our devices) and the negative entropy might be kind of "pain" to the universe. Hopefully, when (/if) our AGI figures this out, it will not attempt to squeeze the Universe into a single spot to "solve" it. Regards, Jiri Jelinek On 6/11/07, Matt Mahoney wrote: > Here is a program that feels pain. It is a simulation of a 2-input logic gate > that you train by reinforcement learning. It "feels" in the sense that it > adjusts its behavior to avoid negative reinforcement from the user. > > > /* pain.cpp - A program that can feel pleasure and pain. > > The program simulates a programmable 2-input logic gate. > You train it by reinforcement conditioning. You provide a pair of > input bits (00, 01, 10, or 11). It will output a 0 or 1. If the > output is correct, you "reward" it by entering "+". If it is wrong, > you "punish" it by entering "-". You can program it this way to > implement any 2-input logic function (AND, OR, XOR, NAND, etc). > */ > > #include > #include > using namespace std; > > int main() { > // probability of output 1 given input 00, 01, 10, 11 > double wt[4]={0.5, 0.5, 0.5, 0.5}; > > while (1) { > cout << "Please input 2 bits (00, 01, 10, 11): "; > char b1, b2; > cin >> b1 >> b2; > int input = (b1-'0')*2+(b2-'0'); > if (input >= 0 && input < 4) { > int response = double(rand())/RAND_MAX < wt[input]; > cout << "Output = " << response > << ". Please enter + if right, - if wrong: "; > char reinforcement; > cin >> reinforcement; > if (reinforcement == '+') > cout << "aah! :-)\n"; > else if (reinforcement == '-') > cout << "ouch! :-(\n"; > else > continue; > int adjustment = (reinforcement == '-') ^ response; > if (adjustment == 0) > wt[input] /= 2; > else > wt[input] = 1 - (1 - wt[input])/2; > } > } > } ----- This list is sponsored by AGIRI: http://www.agiri.org/email To unsubscribe or change your options, please go to: http://v2.listbox.com/member/?& _______________________________________ James Ratcliff - http://falazar.com Looking for something... --------------------------------- Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. ----- This list is sponsored by AGIRI: http://www.agiri.org/email To unsubscribe or change your options, please go to: http://v2.listbox.com/member/?member_id=231415&user_secret=e9e40a7e