[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
help with first Swarm app
From: |
James Marshall |
Subject: |
help with first Swarm app |
Date: |
Mon, 18 May 1998 16:03:45 GMT |
Hello all,
I'm new to Swarm and am trying to write/compile my first app,
following Chris Langton's SimpleBug tutorial. I'm trying to create a
class which inherits from Discrete2d, as done in SimpleBug. Here's
the code I've written
//EPDWorld.h EPD
#import <space.h>
#import <collections.h>
#import <random.h>
@interface EPDWorld : Discrete2d
{
int maxAgents, startAgents, population, strategyLength;
float deathProbability, mutationRate;
}
-setup: (int) x ySize: (int) y maxAgents: (int) maxPop startAgents:
(int) startPop strategyLength: (int) stratLen deathProbability:
(float) deathProb mutationRate: (float) mu;
-createEnd;
-(int)getMaxAgents;
-(int)getPopulation;
-(int)getStrategyLength;
-(float)getDeathProbability;
-(float)getMutationRate;
@end
-------------------------------------
//EPDWorld.m EPD
#import "EPDWorld.h"
#import "EPDAgent.h"
@implementation EPDWorld
-setup: (int) x ySize: (int) y maxAgents: (int) maxPop startAgents:
(int) startPop strategyLength: (int) stratLen deathProbability:
(float) deathProb mutationRate: (float) mu {
int l1;
// [super init];
[super setSizeX: x Y: y];
maxAgents=maxPop;
startAgents=startPop;
population=startAgents;
strategyLength=stratLen;
deathProbability=deathProb;
mutationRate=mu;
for (x=0; x<xsize; x++)
{
for (y=0; y<ysize; y++)
{
[self putObject:[List alloc] atX: x Y: y];
[[self getObjectAtX: x Y: y] init];
}
}
for (l1=0; l1<startAgents; l1++)
{
x=[uniformIntRand getIntegerWithMin: 0 withMax: xsize-1];
y=[uniformIntRand getIntegerWithMin: 0 withMax: ysize-1];
[[self getObjectAtX: x Y: y] addFirst: [EPDAgent alloc]];
[[[self getObjectAtX: x Y: y] getFirst] init];
}
return self;
}
-(int)getMaxAgents
{
return maxAgents;
}
-(int)getPopulation
{
return population;
}
-(int)getStrategyLength
{
return strategyLength;
}
-(float)getDeathProbability
{
return deathProbability;
}
-(float)getMutationRate
{
return mutationRate;
}
@end
And here's what the compiler tells me:
gcc -g -Lc:/swarm/swarm-1.1/lib -L/Swarm/packages/libffi/lib
-L/Swarm/packages/b lt8.0-unoff/lib -L/Swarm/packages/tclobjc/lib -o
EPD main.o EPDSwarm.o EPDWorld .o EPDAgent.o -lanalysis -lsimtools
-lsimtoolsgui -ltkobjc -lactivity -lrandom -lobjectbase -lcollections
-ldefobj -lmisc -ltclobjc -lBLT80 -ltk80 -ltcl80 -lf fi -lobjc -lm
-luser32 -lgdi32 EPDWorld.o:/Swarm/swarmapps-1.1/EPD/EPDWorld.m:36:
undefined reference to `__obj c_class_name_Discrete2d' make: *** [EPD]
Error 1
Can anyone help? Additionally/alternatively can anyone recommend a
good book on Objective C, which really does start with the basics? I
have experience of coding in C++, but less in C. Thanks!
James
--
James Marshall - Postgraduate Research Student (MPhil/PhD)
Artificial Intelligence Group - Department of Computer and Information Sciences
De Montfort University - Milton Keynes Campus
Web:- http://www.mk.dmu.ac.uk/~jmarshall/
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
==================================