{"content":{"sharePage":{"page":0,"digests":[{"id":"53144276","dateCreated":"1334960990","smartDate":"Apr 20, 2012","userCreated":{"username":"WhiskeySour","url":"https:\/\/www.wikispaces.com\/user\/view\/WhiskeySour","imageUrl":"https:\/\/www.wikispaces.com\/i\/user_none_lg.jpg"},"monitored":false,"locked":false,"links":{"self":"https:\/\/chessprogramming.wikispaces.com\/share\/view\/53144276"},"dateDigested":1531477432,"startDate":null,"sharedType":"discussion","title":"fillSq","description":"After looking this over, the fillSq function, which is called throughout the application, could run more efficiently if the implementation used switch statements rather than if-statements. The code would look like this:
\n
\nvoid fillSq(U8 color, U8 piece, S8 sq)
\n{
\n ...
\n switch (piece)
\n {
\n case KING: ...
\n case PAWN: ...
\n default: ...
\n }
\n ...
\n}
\n
\nIn addition, I believe it's a good idea to convert pieces into its own type, preferably through a typedef, so that the function would have the following, self-documenting signature:
\n
\nvoid fillSq(U8 color, Piece piece, S8 sq);","replyPages":[{"page":0,"digests":[],"more":0}]},{"id":"4553625","dateCreated":"1212648731","smartDate":"Jun 4, 2008","userCreated":{"username":"Pawel_Koziol","url":"https:\/\/www.wikispaces.com\/user\/view\/Pawel_Koziol","imageUrl":"https:\/\/www.wikispaces.com\/i\/user_none_lg.jpg"},"monitored":false,"locked":false,"links":{"self":"https:\/\/chessprogramming.wikispaces.com\/share\/view\/4553625"},"dateDigested":1531477432,"startDate":null,"sharedType":"discussion","title":"position data","description":"I've got one question: where to put all the detailed information about position that will be needed in evaluation, null move decisions etc. The alternatives I can think of are:
\n
\n1) adding variables like whitePawnsNo within the b struct
\n2) setting the constants denoting addresses in the unused part of the 0x88 tables, like I have done in Hopeless
\n3) creating the separate struct called perception, like I have done in CCCP
\n
\nWhat are Your thoughts?","replyPages":[{"page":0,"digests":[{"id":"4554533","body":"Well I think 2) would be the most efficient way to handle this, as it uses otherwise wasted resources.
\nBut for a tutorial chess engine that might not be the main aim. Having own variables for the evaluation terms would support readability. Well 1) and 3) are quite similar. But I think that evaluation would deserve its own struct.
\n
\nBTW have you received my Private Message Pawel?","dateCreated":"1212663848","smartDate":"Jun 5, 2008","userCreated":{"username":"Edmund_Moshammer","url":"https:\/\/www.wikispaces.com\/user\/view\/Edmund_Moshammer","imageUrl":"https:\/\/www.wikispaces.com\/i\/user_none_lg.jpg"}}],"more":0}]},{"id":"4526799","dateCreated":"1212474975","smartDate":"Jun 2, 2008","userCreated":{"username":"Pawel_Koziol","url":"https:\/\/www.wikispaces.com\/user\/view\/Pawel_Koziol","imageUrl":"https:\/\/www.wikispaces.com\/i\/user_none_lg.jpg"},"monitored":false,"locked":false,"links":{"self":"https:\/\/chessprogramming.wikispaces.com\/share\/view\/4526799"},"dateDigested":1531477432,"startDate":null,"sharedType":"discussion","title":"piece numbers","description":"I would prefer to number white pieces from 1 to 6, and black from 8 to 13. This way 8 is reserved to mark an empty square and we have an unambigous way of asking what color is a piece of a given square:
\n
\nint isWhite(piece) {
\n if ( piece < 8 )
\n return 1;
\n else
\n return 0;
\n}
\n
\nint isBlack(piece) {
\n if ( piece > 8 )
\n return 1;
\n else
\n return 0;
\n}
\n
\nIf You can come up with something equally easy, I'll take Your numbering.","replyPages":[{"page":0,"digests":[{"id":"4526941","body":"I agree, the numbering I used was just off the top of my head. I still even have to check the fen and display code I wrote.","dateCreated":"1212477576","smartDate":"Jun 3, 2008","userCreated":{"username":"Edmund_Moshammer","url":"https:\/\/www.wikispaces.com\/user\/view\/Edmund_Moshammer","imageUrl":"https:\/\/www.wikispaces.com\/i\/user_none_lg.jpg"}}],"more":0}]}],"more":false},"comments":[]},"http":{"code":200,"status":"OK"},"redirectUrl":null,"javascript":null,"notices":{"warning":[],"error":[],"info":[],"success":[]}}