GIDForums  

Go Back   GIDForums > Computer Programming Forums > CPP / C++ Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 01-Dec-2007, 17:01
ddaigle ddaigle is offline
New Member
 
Join Date: Nov 2007
Posts: 11
ddaigle is on a distinguished road

Need help with a simple "dragon" game.


I'm trying to write a simple "dragon" game for a school project.

The game i want to arrive at involves a user 'U' and the computer player 'P'. P and U know are crossing a bridge when a dragon appears. There is a troll watching them, who will give them coins depending on their joint behavior when the dragon appears. If they both do nothing, the troll will think they are nice, animal lovers, and will give them each 10 coins. If they both draw their swords on the dragon, the troll will think they are stressed out and over-reacting, and give them 5 coin each. However, if the P draws its sword and the U does nothing, the troll will think that the P is very brave and that U is a coward, and give P 20 coins, and U nothing. Similarly, if U draws its sword and P does nothing, then the U will seem brave and get 20 coins, and P will get nothing. Here is a summary:

Reaction to Dragon amount of coins received (the outcomes are explained below):

both P and U do nothing P gets 10, U gets 10 (positive outcome)
both P and U draw their swords P gets 5, U gets 5 (negative outcome)
P draws sword, U does nothing P gets 20, U gets 0 (positive outcome)
P does nothing, U draws sword P gets 0, U gets 20 (negative outcome)

So far, this seems like a pretty easy program to make, but my teacher said that it had to be more complicated, and so now I decided the computer player wants to maximize the number of coins it gets over repeated games.

It will follow a particular strategy. For the first game, it does whatever it wants: nothing or draws its sword. But after that, the computer will make its next decision depending on the joint outcome of the game just played. When both the user and computer act peace loving (do nothing), both get 10 coins each. This is a good reward and so the computer will decide to repeat its decision to do nothing in the next game. However, an even bigger reward occurs if the computer decided to draw its sword (20 coins) and the user decided to act peace loving (did nothing and got 0 coins)). When this situation occurs, the computer will repeat its decision to draw its sword on the very next game.

The computer will switch its output only if a negative outcome happens, for example, if the user drew its sword, and the computer did nothing, which would give the computer 0 points and the user 20 points. In this case, in the next game the computer would draw its sword. If both draw their swords, I am also considering that a negative output for the computer, so next game it will do nothing.

This is kinda what I want the program to look like:

How many games do you want to play? 3 {user enters 3}
Game 1.
I’ve made my decision. What is your decision? : S {user enters S for sword}
My decision: sword. Your decision: sword
I have 5 coins. You have 5 coins.

Game 2.
I’ve made my decision. What is your decision? : N {user enters N for nothing}
My decision: nothing. Your decision: nothing
I have 15 coins. You have 15 coins. {updates the total coins}

Game 3
I made my decision. What is your decision? : S
My decision: nothing. Your decision: sword
I have 15 coins. You have 35 coins.
End of games.

Obviously, to be fair, the computer must set its decision first.

I will post what I have so far as soon as I have time.
  #2  
Old 01-Dec-2007, 17:47
ddaigle ddaigle is offline
New Member
 
Join Date: Nov 2007
Posts: 11
ddaigle is on a distinguished road

Re: Need help with a simple "dragon" game.


This is what I have so far...

CPP / C++ / C Code:
#include <iostream>
#include <stdlib.h>

//games = g
//game number = x
//computer coins = ccoin
//user coins = ucoin
//computer decision = cdec
//user decision = udec
//do nothing = N
//draw sword = S

//I'll make the computer always start off with drawing sword.

int main(int argc, char *argv[])
{
int g,x,ccoin,ucoin;
char cdec,udec;
cdec = S;
ccoin = 0;
ucoin = 0;
x = 1;

cout << "How many games do you want to play? ";
cin >> g >> endl;
while (x<g){
    cout << "Game " << x << "." << endl;
    cout << "I've made my decision. What is your decision?: ";
    cin >> udec >> endl;
    cout << "My decision: " << cdec << ". Your decision: " << udec << "." << endl;
    if (udec=S && cdec=S)
        ccoin + 5;
        ucoin + 5;        
    else if (udec=N && cdec=S)
        ccoin + 20;
        ucoin + 0;
    else if (udec=S && cdec=N)
        ccoin + 0;
        ucoin + 20;
    else if (udec=N && cdec=N)
        ccoin + 10;
        ucoin + 10;
    else
        cout << "You did not enter either S or N." << endl;
    cout << "I have " << ccoin << " coins. You have " << ucoin << " coins." << endl;
    //now I need to write something that allows the computer to make a decision
    //of whether to use the same input or switch, based on how many coins it
    //earned. I don't even know how to begin doing that.
    x++;
    }
system("PAUSE");	
return 0;
}

So that's what I have, and as you can see in my comment near the bottom, I'm not sure how to do that part. Also, any other things that you could point out that might help would be awesome. Thanks!
  #3  
Old 01-Dec-2007, 19:47
TurboPT's Avatar
TurboPT TurboPT is online now
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 926
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Need help with a simple "dragon" game.


Tell us what compiler you have that actually builds this code, for it contains many issues -- I'll start with a few:

where is this statement?
CPP / C++ / C Code:
using namespace std;
This:
CPP / C++ / C Code:
cdec = S;
is NOT how a char is assigned to a variable.

This block of code:
CPP / C++ / C Code:
    if (udec=S && cdec=S)
        ccoin + 5;
        ucoin + 5;        
    else if (udec=N && cdec=S)
        ccoin + 20;
        ucoin + 0;
    else if (udec=S && cdec=N)
        ccoin + 0;
        ucoin + 20;
    else if (udec=N && cdec=N)
        ccoin + 10;
        ucoin + 10;
has a problem on EVERY line:
Questions/points to consider:
1. in each condition, are we comparing or assigning?
2. misuse of characters in the conditions.
3. how is the additives being assigned to the ccoin/ucoin variables?
4. looks like two statements per condition, but what is necessary to ensure this happens logically?

I'll stop here, for now. Post again (with updated code) after correcting the aforementioned issues. However, should you get stuck with something, please post another reply.

EDIT:
Oh, here's my visual studio results trying to compile:
Code:
Compiling... cpp3.cpp c:\cpp3.cpp(19) : error C2065: 'S' : undeclared identifier c:\cpp3.cpp(24) : error C2065: 'cout' : undeclared identifier c:\cpp3.cpp(24) : error C2297: '<<' : illegal, right operand has type 'char [37]' c:\cpp3.cpp(25) : error C2065: 'cin' : undeclared identifier c:\cpp3.cpp(25) : error C2065: 'endl' : undeclared identifier c:\cpp3.cpp(25) : warning C4552: '>>' : operator has no effect; expected operator with side-effect c:\cpp3.cpp(27) : error C2297: '<<' : illegal, right operand has type 'char [6]' c:\cpp3.cpp(28) : error C2297: '<<' : illegal, right operand has type 'char [48]' c:\cpp3.cpp(29) : warning C4552: '>>' : operator has no effect; expected operator with side-effect c:\cpp3.cpp(30) : error C2297: '<<' : illegal, right operand has type 'char [14]' c:\cpp3.cpp(31) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) c:\cpp3.cpp(31) : error C2106: '=' : left operand must be l-value c:\cpp3.cpp(32) : warning C4552: '+' : operator has no effect; expected operator with side-effect c:\cpp3.cpp(33) : warning C4552: '+' : operator has no effect; expected operator with side-effect c:\cpp3.cpp(34) : error C2181: illegal else without matching if c:\cpp3.cpp(34) : error C2065: 'N' : undeclared identifier c:\cpp3.cpp(34) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) c:\cpp3.cpp(34) : error C2106: '=' : left operand must be l-value c:\cpp3.cpp(35) : warning C4552: '+' : operator has no effect; expected operator with side-effect c:\cpp3.cpp(36) : warning C4552: '+' : operator has no effect; expected operator with side-effect c:\cpp3.cpp(37) : error C2181: illegal else without matching if c:\cpp3.cpp(37) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) c:\cpp3.cpp(37) : error C2106: '=' : left operand must be l-value c:\cpp3.cpp(38) : warning C4552: '+' : operator has no effect; expected operator with side-effect c:\cpp3.cpp(39) : warning C4552: '+' : operator has no effect; expected operator with side-effect c:\cpp3.cpp(40) : error C2181: illegal else without matching if c:\cpp3.cpp(40) : warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) c:\cpp3.cpp(40) : error C2106: '=' : left operand must be l-value c:\cpp3.cpp(41) : warning C4552: '+' : operator has no effect; expected operator with side-effect c:\cpp3.cpp(42) : warning C4552: '+' : operator has no effect; expected operator with side-effect c:\cpp3.cpp(43) : error C2181: illegal else without matching if c:\cpp3.cpp(44) : error C2297: '<<' : illegal, right operand has type 'char [33]' c:\cpp3.cpp(45) : error C2297: '<<' : illegal, right operand has type 'char [8]' Error executing cl.exe. Creating browse info file... cpp3.exe - 19 error(s), 14 warning(s)
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
Last edited by TurboPT : 01-Dec-2007 at 20:21.
  #4  
Old 02-Dec-2007, 00:40
ddaigle ddaigle is offline
New Member
 
Join Date: Nov 2007
Posts: 11
ddaigle is on a distinguished road

Re: Need help with a simple "dragon" game.


Ok, so I think I fixed a few things: (i'm working with Dev-C++ by the way)

1- I added the apostrophe's around the variable names for 'cdec' and 'udec'.
2- I also change the = to == in the "if" statements and so on.
3- I also corrected the parts with ccoin + 5, because I needed to equate each statement to the new ccoin and ucoin.
4- I added a "result" char, so that the computer can tell whether or not to change it's choice in the next game. I'm not sure if I'm doing it right though, because the computer needs to use the "result" at the bottom to decide whether to change, so that part has to work good.
There might be some other changes that I forgot about too.

Here's what I have...

CPP / C++ / C Code:
#include <iostream>
#include <stdlib.h>

using namespace std;

//games = g
//game number = x
//computer coins = ccoin
//user coins = ucoin
//computer decision = cdec
//user decision = udec
//do nothing = N
//draw sword = S

//I'll make the computer always start off with drawing sword.

int main(int argc, char *argv[])
{
int g,x,ccoin,ucoin;
char cdec,udec, result;
string 
cdec = 'S';
ccoin = 0;
ucoin = 0;
x = 1;

cout << "How many games do you want to play? ";
cin >> g >> endl;
while (x<g){
    cout << "Game " << x << "." << endl;
    cout << "I've made my decision. What is your decision?: ";
    cin >> udec >> endl;
    cout << "My decision: " << cdec << ". Your decision: " << udec << "." << endl;
    if (udec=='S' && cdec=='S')
    {
        ccoin = ccoin + 5;
        ucoin = ucoin + 5;
        result == k;            //k=ok, e=excellent, b=bad, d=good
    }        
    else if (udec=='N' && cdec=='S')
    {
        ccoin = ccoin + 20;
        ucoin = ucoin + 0;
        result == e;
    }
    else if (udec=='S' && cdec=='N')
    {
        ccoin = ccoin + 0;
        ucoin = ucoin + 20;
        result == b;
    }
    else if (udec=='N' && cdec=='N')
    {
        ccoin = ccoin + 10;
        ucoin = ucoin + 10;
        result == a;
    }
    else
        cout << "You did not enter either S or N." << endl;
        
    cout << "I have " << ccoin << " coins. You have " << ucoin << " coins." << endl;
    
    if ( result = e || a)
        cdec=='N';
    else
        cdec=='S';
    
    x++;
}
system("PAUSE");	
return 0;
}




So my questions are...

-Is that the proper way to go about doing the "result" thing?
-Do I have to define k, e, b, and a?
-And also, how do I make the program restart or make the user try again if he/she did not enter N or S? (near the bottom I have the cout for it...)
  #5  
Old 02-Dec-2007, 09:14
WaltP's Avatar
WaltP WaltP is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Midwest US
Posts: 3,234
WaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to allWaltP is a name known to all

Re: Need help with a simple "dragon" game.


Quote:
Originally Posted by ddaigle
So my questions are...

-Is that the proper way to go about doing the "result" thing?
I guess so. It seems like it could work. There is no proper way, there are many ways. If it works for you it's probably just as proper as one someone else would come up with.

Quote:
Originally Posted by ddaigle
-Do I have to define k, e, b, and a?
Do you want the program to compile? Thinking for a moment will give you the answer.

But instead of ambiguous variable names like these, why not use names like ok, excellent, bad, good? Or better yet, make the #defines or consts.

Quote:
Originally Posted by ddaigle
-And also, how do I make the program restart or make the user try again if he/she did not enter N or S? (near the bottom I have the cout for it...)
Put the program in a while loop.
__________________

Cow: You're a lawyer too?
Mooseblood (mosquito): Ma'am, I was already a bloodsucking parasite. All I needed was a briefcase!
  #6  
Old 02-Dec-2007, 13:48
TurboPT's Avatar
TurboPT TurboPT is online now
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 926
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Need help with a simple "dragon" game.


Quote:
Originally Posted by ddaigle
Ok, so I think I fixed a few things: (i'm working with Dev-C++ by the way)

1- I added the apostrophe's around the variable names for 'cdec' and 'udec'.
2- I also change the = to == in the "if" statements and so on.
3- I also corrected the parts with ccoin + 5, because I needed to equate each statement to the new ccoin and ucoin.
4- I added a "result" char, so that the computer can tell whether or not to change it's choice in the next game. I'm not sure if I'm doing it right though, because the computer needs to use the "result" at the bottom to decide whether to change, so that part has to work good.
There might be some other changes that I forgot about too.

Here's what I have...
Ok, getting closer, but you still have errors...(down to 8, from 19!!)
Code:
Compiling... cpp3.cpp C:\cpp3.cpp(22) : error C2371: 'cdec' : redefinition; different basic types C:\cpp3.cpp(20) : see declaration of 'cdec' C:\cpp3.cpp(22) : error C2440: 'initializing' : cannot convert from 'const char' to 'class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >' No constructor could take the source type, or constructor overload resolution was ambiguous C:\cpp3.cpp(28) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion) C:\cpp3.cpp(32) : error C2679: binary '>>' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion) C:\cpp3.cpp(38) : error C2065: 'k' : undeclared identifier C:\cpp3.cpp(38) : warning C4553: '==' : operator has no effect; did you intend '='? C:\cpp3.cpp(44) : error C2065: 'e' : undeclared identifier C:\cpp3.cpp(44) : warning C4553: '==' : operator has no effect; did you intend '='? C:\cpp3.cpp(50) : error C2065: 'b' : undeclared identifier C:\cpp3.cpp(50) : warning C4553: '==' : operator has no effect; did you intend '='? C:\cpp3.cpp(56) : error C2065: 'a' : undeclared identifier C:\cpp3.cpp(56) : warning C4553: '==' : operator has no effect; did you intend '='? C:\cpp3.cpp(64) : warning C4553: '==' : operator has no effect; did you intend '='? C:\cpp3.cpp(66) : warning C4553: '==' : operator has no effect; did you intend '='? Error executing cl.exe. Creating browse info file... cpp3.exe - 8 error(s), 6 warning(s)
So lets look at a few things:
1. In the first error, contains 'redefinition'. That's because you have now declared cdec as both a string AND a char. Which do you want?
To assign the character S to cdev is what you have now.
CPP / C++ / C Code:
  cdev = 'S';  // single quotes for a single character.
IF you had wanted a string S, that would be:
CPP / C++ / C Code:
 cdev = "S"; // double quotes for a string. (one or more characters)
For this program, I'd say stick to the char.

2. endl is not associated with cin -- that goes with cout.

3. Waltp already responded to this question:
Quote:
Originally Posted by ddaigle
-Do I have to define k, e, b, and a?
Yes. Variable(s) are identifiers, and they MUST be declared. That's why half of your 8 errors are:
Code:
C:\cpp3.cpp(38) : error C2065: 'k' : undeclared identifier C:\cpp3.cpp(44) : error C2065: 'e' : undeclared identifier C:\cpp3.cpp(50) : error C2065: 'b' : undeclared identifier C:\cpp3.cpp(56) : error C2065: 'a' : undeclared identifier
In some of the newer changes, you are still mixing (misunderstanding, maybe??) the use of assignment(=) and comparison(==).

I'll stop here, again, for now. Post again (with updated code) after fixing the newer issues. Should you get stuck with something, post another reply.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #7  
Old 02-Dec-2007, 15:36
ddaigle ddaigle is offline
New Member
 
Join Date: Nov 2007
Posts: 11
ddaigle is on a distinguished road

Re: Need help with a simple "dragon" game.


K my program works now!!! There is one problem though, the computer never switches to 'N', it always stays at 'S' no matter what the outcome is. It must be a problem with the last 'if' statement, but i can't get it to work. Here is what I have again...

CPP / C++ / C Code:
#include <iostream>
#include <stdlib.h>

using namespace std;

//games = g
//game number = x
//computer coins = ccoin
//user coins = ucoin
//computer decision = cdec
//user decision = udec
//do nothing = N
//draw sword = S

//I'll make the computer always start off with drawing sword.

int main(int argc, char *argv[])
{
int g,x,ccoin,ucoin;
char cdec,udec,result,ok,excellent,good,bad;
cdec = 'S';
ccoin = 0;
ucoin = 0;
x = 1;

cout << "How many games do you want to play? ";
cin >> g;
while (x<=g){
    cout << "Game " << x << "." << endl;
    cout << "I've made my decision. What is your decision?: ";
    cin >> udec;
    cout << "My decision: " << cdec << ". Your decision: " << udec << "." << endl;
    if (udec=='S' && cdec=='S')
    {
        ccoin = ccoin + 5;
        ucoin = ucoin + 5;
        result == 'ok';            
    }        
    else if (udec=='N' && cdec=='S')
    {
        ccoin = ccoin + 20;
        ucoin = ucoin + 0;
        result == 'excellent';
    }
    else if (udec=='S' && cdec=='N')
    {
        ccoin = ccoin + 0;
        ucoin = ucoin + 20;
        result == 'bad';
    }
    else if (udec=='N' && cdec=='N')
    {
        ccoin = ccoin + 10;
        ucoin = ucoin + 10;
        result == 'good';
    }
    else
        cout << "You did not enter either S or N." << endl;
        
    cout << "I have " << ccoin << " coins. You have " << ucoin << " coins." << endl;
    
    if ( result == 'excellent' || 'good')
        cdec=='S';
    else
        cdec=='N';
    
    x++;
}
system("PAUSE");	
return 0;
}

Don't know why it won't change...
  #8  
Old 02-Dec-2007, 16:35
davis
 
Posts: n/a

Re: Need help with a simple "dragon" game.


Quote:
Originally Posted by ddaigle
K my program works now!!! There is one problem though, the computer never switches to 'N', it always stays at 'S' no matter what the outcome is. It must be a problem with the last 'if' statement, but i can't get it to work. Here is what I have again...

CPP / C++ / C Code:
#include <iostream>
#include <stdlib.h>

using namespace std;

//games = g
//game number = x
//computer coins = ccoin
//user coins = ucoin
//computer decision = cdec
//user decision = udec
//do nothing = N
//draw sword = S

//I'll make the computer always start off with drawing sword.

int main(int argc, char *argv[])
{
int g,x,ccoin,ucoin;
char cdec,udec,result,ok,excellent,good,bad;
cdec = 'S';
ccoin = 0;
ucoin = 0;
x = 1;

cout << "How many games do you want to play? ";
cin >> g;
while (x<=g){
    cout << "Game " << x << "." << endl;
    cout << "I've made my decision. What is your decision?: ";
    cin >> udec;
    cout << "My decision: " << cdec << ". Your decision: " << udec << "." << endl;
    if (udec=='S' && cdec=='S')
    {
        ccoin = ccoin + 5;
        ucoin = ucoin + 5;
        result == 'ok';            
    }        
    else if (udec=='N' && cdec=='S')
    {
        ccoin = ccoin + 20;
        ucoin = ucoin + 0;
        result == 'excellent';
    }
    else if (udec=='S' && cdec=='N')
    {
        ccoin = ccoin + 0;
        ucoin = ucoin + 20;
        result == 'bad';
    }
    else if (udec=='N' && cdec=='N')
    {
        ccoin = ccoin + 10;
        ucoin = ucoin + 10;
        result == 'good';
    }
    else
        cout << "You did not enter either S or N." << endl;
        
    cout << "I have " << ccoin << " coins. You have " << ucoin << " coins." << endl;
    
    if ( result == 'excellent' || 'good')
        cdec=='S';
    else
        cdec=='N';
    
    x++;
}
system("PAUSE");	
return 0;
}

Don't know why it won't change...

...maybe:

dragon_game.cpp:37:19: warning: multi-character character constant
dragon_game.cpp: In function `int main(int, char**)':
dragon_game.cpp:37: warning: comparison is always false due to limited range of data type
dragon_game.cpp:37: warning: statement has no effect
dragon_game.cpp:43:19: warning: character constant too long for its type
dragon_game.cpp:43: warning: comparison is always false due to limited range of data type
dragon_game.cpp:43: warning: statement has no effect
dragon_game.cpp:49:19: warning: multi-character character constant
dragon_game.cpp:49: warning: comparison is always false due to limited range of data type
dragon_game.cpp:49: warning: statement has no effect
dragon_game.cpp:55:19: warning: multi-character character constant
dragon_game.cpp:55: warning: comparison is always false due to limited range of data type
dragon_game.cpp:55: warning: statement has no effect
dragon_game.cpp:62:20: warning: character constant too long for its type
dragon_game.cpp:62: warning: comparison is always false due to limited range of data type
dragon_game.cpp:62:35: warning: multi-character character constant
dragon_game.cpp:63: warning: statement has no effect
dragon_game.cpp:65: warning: statement has no effect
dragon_game.cpp:20: warning: unused variable 'ok'
dragon_game.cpp:20: warning: unused variable 'excellent'
dragon_game.cpp:20: warning: unused variable 'good'
dragon_game.cpp:20: warning: unused variable 'bad'
dragon_game.cpp: At global scope:
dragon_game.cpp:18: warning: unused parameter 'argc'
dragon_game.cpp:18: warning: unused parameter 'argv'
[/code]

...has something to do with it?

Pay particular attention to the statements that say "is always false" and "statement has no effect."

The fact that this stuff even compiled amazes me...


:davis:
  #9  
Old 03-Dec-2007, 11:49
TurboPT's Avatar
TurboPT TurboPT is online now
Regular Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 926
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Need help with a simple "dragon" game.


... Davis, just for curiosity, which compiler do you have? My Visual Studio actually reports two errors, where yours claims them as warnings:
Code:
Compiling... File.cpp C:\File.cpp(39) : warning C4553: '==' : operator has no effect; did you intend '='? C:\File.cpp(45) : error C2015: too many characters in constant C:\File.cpp(45) : warning C4553: '==' : operator has no effect; did you intend '='? C:\File.cpp(51) : warning C4553: '==' : operator has no effect; did you intend '='? C:\File.cpp(57) : warning C4553: '==' : operator has no effect; did you intend '='? C:\File.cpp(64) : error C2015: too many characters in constant C:\File.cpp(65) : warning C4553: '==' : operator has no effect; did you intend '='? C:\File.cpp(67) : warning C4553: '==' : operator has no effect; did you intend '='? Error executing cl.exe. File.exe - 2 error(s), 6 warning(s)
ddiagle, look closely at the messages from the compiler (above), and I have to reiterate a point mentioned back in post #6:
Quote:
Originally Posted by turbopt
... you are still mixing (misunderstanding, maybe??) the use of assignment(=) and comparison(==).
Then you'll understand why:
Quote:
Originally Posted by ddiagle
...the computer never switches to 'N', it always stays at 'S' no matter what the outcome is. It must be a problem with the last 'if' statement...
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
  #10  
Old 03-Dec-2007, 13:22
davis
 
Posts: n/a

Re: Need help with a simple "dragon" game.


Quote:
Originally Posted by TurboPT
... Davis, just for curiosity, which compiler do you have? My Visual Studio actually reports two errors, where yours claims them as warnings:

GCC...don't remember what version and I'm not at that machine right now. I often switch between various versions of GCC based on what I'm doing in a given day. Some of my targets won't compile with the 4.x versions, so I tend to use 3.4.x a lot in those situations. I *think* that it was 4.1...but can't be too sure. Perhaps I'll check in the morning tomorrow and reply then?


:davis:
 
 

Recent GIDBlogLast Week of IA Training by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
"Linker Error" problem with C++ The Great Dane CPP / C++ Forum 2 10-Nov-2007 16:55
Computer Game Design HELP NEEDED! dcallito CPP / C++ Forum 3 01-Jun-2007 12:29
HELP!!!!HELP!!!! Design a game call “Games of Guessing” HELP!!!! tianurn CPP / C++ Forum 1 26-Mar-2007 15:38
question on old game! vwinterceptor Computer Software Forum - Games 5 07-Jun-2004 20:54
Tips for game troubleshooting pcxgamer Computer Software Forum - Games 0 02-Jan-2004 05:27

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 04:38.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.