/* For this representation, generate 9 vertices, corresponding to the columns and rows of a chessboard, and add "row" relationships between these locations in the same row. Connect the first item in each row within a board using a "col" edge. This representation can obviously be improved. */ #include main(argc, argv) int argc; char *argv[]; { char c[9]; int i, j, vnum=1; for (i=0; i<114; i++) { scanf("%c,%c,%c,%c,%c,%c,%c,%c,%c\n", &c[0], &c[1], &c[2], &c[3], &c[4], &c[5], &c[6], &c[7], &c[8]); for (j=0; j<9; j++) printf("v %d %c\n", vnum++, c[j]); printf("d %d %d row\n", vnum-9, vnum-8); /* Connect first row */ printf("d %d %d row\n", vnum-8, vnum-7); printf("d %d %d row\n", vnum-6, vnum-5); /* Connect second row */ printf("d %d %d row\n", vnum-5, vnum-4); printf("d %d %d row\n", vnum-3, vnum-2); /* Connect third row */ printf("d %d %d row\n", vnum-2, vnum-1); printf("d %d %d col\n", vnum-9, vnum-6); /* Connect first column */ printf("d %d %d col\n", vnum-6, vnum-3); } }