Hi, I am making program that finds solution how to put 12 knights(horses) to chess board that every square is dominated or engaged by other knight. Look at my code: #include <stdio.h> #include <stdlib.h> #include <stdbool.h> //(*******************************************************************************) void addNulls(char L[][9], int N[], int M[]) { int i,j,g; for (i=1 ; i<9 ; i++) for (j=1 ; j<9 ; j++) if (L[i][j]!='K') L[i][j]='0'; for (i=1 ; i <9 ; i++) for (j=1 ; j <9; j++) if (L[i][j]=='K') for (g=1 ; g <9; g++) if (i+N[g]>0&&i+N[g]<9 && j+M[g]>0 && j+M[g]<9 && L[i+N[g]][ j+M[g]] == '0') L[i+N[g]][ j+M[g]] = '*'; } //(*******************************************************************************) …

Member Avatar
Member Avatar
+0 forum 2

Hi I have to write program that finds a solution how to put 12 knights to a 8x8 chess board that every square would be dominated by one of the 12 knights. Do you have any suggestions from where I can start?

Member Avatar
Member Avatar
+0 forum 3

I am implementing Priority QUE as a doubly linked list. My structs: typedef int kintyr; typedef struct qElem { struct qElem *prv; kintyr *dat; int *priority; }qElem; typedef struct que { qElem *fr,*bk; int cnt; }que; And this is my functions to create empty PQ, and to insert elements: que *qNew() { que *q = malloc(sizeof(*q)); if (q==NULL) return NULL; q->fr = NULL; q->bk = NULL; q->cnt = 0; qFault = 0; return q; } que *qEnq(que *q, kintyr *x, int *prrt) { que *zn=q; qFault = 0; if (q == NULL) { qFault = 1; return q; } if …

Member Avatar
Member Avatar
+0 forum 2

The End.