473,882 Members | 1,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Logic question...

I am writing a game and I am having a challenge with my combat
function. All I want to do is find out how to group pieces that are in
the same space. There are two sides and all the units that are in the
same space fight. I want to add up the attack factors and defending
factors in the same space then figure out the odds so I can roll
against an odds table. Basically each piece holds its own x and y loc.
Here is what I have right now:

void fight(vector<un it>& at, vector<unit>& dt,
board * b , terrain * trn ){

vector<fightcla ssfighting;

/* adds attacking units to the fightclass vector if units are in the
same space they are to grouped in the same fight class elemet of
the
vector. */

for(int atu = 0; atu != at.size(); atu++){
if(fighting.siz e() == 0){
fightclass ft;
ft.addAu(at[atu]);
fighting.push_b ack(ft);
} else {
for(int lp = 0; lp != fighting.size() ; lp++){
if(at[atu].getXloc() != fighting[lp].getX() &&
at[atu].getYloc() != fighting[lp].getY()){
fightclass ft;
ft.addAu(at[atu]);
fighting.push_b ack(ft);
} else {
fighting[lp].addAu(at[atu]);
}
}
}
}
/* Adds defending units to the fightclass array. If x and y locs are
the same as attacking locations (are in the same space) they are
added to array for combat */

for(int dtu = 0; dtu != dt.size(); dtu++){
for(int lp = 0; lp != fighting.size() ; lp++){
if(dt[dtu].getXloc() == fighting[lp].getX() &&
dt[dtu].getYloc() == fighting[lp].getY()){
fighting[lp].addDu(dt[dtu]);
}
}
}

// Combat routine

for(int lp = 0; lp != fighting.size() ; lp++){ //handles combat
if(fighting[lp].canfight()){
int df = b->GetSpace(fight ing[lp].getX(), fighting[lp].getY());
float odds =
fighting[lp].getAtk()/fighting[lp].getDef();
//gets the defense bonus for the terrain in the space where
//combat takes place
int roll = rand() - trn[df].defend();
//get the die roll modified for terrain
odds = fighting[lp].getAtk() / fighting[lp].getDef();
//gets the attack to defence ratio.
if(odds < .5){
MessageBox(NULL , "Fighting! 1:3", "Info!", MB_OK);
return;
}
if(odds < 1){
MessageBox(NULL , "Fighting! 1:2", "Info!", MB_OK);
return;
}
if(odds < 2){
MessageBox(NULL , "Fighting! 1:1", "Info!", MB_OK);
return;
}
if(odds < 3){
MessageBox(NULL , "Fighting! 2:1", "Info!", MB_OK);
return;
}
if(odds < 4){
MessageBox(NULL , "Fighting! 3:1", "Info!", MB_OK);
return;
}
if(odds < 5){
MessageBox(NULL , "Fighting! 4:1", "Info!", MB_OK);
return;
}
if(odds < 6){
MessageBox(NULL , "Fighting! 5:1", "Info!", MB_OK);
return;
}

}
}
for(int lp = 0; lp != fighting.size() ; lp++){
fighting[lp].done();
}
fighting.clear( );
}

class fightclass{
/* Fightclass holds two arrays of units. The two arrays represent
units
in the same space elgible for combat. Array at represents the
attacking
forces and dt represents the defending units */
int xl;
int yl;

bool sides2; /* indicates if there are units in both attack and
defend
if there are units in both attack and defend then
combat
is to take place between the opposing sides. */

vector<unit>at; //attack units
vector<unit>dt; //defending units

public:
fightclass();
void addAu(unit au); //adds an addacking unit
void addDu(unit du); //adds a defending unit
int getX(){return xl;} //return the x coord
int getY(){return yl;} //returns the y coord
float getAtk(); //returns the total attack factors for one space
float getDef(); //returns the total defending factors for one space
bool canfight(); //if there are both attacking and defending units
void done(); //clears vectores after the turn

};

fightclass::fig htclass(){
xl = 0;
yl = 0;
}

void fightclass::add Au(unit u){
at.push_back(u) ;
xl = u.getXloc();
yl = u.getYloc();

}

void fightclass::add Du(unit u){

dt.push_back(u) ;

}

bool fightclass::can fight(){
if(at.size() && dt.size()){
return true;
}else {return false;}
}

float fightclass::get Atk(){
float total;
for(int lp = 0; lp != at.size(); lp++){
total +=at[lp].getAttack();
}
return total;
}

I know the logic is not the best but it is the best I can do. This is
tricky and I am pretty confused. I would like to find some way of
making the logic steps easier. There may be some simple error that I
overlooked or it can be totally screwed up.

Sep 4 '06
73 4326
LR
JoeC wrote:
LR wrote:
>>JoeC wrote:
I can send you my current code if you are intersted.
I'm sorry, but I don't have the time to read an entire program and see
what your problems are.

I suggest that you write the smallest possible program or even a snippet
that shows the problem and post it.
It is a challenge
to work with the arrays of units.
What in particular is the challenge? Try to be as specific as you can.
>They are not on my map they hold
their own values and then they draw themselvs.
Relevance to above?

The challenge is that I
have to find units in the same space then to see if the other side has
units in that space.
Try parsing that, and rewriting it as code. Maybe that will solve your
problem. Maybe not the most efficient way, but right now I think you'd
be better served if you just got something to work.

There is a posibility that several spaces have
both side in it and therefor elegible for combat.
Try parsing that too.

LR

Sep 12 '06 #41
Nathan Mates wrote:
In article <11************ **********@e63g 2000cwd.googleg roups.com>,
JoeC <en*****@yahoo. comwrote:
I can send you my current code if you are intersted. It is a challenge
to work with the arrays of units. They are not on my map they hold
their own values and then they draw themselvs. The challenge is that I
have to find units in the same space then to see if the other side has
units in that space. There is a posibility that several spaces have
both side in it and therefor elegible for combat.

As just about everyone has said multiple times, the code to store
who's where should be separated from your combat code. You said you
had problems when it was separate. Now you're having problems when
it's integrated. Once again, I recommend that it be separate, and
debugged. It's *much* easier to debug code when it's only trying to
do one thing (store who's where, in a map manager) versus multiple
things (combat & store who's where).

Nathan Mates
I have not gotten to work on my code yet. I am still thinking how I am
going to make the changes. I do find the discussion intersting and I
do learn things. Yes, I would be good to seperate the two activites.
I could make the part that sorts the pieces seperate functions. I
would like to know if there is a std::lib function that will copy units
that are in the same space. They have to be refrences because I want
the affects of the combat to be on the same units that engaged in
combat.

Right now my design is pretty poor and I am trying to come up with a
better way to do what I am doing. It will probibly take a while to
figure out how to re-design the program and solve my problem better. I
do have some ideas that involve a single class that takes the units
then does combat instead of a single function.

Sep 13 '06 #42
In article <11************ **********@h48g 2000cwc.googleg roups.com>,
JoeC <en*****@yahoo. comwrote:
>I have not gotten to work on my code yet. I am still thinking how I am
going to make the changes. I do find the discussion intersting and I
do learn things. Yes, I would be good to seperate the two activites.
I could make the part that sorts the pieces seperate functions. I
would like to know if there is a std::lib function that will copy units
that are in the same space. They have to be refrences because I want
the affects of the combat to be on the same units that engaged in
combat.
Just copy/return pointers instead-- have your map manager return a
std::list or (better yet) a std::vector of pointers to units. That's
pretty darn close to what a reference is anyhow, and it's more
flexible for what you're trying to do.

Nathan
--
<*Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Sep 13 '06 #43

Nathan Mates wrote:
In article <11************ **********@h48g 2000cwc.googleg roups.com>,
JoeC <en*****@yahoo. comwrote:
I have not gotten to work on my code yet. I am still thinking how I am
going to make the changes. I do find the discussion intersting and I
do learn things. Yes, I would be good to seperate the two activites.
I could make the part that sorts the pieces seperate functions. I
would like to know if there is a std::lib function that will copy units
that are in the same space. They have to be refrences because I want
the affects of the combat to be on the same units that engaged in
combat.

Just copy/return pointers instead-- have your map manager return a
std::list or (better yet) a std::vector of pointers to units. That's
pretty darn close to what a reference is anyhow, and it's more
flexible for what you're trying to do.
" -R.A. Heinlein

My main point for this whole post is to get an opinion on what I wrote.
Yes it is not very good. But I am looking for a concept on how go
about making it better. Great seperate the sorting and combat into two
functions. That would be good but they have to be sorted before combat
can take place. I would like to get some advice on how to sort them.
Should I have a combat object that sorts and then does the combat.
Should I create a sort object then have that object loaded by the
combat routine. I had my first attempt that didn't work and now I am
trying to come up with a basic concept on how to do what I want to do.
I know it is best to break it all down to the simplest steps but I have
a proscess here. Sort, combat, results.

My problem is that I ham having trouble seperating out the steps. It
it not simple. 1. find units in the same space, 2. get the combat
factors, 3, resolve combat, 4. apply results to affected units.

Step one, I can either take the unit an put into a seperate function
or object or I can have some external thing that knows that unit[1] and
unit[3] have the same coords.

Step two. the function or objects simple takes the combat factors
because refrences to the units are in the function or object. From
another way the external thing has to know to get the information from
unit[1] and unit[3] and unit[2] from the other side.

Step three. I have created a table object that holds the tabe and
returns the result. Should that be part of an object, should it be
persistant or should it be reloaded each time combat takes place.

Step four. Resolving combat. How do the units konw that they are to
die or be dispersed. Basically they turn black and have no attack or
movement factors for the next turn. That shouldn't be too hard, I
still have to make changes so that the units can be affected as I had
planned.

Some of these problems are harder than others. I still have other
things to improve in the program and this is not my only problem it is
the only one that is completely not working.

Because my cable modem has a bad connection, I have not been able to
send out this message and I have been working on my program trying to
figure this out and it is realy racking my brain. I have been
comparing different ways to solve this problem.

Sep 13 '06 #44
In article <11************ *********@e63g2 000cwd.googlegr oups.com>,
JoeC <en*****@yahoo. comwrote:
>My problem is that I ham having trouble seperating out the steps. It
it not simple. 1. find units in the same space, 2. get the combat
factors, 3, resolve combat, 4. apply results to affected units.
Your trying to explain things in more words is definitely helping.
Keep explaining things with more words-- like an outline-- until you
can see how to turn a sentence into a bit of code. That's how you go
about breaking down a big idea into small chunks that can be
programmed. And, for your steps, the best thing to do is the simplest
thing. If you've got complicated implementations , you're more likely
to introduce bugs.

>Step one, I can either take the unit an put into a seperate function
or object or I can have some external thing that knows that unit[1] and
unit[3] have the same coords.
As I've said *MANY* times before, use a map manager. It does
something like this:

class Entity; // base class for all objects managed by MapManager; classes derive from this
typedef std::list<Entit y*EntityList;

class MapManager
{
public:
void Clear(void); // clears the map
void AddEntity(Entit y* pObj); // pObj is queried as to where it is
void RemoveEntity(En tity* pObj); // object moves are just a remove/add

void GetObjectsAt(in t x, int y, EntityList& objs);

private:
// Implementation here. Just store pointers!
// For example, you could do a 2D array of EntityLists.
}

WRITE THIS CODE. Do not do step 2 until you complete this. DO NOT
TRY AND SOLVE EVERYTHING NOW. Get *something* working. You're diluting
your focus and confusing the issues by trying to think about
everything at once.

>Step two. the function or objects simple takes the combat factors
because refrences to the units are in the function or object. From
another way the external thing has to know to get the information from
unit[1] and unit[3] and unit[2] from the other side.
I can't understand the above. I don't think you understand this
step fully, either. If you have an EntityList, like above, you can
simply ask each object various bits of info -- call a function on
them. Problem solved.

>Step three. I have created a table object that holds the tabe and
returns the result. Should that be part of an object, should it be
persistant or should it be reloaded each time combat takes place.
Focusing on return types means you're completely missing the big
picture. This is a game design question that you've gotten mixed up
with programming. If the results of combat are applied right away (as
in most games), then call a function on that object right away and let
it update its state. Or if the results are applied at the end of a
turn, just store the pending changes in each object (Entity).

>Step four. Resolving combat. How do the units konw that they are to
die or be dispersed. Basically they turn black and have no attack or
movement factors for the next turn. That shouldn't be too hard, I
still have to make changes so that the units can be affected as I had
planned.
How does something know? Simple. You tell it. If you have a pointer
to an Entity, then you call a function on it,
e.g. pObj->DamageAlloc(50 ). Or something else. If you go with code
like the above, where you've got a list of pointers to objects, it's
trivial to start passing messages (i.e. calling functions) to those
objects. For each object, if its health goes under zero when damage
is allocated, set a flag on it that it's dead. Then any calls to use
that entity that turn can just check that flag.

Nathan Mates
--
<*Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Sep 13 '06 #45
LR
JoeC wrote:
Great seperate the sorting and combat into two
functions. That would be good but they have to be sorted before combat
can take place. I would like to get some advice on how to sort them.
Please look into std::sort.
I know it is best to break it all down to the simplest steps but I have
a proscess here. Sort, combat, results.

My problem is that I ham having trouble seperating out the steps. It
it not simple. 1. find units in the same space,
That's not quite the same thing as sort.

Perhaps you should look into std::map, or maybe std::multimap.

Just as a thought experiment, not the way to write your code, think
about something like std::map<Locati on, std::set<UnitIn dicies.

But sort might not be so bad as a first run through.

Maybe an easy way would be to make a
std::vector< std::pair<UnitL ocation, UnitIndex
and sort it. That will bunch up all the Units that are in the same
location next to each other in the vector.

Do they fight when they're at the same location, or at adjacent locations?

2. get the combat
factors, 3, resolve combat, 4. apply results to affected units.
Once you figure out how to decide where your "Units" are, these may seem
simpler. Try to complete item 1 first.

LR
Sep 14 '06 #46
In article <11************ **********@m73g 2000cwd.googleg roups.com>,
"JoeC" <en*****@yahoo. comwrote:
My game is very simple, as simple as I can make it. I could get rid of
terrain but all I want to do is move pieces on a board and if they are
in the same space have them fight. I have done several map games and
each one has its problems. This worked great until I wanted to have
the units fight.
Ok, let's look at this much of the problem.

You have a "units" structure, right? And each unit has a "I'm at
location X/Y" variable, right? So maybe (I'll use java, because it's
easy to read and I've been playing in it, lately) you have something
like:

public class Unit
{
int type; // 1=soldier, 2=tank, etc.
int xPos; // which column on board
int zPos; // which row on board.
// (Call it Z in case we ever go 3d :)
int defenseStat;
int attackStat
...etc.
}

Now, when you want to see if anyone else is in this unit's square, you
do:

// assume the presence of "thisUnit", a unit object
// assume "thisUnitIn dex" is thisUnit's index in
// the array of all units, "unitArray"
for (int ii = 0 ; ii < unitArray.lengt h ; ++ii)
{
if (ii == thisUnitIndex) continue; // don't compare to me!
otherUnit = unitArray [ii];
if ((otherUnit.xPo s == thisUnit.xPos)
&& (otherUNit.yPos == thisUnit.yPos) )
{
// we share a square!
resolveCombat (thisUnit, otherUnit);
}
}

This is pretty basic stuff, though -- if you're having trouble at this
level, then you probably want to put the game on the back-burner for a
while and learn some programming fundamentals.

....Or maybe we're just all not understanding what it is you're asking.

--
Please take off your pants or I won't read your e-mail.
I will not, no matter how "good" the deal, patronise any business which sends
unsolicited commercial e-mail or that advertises in discussion newsgroups.
Sep 14 '06 #47

Nathan Mates wrote:
In article <11************ *********@e63g2 000cwd.googlegr oups.com>,
JoeC <en*****@yahoo. comwrote:
My problem is that I ham having trouble seperating out the steps. It
it not simple. 1. find units in the same space, 2. get the combat
factors, 3, resolve combat, 4. apply results to affected units.

Your trying to explain things in more words is definitely helping.
Keep explaining things with more words-- like an outline-- until you
can see how to turn a sentence into a bit of code. That's how you go
about breaking down a big idea into small chunks that can be
programmed. And, for your steps, the best thing to do is the simplest
thing. If you've got complicated implementations , you're more likely
to introduce bugs.

Step one, I can either take the unit an put into a seperate function
or object or I can have some external thing that knows that unit[1] and
unit[3] have the same coords.

As I've said *MANY* times before, use a map manager. It does
something like this:

class Entity; // base class for all objects managed by MapManager; classes derive from this
typedef std::list<Entit y*EntityList;

class MapManager
{
public:
void Clear(void); // clears the map
void AddEntity(Entit y* pObj); // pObj is queried as to where it is
void RemoveEntity(En tity* pObj); // object moves are just a remove/add

void GetObjectsAt(in t x, int y, EntityList& objs);

private:
// Implementation here. Just store pointers!
// For example, you could do a 2D array of EntityLists.

I have to do some studying to be able to understand how to make a map
manager work. I feel bad but it confuses me. I will have to do some
studying and try to learn how this works. I know how to use a map and
other standatd containers and I once wrote a simple linked list but I
never realy worked with it much farther. I worte a program simmiliar
to this but it was pretty buggy:

class board{

player * play;
static const int size = 30;
map<char, coordkeys;
space spaces[size][size];
coord n;
coord s;
coord e;
coord w;

ifstream& cfill(ifstream& , char&); /*Reads map from file */
void fill();
coord find();
void seeing(int, int);

public:
board();
void setPlayer(playe r*, int, int);
graphic& display(int, int);
int sze(){return size;}
void move(char);
};

class space{
char gchar;
graphic *gr;
graphic *grDefault;
graphic *cgr;
player * play;
bool seen;

public:
space();
~space();
void graphicIn(char g);
graphic& graphicOut();
void playIn(player*) ;
bool isPlay();
void see(){seen = true;}
bool been(){return seen;}
void playOut();
bool canMove();
bool winspace();
};

Again I have not found good resource that clearly explain these
programming techinques. If I have seen them, I have not been able to
apply the lessons to my programs. Although I write these games, I also
spend time writing small demo programs to learn how to do things.
These projects how me where my knolwege is lacking and what to study
and learn. After I get this game to work, I am going to do some
studying and see what I can learn. I generally don't use pointers
because I am not realy skilled with manipulating them.

For now before reading this post:

class cfight{

struct cHolder{
int x;
int y;
vector<int>atu; // stores attacking units
vector<int>dtu; //stores defending units
};

vector<cHolder> holder; //holds units in same space and the coords

public:
cfight();
void readAt(vector<u nit>&);
void readDt(vector<u nit>&);
};

#include<vector >

#include "cfight.h"

using namespace std;

cfight::cfight( ){

}

void cfight::readAt( vector<unit>& at){
/*Takes the vector of the attacking units and puts them in the hold
vector. If there are units in the same space their indexes are
grouped
together. If not a new element is added to the hold vector */

int num = 0;
bool done = false;

if(holder.size( ) == 0){
cHolder h;
h.x = at[0].getXloc();
h.y = at[0].getYloc();
h.atu.push_back (num);
holder.push_bac k(h);
}
for(int un = 1; un != at.size (); un++){
do{
if(at[un].getXloc() == holder[num].x &&
at[un].getYloc() == holder[num].y){
holder[num].atu.push_back( num);
done = true;
} else {num++;}
if(num holder.size()){ done = true;}

}while(!done);

}
}

void cfight::readDt( vector<unit>& dt){
/* Takes the vector of defending units then compares them with the
attacking
units if they are in the same space then they are grouped in same
hold
vector element if not they are ignored */

for(int un = 0; un != dt.size(); un++){
for(int num = 0; num != holder.size(); num++){
if(dt[un].getXloc() == holder[num].x &&
dt[un].getYloc() == holder[num].y){
holder[num].dtu.push_back( num);
}
}
}
}

Sep 14 '06 #48

Nathan Mates wrote:
In article <11************ *********@e63g2 000cwd.googlegr oups.com>,
JoeC <en*****@yahoo. comwrote:
My problem is that I ham having trouble seperating out the steps. It
it not simple. 1. find units in the same space, 2. get the combat
factors, 3, resolve combat, 4. apply results to affected units.

Your trying to explain things in more words is definitely helping.
Keep explaining things with more words-- like an outline-- until you
can see how to turn a sentence into a bit of code. That's how you go
about breaking down a big idea into small chunks that can be
programmed. And, for your steps, the best thing to do is the simplest
thing. If you've got complicated implementations , you're more likely
to introduce bugs.

Step one, I can either take the unit an put into a seperate function
or object or I can have some external thing that knows that unit[1] and
unit[3] have the same coords.

As I've said *MANY* times before, use a map manager. It does
something like this:

class Entity; // base class for all objects managed by MapManager; classes derive from this
typedef std::list<Entit y*EntityList;

class MapManager
{
public:
void Clear(void); // clears the map
void AddEntity(Entit y* pObj); // pObj is queried as to where it is
void RemoveEntity(En tity* pObj); // object moves are just a remove/add

void GetObjectsAt(in t x, int y, EntityList& objs);

private:
// Implementation here. Just store pointers!
// For example, you could do a 2D array of EntityLists.

I have to do some studying to be able to understand how to make a map
manager work. I feel bad but it confuses me. I will have to do some
studying and try to learn how this works. I know how to use a map and
other standatd containers and I once wrote a simple linked list but I
never realy worked with it much farther. I worte a program simmiliar
to this but it was pretty buggy:

class board{

player * play;
static const int size = 30;
map<char, coordkeys;
space spaces[size][size];
coord n;
coord s;
coord e;
coord w;

ifstream& cfill(ifstream& , char&); /*Reads map from file */
void fill();
coord find();
void seeing(int, int);

public:
board();
void setPlayer(playe r*, int, int);
graphic& display(int, int);
int sze(){return size;}
void move(char);
};

class space{
char gchar;
graphic *gr;
graphic *grDefault;
graphic *cgr;
player * play;
bool seen;

public:
space();
~space();
void graphicIn(char g);
graphic& graphicOut();
void playIn(player*) ;
bool isPlay();
void see(){seen = true;}
bool been(){return seen;}
void playOut();
bool canMove();
bool winspace();
};

Again I have not found good resource that clearly explain these
programming techinques. If I have seen them, I have not been able to
apply the lessons to my programs. Although I write these games, I also
spend time writing small demo programs to learn how to do things.
These projects how me where my knolwege is lacking and what to study
and learn. After I get this game to work, I am going to do some
studying and see what I can learn. I generally don't use pointers
because I am not realy skilled with manipulating them.

For now before reading this post:

class cfight{

struct cHolder{
int x;
int y;
vector<int>atu; // stores attacking units
vector<int>dtu; //stores defending units
};

vector<cHolder> holder; //holds units in same space and the coords

public:
cfight();
void readAt(vector<u nit>&);
void readDt(vector<u nit>&);
};

#include<vector >

#include "cfight.h"

using namespace std;

cfight::cfight( ){

}

void cfight::readAt( vector<unit>& at){
/*Takes the vector of the attacking units and puts them in the hold
vector. If there are units in the same space their indexes are
grouped
together. If not a new element is added to the hold vector */

int num = 0;
bool done = false;

if(holder.size( ) == 0){
cHolder h;
h.x = at[0].getXloc();
h.y = at[0].getYloc();
h.atu.push_back (num);
holder.push_bac k(h);
}
for(int un = 1; un != at.size (); un++){
do{
if(at[un].getXloc() == holder[num].x &&
at[un].getYloc() == holder[num].y){
holder[num].atu.push_back( num);
done = true;
} else {num++;}
if(num holder.size()){ done = true;}

}while(!done);

}
}

void cfight::readDt( vector<unit>& dt){
/* Takes the vector of defending units then compares them with the
attacking
units if they are in the same space then they are grouped in same
hold
vector element if not they are ignored */

for(int un = 0; un != dt.size(); un++){
for(int num = 0; num != holder.size(); num++){
if(dt[un].getXloc() == holder[num].x &&
dt[un].getYloc() == holder[num].y){
holder[num].dtu.push_back( num);
}
}
}
}

Sep 14 '06 #49
In article <11************ *********@m73g2 000cwd.googlegr oups.com>,
JoeC <en*****@yahoo. comwrote:
>I have to do some studying to be able to understand how to make a map
manager work. I feel bad but it confuses me. I will have to do some
studying and try to learn how this works. I know how to use a map and
other standatd containers and I once wrote a simple linked list but I
never realy worked with it much farther. I worte a program simmiliar
to this but it was pretty buggy:
Why write a linked list? std::list<Objec t*is a linked list, and
is fully debugged already. Use what you've got for free.

Nathan Mates
--
<*Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Sep 15 '06 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

60
7334
by: Fotios | last post by:
Hi guys, I have put together a flexible client-side user agent detector (written in js). I thought that some of you may find it useful. Code is here: http://fotios.cc/software/ua_detect.htm The detector requires javascript 1.0 to work. This translates to netscape 2.0 and IE 3.0 (although maybe IE 2.0 also works with it)
6
1574
by: Ted Singh | last post by:
(I apologize in advance if this is an obvious question, my experience is more with console or client-only apps) I am trying to build an web-based HTML UI, which will work with a web-server on the same machine (i.e., http://localhost/...). However, I do not want the logic source to be visible to the user to prevent customer support problems, intellectual property issues, etc. The requirements strictly call for a web-based UI running...
0
1909
by: Tony Johansson | last post by:
Hello Experts! I reading a book called programming with design pattern revealed by Tomasz Muldner and here I read something that sound strange. "Exception are divided into logic errors and runtime errors. Logic errors represent static errors that can be prevented and detected at compile time. Runtime errors represent dynamic errors that can be detected only at runtime."
2
1511
by: Simon Harvey | last post by:
Hi all, I was wondering how most developers handle the initial startup of their Windows Forms applications? When you make an application in Visual Studio, the IDE places Main in the form that VS makes for you. When I make my applications I sometimes feel uneasy about leaving the startup logic in the Form - it sort of seems the wrong place for it. I'm by no means an expert on such things (which is why I'm writing this post), but it...
3
1530
by: mca | last post by:
Hi everyone, I'm new to asp.net and i have a question about separating the html code from the programming code. i have an unknown numbers of entries in my table. I want to make a hyperlink for every entry in my table. So i query the database and get for example 3 entries back. So in a while loop i can make 3 hyperlinks with response.write(.......) etc.
24
14427
by: cassetti | last post by:
Here's the issue: I have roughly 20 MS excel spreadsheets, each row contains a record. These records were hand entered by people in call centers. The problem is, there can and are duplicate phone numbers, and emails and addresses even person names. I need to sift through all this data (roughly 300,000+ records and use fuzzy logic to break it down, so that i have only unique records.
6
2013
by: Simon Harvey | last post by:
Hi everyone, We have a need to make a Windows Forms (2.0) client application that will be installed on our clients site. The data that the application uses needs to be centrally available to a potentially large number of other sites, which would seem to leave us with our traditional approach, or having a central database server on a dedicated server someplace.
14
3582
by: rabbitrun | last post by:
Hi Everyone, I work for a financial company. I am planning to give a presentation to rest of the development team (15 people) here on moving server side logic to client-side javascript for an internal intranet application rewrite. This approach will definitely stir up hot debate from hardcore server-side Java folks who wants to do UI stuff even on the server!. Since I am pretty much known as the JS or UI Guy of the group, my Boss...
29
2243
by: Brad Pears | last post by:
Here is a simple OO design question... I have a Contract class. The user can either save an existing contract or they start off fresh with a blank contract, fill in the data and then save a "new" contract. I have a method in my contract class called "Save" which is called like this... dim oContract as new Contract
15
2451
by: bruno.desthuilliers | last post by:
On 27 juin, 18:09, "John Salerno" <johnj...@NOSPAMgmail.comwrote: For which definitions of "content" and "logic" ??? The point of mvc is to keep domain logic separated from presentation logic, not to remove logic from presentation (which just couldn't work). Templating systems are for presentation logic. Whether they work by embedding an existing complete programmation language or by providing they're own specialised mini-language (or...
0
9931
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9777
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11108
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10725
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10830
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10403
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7956
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3226
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.