Thread: what kind of tree is used in chess?

  1. #1
    Registered User I C everything's Avatar
    Join Date
    Apr 2019
    Posts
    101

    Question what kind of tree is used in chess?

    binary tree,octtree?
    16 chess pieces at the beginning a double oct-tree?
    so if it is octtree is there a way to make it multithreaded to speed up recursive up and down going thru moves(tree),by let each thread wander up and down in left/right parts with two threads simultanously?
    the old code I seen is wander up and down in a tree,similar a human mind looks ahead on moves and calculates wins and losses of chess pieces,pawn to queen use the normal values,Kings set value as high as possible so it appears as infinite
    you tell me you can C,why dont you C your own bugs?

  2. #2
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,738
    Neither. Those would have too few nodes. What you need is a tree with somewhere around 20 sub-nodes for each node.

    Oh, you mean like a way to parallelize the possibilities? Sure, you could hand out the available top nodes to different threads, and synchronize them after every player move.
    Devoted my life to programming...

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Storing every possible move at each level rapidly becomes impractical.

    Consider Alpha–beta pruning - Wikipedia
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Apr 2017
    Location
    Iran
    Posts
    138
    You may ask your questions from this forum. There are many chess coders to help. see the "programming and technical discussions" sub-forum.

  5. #5
    Registered User I C everything's Avatar
    Join Date
    Apr 2019
    Posts
    101
    Quote Originally Posted by ordak View Post
    You may ask your questions from this forum. There are many chess coders to help. see the "programming and technical discussions" sub-forum.
    thanks,it looks very interesting
    wonder maybe a simplest chess engine,might probably be flawed in endgame,not avoiding stalemate
    also thanks greaper,salem
    you tell me you can C,why dont you C your own bugs?

  6. #6
    Registered User
    Join Date
    Apr 2017
    Location
    Iran
    Posts
    138
    Quote Originally Posted by I C everything View Post
    thanks,it looks very interesting
    wonder maybe a simplest chess engine,might probably be flawed in endgame,not avoiding stalemate
    also thanks greaper,salem
    Chess programming wiki.

    TSCP.

  7. #7
    Registered User I C everything's Avatar
    Join Date
    Apr 2019
    Posts
    101
    Quote Originally Posted by ordak View Post
    thanks,so I start with make chess board+various arrays under it that keeps track of chess pieces and such
    you tell me you can C,why dont you C your own bugs?

  8. #8
    Registered User
    Join Date
    Apr 2017
    Location
    Iran
    Posts
    138
    Quote Originally Posted by I C everything View Post
    thanks,so I start with make chess board+various arrays under it that keeps track of chess pieces and such
    Sorry I am not well informed here. But it seems to me the approach you say is called "mailbox". There is another way to represent chess board and that is called "bitboard".

    For more info see this link.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 08-01-2007, 01:08 PM
  2. display tree data in binary tree format
    By xddxogm3 in forum C++ Programming
    Replies: 4
    Last Post: 12-11-2003, 12:47 AM
  3. Replies: 5
    Last Post: 05-23-2003, 01:11 PM
  4. What kind of car do you have?
    By Tleggo in forum A Brief History of Cprogramming.com
    Replies: 50
    Last Post: 06-13-2002, 03:56 PM
  5. my grandfather's chess algorithm can beat your grandfather's chess algorithm...
    By doubleanti in forum A Brief History of Cprogramming.com
    Replies: 22
    Last Post: 08-17-2001, 06:52 PM

Tags for this Thread