The ProgrammersTalk Community
Forum Register Search Today's Posts Mark Forums Read
Register

Go Back   The ProgrammersTalk Community > Graphic & Game Programming > General Game Development


Welcome to the The ProgrammersTalk Community forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Reply
 
LinkBack Thread Tools    Display Modes   
  #1 (permalink)  
Old 12-01-2007, 08:13 PM
siLenTz's Avatar
siLenTz siLenTz is offline
Jr. Programmer
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Posts: 87
iTrader: (0)
siLenTz will become famous soon enoughsiLenTz will become famous soon enough
My board game

After returned from my online game life, I decided to make this board game
to review my programming skill. This game made with C++ and HGE engine.
You're able to play this with your real-life partner or play it with computer.


__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #2 (permalink)  
Old 12-02-2007, 12:36 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
Programming Expert
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,111
iTrader: (0)
HelloWorld will become famous soon enoughHelloWorld will become famous soon enoughHelloWorld will become famous soon enough
Hey Silentz!
Long time no see! Anyways, looks cool, would you mind sharing your codes..? I'd love to try it out probably..? It seems to be easily implemented using multidimentional arrays...?

__________________
PHP Code:
System.out.println("Hello World!"); 

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #3 (permalink)  
Old 12-02-2007, 02:41 AM
siLenTz's Avatar
siLenTz siLenTz is offline
Jr. Programmer
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Posts: 87
iTrader: (0)
siLenTz will become famous soon enoughsiLenTz will become famous soon enough
Sure, I can send you the source code to your email. However, the source code is little bit messy. PM me your email, I will surely send it to you.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #4 (permalink)  
Old 12-02-2007, 04:19 AM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 616
iTrader: (0)
Lee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enough
Welcome back mate, game looks good , is it the game where you have to get 5 in a row?
Reply With Quote
  #5 (permalink)  
Old 12-02-2007, 04:26 AM
siLenTz's Avatar
siLenTz siLenTz is offline
Jr. Programmer
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Posts: 87
iTrader: (0)
siLenTz will become famous soon enoughsiLenTz will become famous soon enough
Quote:
Originally Posted by Lee View Post
Welcome back mate, game looks good , is it the game where you have to get 5 in a row?
Yes, To win you need to be the first one to link 5 points together.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #6 (permalink)  
Old 12-02-2007, 10:28 AM
Lee's Avatar
Lee Lee is offline
PT Staff*
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: Blackpool, UK
Posts: 616
iTrader: (0)
Lee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enoughLee will become famous soon enough
Cool, did you code it the long way or the quick way, meaning do you code for each combination avaliable which takes hours or a short bit of code to detect if 5 are in a row?
Reply With Quote
  #7 (permalink)  
Old 12-02-2007, 01:39 PM
siLenTz's Avatar
siLenTz siLenTz is offline
Jr. Programmer
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Posts: 87
iTrader: (0)
siLenTz will become famous soon enoughsiLenTz will become famous soon enough
I check every move and analyze the last move of each players.

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
  #8 (permalink)  
Old 12-02-2007, 01:43 PM
siLenTz's Avatar
siLenTz siLenTz is offline
Jr. Programmer
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Posts: 87
iTrader: (0)
siLenTz will become famous soon enoughsiLenTz will become famous soon enough
I use this code to check the winner. lx and ly are the last move of the
player, cell2win refer to how many rows to connect in order to win.
Code:
bool Game_Win(char bTurn, int lx, int ly,int cell2win, int block)
{
    int b = 0, n = 1, oTurn, tx, ty;
    bool run = true;
    // oTurn mean opposite turn
    if (bTurn == 'X') oTurn = 'O';
    else oTurn = 'X';

    run = true; tx = lx; ty = ly;
    do {
        tx++;
        if (tx >= 20) run = false;
        if (board[ty][tx] == bTurn) {
                n++;
        } else if (board[ty][tx] == oTurn) {
                b++;
                run = false;
        } else {
                run = false;
        }
    } while(run);

    run = true; tx = lx; ty = ly;
    do {
        tx--;
        if (tx < 0) run = false;
        if (board[ty][tx] == bTurn) {
                n++;
        } else if (board[ty][tx] == oTurn) {
                b++;
                run = false;
        } else {
                run = false;
        }
    } while(run);

    if (n == cell2win && b < block) return true;

    n = 1; b = 0;
    run = true; tx = lx; ty = ly;
    do {
        ty++;
        if (ty >= 20) run = false;
        if (board[ty][tx] == bTurn) {
                n++;
        } else if (board[ty][tx] == oTurn) {
                b++;
                run = false;
        } else {
                run = false;
        }
    } while(run);

    run = true; tx = lx; ty = ly;
    do {
        ty--;
        if (ty < 0) run = false;
        if (board[ty][tx] == bTurn) {
                n++;
        } else if (board[ty][tx] == oTurn) {
                b++;
                run = false;
        } else {
            run = false;
        }
    } while(run);

    if (n == cell2win && b < block) return true;

    n = 1; b = 0;
    run = true; tx = lx; ty = ly;
    do {
        ty--;
        tx--;
        if (ty < 0 && tx < 0) run = false;
        if (board[ty][tx] == bTurn) {
                n++;
        } else if (board[ty][tx] == oTurn) {
                b++;
                run = false;
        } else {
                run = false;
        }
    } while(run);

    run = true; tx = lx; ty = ly;
    do {
        ty++;
        tx++;
        if (ty >= 20 && tx >= 20) run = false;
        if (board[ty][tx] == bTurn) {
                n++;
        } else if (board[ty][tx] == oTurn) {
                b++;
                run = false;
        } else {
                run = false;
        }
    } while(run);

    if (n == cell2win && b < block) return true;

    n = 1; b = 0;
    run = true; tx = lx; ty = ly;
    do {
        ty--;
        tx++;
        if (ty < 0 && tx >= 20) run = false;
        if (board[ty][tx] == bTurn) {
                n++;
        } else if (board[ty][tx] == oTurn) {
                b++;
                run = false;
        } else {
                run = false;
        }
    } while(run);

    run = true; tx = lx; ty = ly;
    do {
        ty++;
        tx--;
        if (ty >= 20 && tx < 0) run = false;
        if (board[ty][tx] == bTurn) {
                n++;
        } else if (board[ty][tx] == oTurn) {
                b++;
                run = false;
        } else {
                run = false;
        }
    } while(run);

    if (n == cell2win && b < block) return true;

    return false;
}

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote
The Following User Says Thank You to siLenTz For This Useful Post:
HelloWorld (12-02-2007)
  #9 (permalink)  
Old 12-06-2007, 11:03 AM
ccoonen ccoonen is offline
PT Staff
Awards Showcase
Quality Tutorial Quality Tutorial Quality Tutorial Quality Tutorial 
Total Awards: 4
Join Date: Jun 2007
Location: Wisconsin
Posts: 308
iTrader: (0)
ccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished roadccoonen is on a distinguished road
Thanks buddy!
Reply With Quote
Reply


Thread Tools
Display Modes

   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
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 11:47 AM. Powered by vBulletin
Copyright © 2000 - 2007, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO © 2007 ProgrammersTalk Sedo - Buy and Sell Domain Names and Websites project info: programmerstalk.net Statistics for project programmerstalk.net etracker® web controlling instead of log file analysis


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50