Jump to content

  • Log In with Google      Sign In   
  • Create Account

stoneyrich

Member Since 09 Aug 2012
Offline Last Active Aug 02 2014 01:38 PM

Topics I've Started

Threading Issues

24 July 2013 - 02:39 AM

Please I need help ? sad.png
I have a main thread to run (ProcessPlayerMoves)
void StartGame()
{
if (mainThread == null)
{
mainThread = new Thread(new ThreadStart(ProcessPlayerMoves));
mainThread.Name = "My Main Thread";
mainThread.IsBackground = true;
mainThread.Start();
}
else
{
}
}
Then the players method is as follows:
private sMove GetMoveForPlayer(Player p)
{
lastMove = null;
 
playerThread = new Thread(new ParameterizedThreadStart(p.Move));
playerThread.Name = p.Name;
playerThread.Start(game.GameBench);
 
//Register a listener
p.PlayerMoved += new PlayerMovedHandler(player_PlayerMoved);
 
// lastMove is assigned in the player_PlayerMoved handler
while (lastMove == null)
;
 
// if we get here the player moved
 
//Unregister the listenter
p.PlayerMoved -= player_PlayerMoved;
 
// Intervel Delay for the main thread 
if (chkSimulationDelay.Checked)
Thread.Sleep(simulationInterval);
 
try
{
playerThread.Join(); 
}
catch (ThreadAbortException tae)
{
Console.WriteLine(tae.ToString());
}
return p.CurrentMove;
}
During simulation there is no consitentcy, if i want to run say 500 games it just halts at 20 or sometimes 100 or 50. And i do not get an error, the game just stops but the program is still running.

Game Loop Implementation on Windows Forms C#

13 June 2013 - 11:52 AM

Hi guys,

 

I need help. 

 

I am designing a two player card game in C#, but i have a problem figuring out the following:

  1. The Main Game Loop (UI thread or a sperate thread) 
  2. Human Player and AI player should they be on different threads?

I am going to run experiments with different pairings at the end of the game development.

 

my thoughts are below: 

 

MainGameLoop() 
//player A or B ()
//display card played ()
//check the scores ()
}
 
AI_Player()
{
//Constant thread runing to identify if its AI's turn to play.
}
 
HumanPlayer()
{
   //A click event from the UI form.
}

 


Path node , route path, list algorithm

12 November 2012 - 09:19 AM

Hi everyone ...i would like your ideas on how to go about this list problem.

attached is a sample of the list am trying to work with:

I want to achieve a list of possible route like this

possible route 1 - 272<309<308>312>48

route 2 - 316<315>319>99

route 3 - 48<1420

< it begins from the left of the node
> it end at the right side of the node

any help ?

Implementing Transposition Table - NegaMax Search

09 August 2012 - 02:53 AM

I am trying to implement a transposition table in my search incorporating zobrist key a brief description - at each position you have 13 different pieces, 1-6 from player 1, 1-6 from player 2, and 0 (empty) that means my zobrist key table will be of size 13 * 25. I filled my table with some random values wit the code below

public void intZobristKeys() {

Random ranZobristKey;
ranZobristKey = new Random();

for (int positon = 0; positon < 325; positon++) {
zobrist_table[positon][EMPTY] = ranZobristKey.nextInt();
zobrist_table[positon][PLAYER_ONE] = ranZobristKey.nextInt();
zobrist_table[positon][PLAYER_TWO] = ranZobristKey.nextInt();
}

}

am stuck where do i move from here as in the link between this and recording the actual moves in the transposition table eg {hashkey, state value, depth} etc any help ?

PARTNERS