Click here to Skip to main content
16,008,299 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to scroll the Edit box without flash Pin
LaHaHa20-Nov-05 14:25
LaHaHa20-Nov-05 14:25 
AnswerRe: How to scroll the Edit box without flash Pin
Yiling Lai20-Nov-05 16:03
Yiling Lai20-Nov-05 16:03 
GeneralRe: How to scroll the Edit box without flash Pin
LaHaHa20-Nov-05 18:11
LaHaHa20-Nov-05 18:11 
QuestionMFCListCtrl Question Pin
kevin12720-Nov-05 11:14
kevin12720-Nov-05 11:14 
AnswerRe: MFCListCtrl Question Pin
followait20-Nov-05 14:55
followait20-Nov-05 14:55 
GeneralRe: MFCListCtrl Question Pin
kevin12720-Nov-05 15:51
kevin12720-Nov-05 15:51 
GeneralRe: MFCListCtrl Question Pin
kevin12720-Nov-05 15:59
kevin12720-Nov-05 15:59 
QuestionAre plugins necessary in this situation? Pin
hymerman20-Nov-05 10:49
hymerman20-Nov-05 10:49 
Hi peoples! This is my first post here, and hopefully not my last.

Anyway, I'll skip the intro and the backstory, and just tell you my problem- I have an aLife simulation in which there will be several 'creatures' which need to 'think' every frame. Originally, each would be controlled by an evolvable program, but due to time constraints in obtaining results from the simulation, I'm now planning a system whereby each section of the thinking method has several options, determined by the 'genetic code' of the creature.

An example, to clarify: There may exist several methods for choosing a target within a creature's visual field; the creature may want to focus on the brightest object, the fastest moving object, the object most like itself, the tastiest looking object, etc. etc.. Each of these strategies would be coded a slightly different way, and depending on what gene a particular creature has for 'target choosing' a different piece of code would need to be executed.

So, basically, I have a method, which I want to insert different snippets of code into, at runtime. My question is: what is the best method of achieving this? I have considered three possibilities so far:

1. A very big switch statement. It would simply choose which bit of code to execute depending on what the value of the gene for a particular thing is. This method would work, and would work well, but it would be a nightmare to maintain and is just a bit crap really!

2. Hard code the snippets as functions somewhere in another file, and store pointers to those functions in the creature objects- call the functions with the appropriate parameters in the 'think' method. This is tidyer, but is still not an elegant solution, and I can see problems developing in not knowing numbers of parameters and whatnot beforehand.

3. Some kind of clever plugin system, whereby each snippet of code is pre-compiled and able to be linked in and used at run-time. Very extensible, very slick, but really hard to do, a lot of work (since it'll be cross platform, a lot of compiling will need to go on I guess), and I'm not sure if it's really necessary, or particularly diferent from option number 2.

Hopefully one of you chaps will be able to suggest a mystery 4th option, I'm hoping for something similar to option 2 but a bit more elegant and robust! Thanks in advance for your help, folks!
AnswerRe: Are plugins necessary in this situation? Pin
Roger Allen21-Nov-05 6:54
Roger Allen21-Nov-05 6:54 
GeneralRe: Are plugins necessary in this situation? Pin
hymerman21-Nov-05 13:29
hymerman21-Nov-05 13:29 
QuestionCHtmlView Question Pin
Mohammad A Gdeisat20-Nov-05 10:07
Mohammad A Gdeisat20-Nov-05 10:07 
AnswerRe: CHtmlView Question Pin
Sheng Jiang 蒋晟20-Nov-05 10:35
Sheng Jiang 蒋晟20-Nov-05 10:35 
GeneralRe: CHtmlView Question Pin
vikas amin21-Nov-05 0:54
vikas amin21-Nov-05 0:54 
QuestionCFile::GetPosition and Seek Pin
Felagund226820-Nov-05 8:18
Felagund226820-Nov-05 8:18 
AnswerRe: CFile::GetPosition and Seek Pin
Mircea Puiu20-Nov-05 9:58
Mircea Puiu20-Nov-05 9:58 
GeneralRe: CFile::GetPosition and Seek Pin
Felagund226820-Nov-05 10:51
Felagund226820-Nov-05 10:51 
QuestionMFC application migration to C# Pin
jacka199920-Nov-05 7:59
jacka199920-Nov-05 7:59 
AnswerRe: MFC application migration to C# Pin
ThatsAlok20-Nov-05 21:30
ThatsAlok20-Nov-05 21:30 
AnswerRe: MFC application migration to C# Pin
jacka199921-Nov-05 9:05
jacka199921-Nov-05 9:05 
QuestionHow to establish the programming enviroment to begin my DirectX program? Pin
sude20-Nov-05 2:50
sude20-Nov-05 2:50 
AnswerRe: How to establish the programming enviroment to begin my DirectX program? Pin
Gary R. Wheeler20-Nov-05 3:29
Gary R. Wheeler20-Nov-05 3:29 
QuestionVS 2005 Add-Ins Pin
Franz Klein20-Nov-05 0:15
Franz Klein20-Nov-05 0:15 
QuestionCreateFile in ext2 Pin
Aqueel19-Nov-05 21:03
Aqueel19-Nov-05 21:03 
AnswerRe: CreateFile in ext2 Pin
kakan20-Nov-05 19:59
professionalkakan20-Nov-05 19:59 
QuestionSignature bytes Pin
zooley19-Nov-05 20:18
zooley19-Nov-05 20:18 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.