Advertisement

My first Full Completed C Game

Started by August 06, 2002 04:41 PM
48 comments, last by Radagar 22 years, 4 months ago
quote: Original post by LordLethis
Hmmm...
Why can the AI chose a field I've just taken??


This is a problem that I'm currently fixing. Now sure how it happened, but I reorganized the AI so that it can't happen anymore. Will have version 2.0 with this fix out in a few hours (probably)

~~~~~~~~~~~
Chris Vogel
~~~~~~~~~~~


[edited by - Radagar on August 7, 2002 1:56:45 PM]
WyrmSlayer RPG - In Early Development

That game is good for console and I have some questions about the programming you used in your game as I''d like to use some techniques you used in my own console applications. I presume you used C++ (if not then please tell me).

1. How do you change the colour of the text?

2. How do you clear the screen (like the CLS function in BASIC and BATCH)?

I''d also like to comment on the A.I:
I played it a few times (not long enough to find these bugs I''ve heard about), and the CPU fell for the oldest TTT trick in the book:

This was the position after our first moves:
| |
| |
---|---|---
| O | X
---|---|---
| |
| |

As you can probably figure, this is NOT a good position to be in.If you don''t get my point I''ll show you what it leads to:

| |
O | | O
---|---|---
| O | X
---|---|---
| | X
| |

I now have two possibilities of attack and he can only defend one! I WIN!!! There is NO defense once you have moved to one of the four edge spaces on your first turn.

Also the CPU doesn''t go for the centre if it can like a human player does.

Other than that and these problems people have been having it is a good game and you should be proud of it.
>>>>>>>>>>>>>>>>>Ilthigore<<<<<<<<<<<<<<<<<
Advertisement
Sorry about the last message''s documentation of the TTT boards. I''ll write the number code for the game instead:

HUMAN: 5
CPU: 6

The game continues in fig. 2

HUMAN: 1
CPU: 9
HUMAN: 3

Then if
CPU: 2
HUMAN: 7

or vice-verca.
>>>>>>>>>>>>>>>>>Ilthigore<<<<<<<<<<<<<<<<<
quote: Original post by Ilthigore

That game is good for console and I have some questions about the programming you used in your game as I''d like to use some techniques you used in my own console applications. I presume you used C++ (if not then please tell me).

1. How do you change the colour of the text?

2. How do you clear the screen (like the CLS function in BASIC and BATCH)?

I''d also like to comment on the A.I:
I played it a few times (not long enough to find these bugs I''ve heard about), and the CPU fell for the oldest TTT trick in the book:

This was the position after our first moves:
| |
| |
---|---|---
| O | X
---|---|---
| |
| |

As you can probably figure, this is NOT a good position to be in.If you don''t get my point I''ll show you what it leads to:

| |
O | | O
---|---|---
| O | X
---|---|---
| | X
| |

I now have two possibilities of attack and he can only defend one! I WIN!!! There is NO defense once you have moved to one of the four edge spaces on your first turn.

Also the CPU doesn''t go for the centre if it can like a human player does.

Other than that and these problems people have been having it is a good game and you should be proud of it.


Thanks for the Comments.

1) I did use C++, although it''s truly only C, as in I use no classes or Object Oriented Programmed. Basically just C.

2) I used functions that I found around the web and modified (with permission) for the CLS and COLOR functions. When I post the source, feel free to copy them. they are in the function.cpp and function.h files. the functions are basically used as...
clrscr();
gotoXY(X,Y);
and
setForeColor(COLOR);

3) I know the AI isn''t very good right now. But I''ll try to improve that some.
WyrmSlayer RPG - In Early Development
Version 2.0 Has been Released. Computer is a little smarter. Computer doesn't cheat and put down 2 tiles during it's turn. and Computer doesn't get confused and stop laying tiles down either.

Also, fixed the Input system to match the Numpad.

You can download it HERE or use the link on the original post up top.

[edited by - Radagar on August 7, 2002 2:57:55 PM]
WyrmSlayer RPG - In Early Development
Pretty good! (Now how about that source code?) Colors are nice, No cheating, everything is in order.. nice job!
Advertisement
quote: Original post by Vegeten
Pretty good! (Now how about that source code?) Colors are nice, No cheating, everything is in order.. nice job!


I hate to release buggy code. If 2.0 doesn''t have any problems reported in the next hour or so, I''ll throw the source out there for everyone =)

WyrmSlayer RPG - In Early Development
Released the Source Code. See the Original Post. Have fun everyone!

~~~~~~~~~~~
Chris Vogel
~~~~~~~~~~~
WyrmSlayer RPG - In Early Development
Pretty cool source code, though it''s too complicated for me since I don''t understand #define and all.. Thanks, and good job!
quote: Original post by Vegeten
Pretty cool source code, though it's too complicated for me since I don't understand #define and all.. Thanks, and good job!


#defines are very easy... Let me see if I can explain.

#define basically just sets a constant value. For example...


  #define PLAYERNUMBER   1cout<<"You are Player Number "<<PLAYERNUMBER;output:You are Player Number 1  


oh, and if you are refering to the inclusion guards, here is the explanation

when you see this in a header file...
//Inclusion Guard#ifndef INC_CVTTT_H#define INC_CVTTT_H......#endif //INC_CVTTT_H  


what this does is...

1) Checks to see if INC_CVTTT_H has been #defined. INC_CVTTT_H is just a unique variable name and doesn't really mean anything.. If it hasn't been defined, then...
2) it #defines INC_CVTTT_H
3) it includes all the header information

Now, the next time that header is read... INC_CVTTT_H is already #defined, so it doesn't reread all the header information, it simply skips down the the #endif.

Hope i made sense

~~~~~~~~~~~
Chris Vogel
~~~~~~~~~~~


[edited by - Radagar on August 7, 2002 5:36:14 PM]
WyrmSlayer RPG - In Early Development

This topic is closed to new replies.

Advertisement