Implementation/Representation of Symmetries in Chessboards

In a 8X8 chessboard, I was wondering how to implement the symmetry of the board.

A lot of positions are just mirrors or rotations of one another (with no pawns or castling capabilities left the directions are indistinguishable).

By using a combination of vertical, horizontal and diagonal mirrorings of the board it is always possible to fix the position of a piece within the a1-d1-d4 triangle.

How to implement these symmetries on chess board?
How does implementation depends on choice of board representation chosen(Bit-boards, 0x88, 8×8 array, and so on) ?

Edit 1: The main goal is the implementation of the endgame engine generator and compress its results

3

There are several ways to tackle rotation of a chess board. The easiest way to implement it is the same way we think about it. You create a grid of 8×8, and each position on the grid may or may not have a chess piece on top. To mirror that grid, you simply create another chess board, and place each piece in the old chess board in its mirrored location.

This, however, can be simplified by removing the grid altogether. The grid is arbitrary and serves primarily for us to understand better. So you could use a chess board object to emulate all positions on the chess board, but the only information it would actually require are the types and positions of the chess pieces themselves.

The chess piece itself can be abstracted away into type and position information. If you do not need to know how it moves, then the only reason the type would be useful is for you to compare with other chess pieces and ensure that other than position, types are the same in order to say that it is the same.

The chess board can mirror itself simply by returning another chess board instance with the positions altered (i.e. for each chess piece’s x coordinate, piece.x = 9 – piece.x).

At that point, the problem simply becomes iterating the chess pieces of one chess board and another and verifying that all the positions and types are the same (you can optimize by checking the number of pieces first).

Note that if you don’t require comparing mirrored versions of chessboards, you can optimize further by using only one instance and computing where a chess piece, if it were mirrored, would be relative to that current spot and then check for the existence and type of that piece.

Hope that helps. I think it’s important to present an interface that is easy for you to understand and let the underlying implementation optimize how data is represented and/or utilized.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật