• Content count

  • Joined

  • Last visited

Community Reputation

145 Neutral

About Marty666

  • Rank
  1. thanx a lot! This one is so simple that it's in no help files. I feel really noob. Thanx again.
  2. Hi all... I have a card class for a card game that inherits from the window pictureBox. It is draggable and have a rank and suit variable. The problem is that I don't know how to make it comparable by rank to use in a list. Normally i would use: public class card : IComparable<card> But I can't do public class card : System.Windows.Forms.PictureBox : IComparable<card> What would be a nice solution? Thanx! Marty
  3. Hi all, I'm planning to make a pokergame with simple graphics using a windows interface. Since I don't have a lot of experience doing any windows programming I'd like to find a drag and drop type of editor where I only have to do the code behind the interface (like delphi, but using c++ or java). Can anyone point me some tools? I prefer free tools as I am a poor student :) Thanx all!
  4. check out NERO (neuro evolving robotic operatives) that uses NEAT and have phun :D Marty
  5. Thanx all! I know the compiler is old, but didn't know it was buggy. I used the compiler that comes with code::blocks and it works fine now :D. I just love the extensive documentation with MSVC and code::blocks doesn't seem to have any documentation. Also it doesn't automatically track variables. I'll try the 2005 version. Thanx for all the help! Marty
  6. Hey Very strange: I copy pasted the implementation of the 'eval' function to the definition and the problem seems to be solved... I'm using MSVC6.0, might this be a bug? I'll also try it with the GNU GCC compiler... I'll let you know. Marty
  7. Hi, I read the link xEricx send. It seems to me the error is in the function where i use the value input[i]. Both a vector<double> as a vector<node> would be able to return a double, so I don't get why I still get the error. I tried to static_cast the value (see below), but it didn't help. Anyone know what's wrong? Marty template<typename T> void node::eval(const std::vector<T> &input) { assert(input.size() == inputWeight.size()); value = 0; for(unsigned int i = 0; i < input.size(); i++) { value += static_cast<double>(input[i]) * inputWeight[i]; } lastInput = value; value = sigmoid(value); }
  8. Line 49 calls the eval function, where input is a vector<double>: for (i = 0; i < hiddenNode.size(); i++) hiddenNode[i].eval(input); Thanx for the fast reply! Marty
  9. hi all. I've got this template function 'eval' in the 'node' class that should be able to handle vector<double> aswell as vector<node>. Only I get this error: ...\neuralnet.cpp(49) : error C2893: Failed to specialize function template 'void __thiscall node::eval(const class std::vector<T, class std::allocator<T> > &)' With the following template arguments:'double' Here's the relevant source of node: // nnet.h class node { public: node::node(unsigned int numInputs) : lastInput(0) { inputWeight.resize(numInputs); for (unsigned int i = 0; i < numInputs; i++) inputWeight[i] = rand() / static_cast<double>(RAND_MAX); } template<typename T> void eval(const std::vector<T> &input); operator double() const {return value;} double getWeight(unsigned int weightNum) const; void setWeight(unsigned int weightNum, double newWeight); double getLastInput() const; void setValue(double newValue); private: std::vector<double> inputWeight; double value; double lastInput; }; // nnet.cpp template<typename T> void node::eval(const std::vector<T> &input) { assert(input.size() == inputWeight.size()); value = 0; for(unsigned int i = 0; i < input.size(); i++) { value += input[i] * inputWeight[i]; } lastInput = value; value = sigmoid(value); } Can anyone help out? Thanx, Marty [Edited by - Marty666 on April 30, 2006 4:55:15 PM]
  10. Operator [] overloading

    Hi, I copy pasted the contents of nnet.cpp (the implementation of the neural net class) to nnet.h.... It works now, although I'd rather have the definition and implementation in different files. Is this possible? Thanx, Marty
  11. Operator [] overloading

    Hi, I have 5 files: main.cpp nnet.h nnet.cpp martybot.h martybot.cpp nnet.cpp includes nnet.h and implements the neuralnet class martybot.h includes nnet.h (which should be enough, right?) in martybot.cpp the error occured. It includes martybot.h, so it should automatically include nnet.h aswell.... should all the implementation of a template class be in the same file as the definition??? thanx for the reply, Marty
  12. Operator [] overloading

    I get it, thanx Nick! Another question: I've got a template class: template<unsigned int NUM_INPUTS, unsigned int NUM_HIDDEN, unsigned int NUM_OUTPUTS> class nnet { public: nnet(); // mutates the network void mutate(float rate); // backpropagates one case through the network and returns the average output error float backprop(float inputs[NUM_INPUTS], float correctinput[NUM_INPUTS], float learningrate); // forward propagates one case through the network. void forwardprop(); // holds the inputs float inputs[NUM_INPUTS]; // holds the output values float outputs[NUM_OUTPUTS]; private: // holds the values of the hidden neurons float hidden[NUM_HIDDEN]; // sigmoid function float sigmoid(float x); // deridative of sigmoid function float dsigmoid(float x); // holds the connection weights from input- to hidden neurons float icon[NUM_INPUTS][NUM_HIDDEN]; // holds the connection weights from hidden- to output neurons float hcon[NUM_HIDDEN][NUM_OUTPUTS]; // generates random float between -1 and 1 float myrandom(); }; Somewhere else i have this code: typedef nnet<65, 6, 3> T_MAINNET; // and somewhere else T_MAINNET mainnet; mainnet.feedforward(); I get an error saying: ... .objs\martybot.o:martybot.cpp:(.text+0x7e): undefined reference to `nnet<65u, 6u, 3u>::forwardprop()' collect2: ld returned 1 exit status I have no clue what's wrong... Can anyone help out? Thanx! Marty
  13. Operator [] overloading

    Quote:Original post by NickGravelyn *** Source Snippet Removed *** Thanx Nick, but is it still possible to do: SomeStuff s; SomeStuff[3] = 1.0f; Or does it have to be a reference? Marty
  14. Operator [] overloading

    can it be done like this? float& myclass::operator [] (unsigned int i); { return &myvars[i]; } thanx, Marty
  15. Hi all, I was wondering how i could overload the [] operator to make it possible to do this, like in an array: somevar = myclass[4]; and this: myclass[4] = somevar; can someone give me an example? Thanx! Marty