Oktatás * Programozás 2 * Szkriptnyelvek * levelezősök Félévek Linkek * kalendárium |
EnPy /
20120816a8 queens The 8 queens puzzle is the problem of placing 8 chess queens on an 8×8 chessboard so that no two queens threaten each other. The exercise this time is to display "graphically" a possible setup. The chessboard is represented as an array (instead of a matrix), e.g. +-----------------+ | Q . . . . . . . | | . . . . . . Q . | | . . . . Q . . . | | . . . . . . . Q | | . Q . . . . . . | | . . . Q . . . . | | . . . . . Q . . | | . . Q . . . . . | +-----------------+ Exercise: write a method that receives a list of 8 elements, and draws the corresponding chessboard. For instance, if the input is +-----------------+ | . . Q . . . . . | | . . . . . Q . . | | . . . Q . . . . | | . Q . . . . . . | | . . . . . . . Q | | . . . . Q . . . | | . . . . . . Q . | | Q . . . . . . . | +-----------------+ Some important points:
|
Blogjaim, hobbi projektjeim * The Ubuntu Incident [ edit ] |