How do you program boards?

Ok, Heres the question. How do you prgram game boards? I have no idea! If annyone has any useful suggestions, fell free! I am talking about something similar to a chess board. Aldo, if anyone has some extremely simple chess progs out there, i would greatly appreciate it if i could see the code


thanks

Ender

Comments

  • : Ok, Heres the question. How do you prgram game boards? I have no idea! If annyone has any useful suggestions, fell free! I am talking about something similar to a chess board. Aldo, if anyone has some extremely simple chess progs out there, i would greatly appreciate it if i could see the code
    :
    :
    : thanks
    :
    : Ender
    :

    Let's say, in C there is a way, use arrays for examle:

    int board[7][7]; where int will describe figure 1-pawn
    2-tower 3-queen 4-king and so on...

    But that is simpliest way, and not most accurate for chess playing program. Anyway this should solve problem.

    I have never seen simple chess code, even programs that cannot use basic strategies are complicated enough to mix my senses.

    Good luck Ender.


  • : Ok, Heres the question. How do you prgram game boards? I have no
    : idea! If annyone has any useful suggestions, fell free! I am talking
    : about something similar to a chess board. Aldo, if anyone has some
    : extremely simple chess progs out there, i would greatly appreciate
    : it if i could see the code
    :
    :
    : thanks
    :
    : Ender
    :
    :
    ok if you use C or Basic

    C ..
    int Board [7][7];

    [7] means 0 to 7 which amounts to 8 files and 8 ranks

    VB6

    dim board(7)(7) as integer

    or

    dim board(63)

    which incidentally is what i used my program

    then to get file and rank you must use 'MOD' or /8 divide by eight ! which ends up using aaaaaaaalot of cycles traversing back and forth it is quite slow

    check out my two chess progs the 8x8 version is about 1400 elo strength whereas my board 63 version is only 700 elo (which is horrible by any standards!)
  • [color=Blue]
    8x8 boards are fast, because to Mul/Div by 8 you need only shifting by 3 bits left and right. Much worse is if you have a different board, say 10x10 or even configurable by user. In this case the only way to get rid of slow multiplication is to build a cache of row addresses, so any row in the matrix can be accessed just by getting the array value. Then, of course, add the column value and cell address is fully calculated.
    [/color]
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories