Programming chess engine

Discussions about Winboard/Xboard. News about engines or programs to use with these GUIs (e.g. tournament managers or adapters) belong in this sub forum.

Moderator: Andres Valverde

Re: Programming chess engine

Postby matrix101 » 26 Apr 2014, 16:58

A class defines a data type, much like a struct would be in C. In a computer science sense, a type consists of both a set of states and a set of operations which transition between those states. Thus int is a type because it has both a set of states and it has operations like i + j or i++, etc. In exactly the same way, a class provides a set of (usually public) operations, and a set of (usually non-public) data bits representing the abstract values that instances of the type can have.

Ok so if I understand this statement, class is a variable that allows user to decide what the function would do. The advantage of class compared to int is that it can represent the abstract values that instances of the type can have.

For example:



class Board
{
// This class encapsulates the chess board, and provides functions
// for making and undoing moves.


In this one the user is compeletely free to define these statements when using class?

If I wanted to say:

class Attacks
{
// If a piece a attacks piece b then piece a needs to move in a straight or diagonal line

Then it would work, or at least this is the basic idea of class (a structure that can store data, the data needs to be implemented correctly of course)
matrix101
 
Posts: 53
Joined: 02 Feb 2014, 12:46

Re: Programming chess engine

Postby H.G.Muller » 26 Apr 2014, 21:08

I have no idea. 'class' is a C++ concept, and I don't know C++. There is no such thing as 'class' in plain C.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Previous

Return to Winboard and related Topics

Who is online

Users browsing this forum: No registered users and 34 guests