From: Meino Christian Cramer Date: 2004-08-19T16:21:59+09:00 Subject: Re: POT (partly offtopic) Re: Q: Shifting a hash anf and array From: "Robert Klemme" Subject: Re: POT (partly offtopic) Re: Q: Shifting a hash anf and array Date: Wed, 18 Aug 2004 19:10:56 +0900 Hi Robert, Hi Rubyaner ! :) Enigma is growing. Currently it does scrambling text. Unfortunately it is an absolut safe encyphiering algorithm at the moment...there is NO way back to the clear text...even for the sender. Or to call it more realistic: Enigma is currently still a little buggy :) With the real Enigma you could change the wheels (or "rotors"). Each wheel had have an hardwired inside. I thought of simulating this by creating an rotot-object for each wheel. rotor.encode() would encode the letter, which was "feed into" the certain wheel. By putting three (or four) rotor-objects in serial this would simulate the encoding phase of all wheels currently "put into" the Enigma. The rotating algorithm is a liitle more difficult. Each letter feed into the first wheel will rotate this wheel by one step. At certain positions of the rotation of the first wheel, the second wheel was rotated by one step. And so on. To abstract this from the user choosen configuration of the Enigma I want to do something a little similiar to C's function pointer call. Is there a way to put different instances of the same class into an array, then stepping through the array and call a certain method for each of the objects? Something like: objarray=Array.new objarray[idx]=Rotor.new(config) encchar=objarray[idx].method(param) ? How do I have to tell this to Ruby ? Thank you very much for any hint or help in advance! Meino