root/randseq_test.c

Revision 106, 2.1 kB (checked in by ng, 5 years ago)

mise a jour licence

Line 
1 /***************************************************************************
2  *   This file is part of the 'gemmes' project                             *
3  *                                                                         *
4  *                                                                         *
5  *   Copyright (C) 2007 by                                                 *
6  *         GARCH Soufiane                                                  *
7  *         GUILLAUME Nicolas <ng@ngsoft-fr.com>                            *
8  *                                                                         *
9  *                                                                         *
10  *   This program is free software; you can redistribute it and/or modify  *
11  *   it under the terms of the GNU General Public License as published by  *
12  *   the Free Software Foundation; version 2 of the License only.          *
13  *   See the COPYING file.                                                 *
14  ***************************************************************************/
15
16
17
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <time.h>
21
22 #include "gemmes.h"
23
24
25
26 int main()
27 {
28     srand(time(0));
29
30
31     randseq_t fstr = randseq_new_from_str("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
32
33     board_t b=board_new(9,9,fstr);
34
35     board_print(b);
36
37     printf("case=%c\n", board_pos(b, 5, 5));
38
39     printf("up1=%c\n", board_neighbor(b, 5, 5, up, 1));
40     printf("up2=%c\n", board_neighbor(b, 5, 5, up, 2));
41     printf("up3=%c\n", board_neighbor(b, 5, 5, up, 3));
42
43     printf("down1=%c\n", board_neighbor(b, 5, 5, down, 1));
44     printf("down2=%c\n", board_neighbor(b, 5, 5, down, 2));
45     printf("down3=%c\n", board_neighbor(b, 5, 5, down, 3));
46
47     printf("left1=%c\n", board_neighbor(b, 5, 5, left, 1));
48     printf("left2=%c\n", board_neighbor(b, 5, 5, left, 2));
49     printf("left3=%c\n", board_neighbor(b, 5, 5, left, 3));
50
51     printf("right1=%c\n", board_neighbor(b, 5, 5, right, 1));
52     printf("right2=%c\n", board_neighbor(b, 5, 5, right, 2));
53     printf("right3=%c\n", board_neighbor(b, 5, 5, right, 3));
54
55
56
57
58     board_free(b);
59
60
61     return EXIT_SUCCESS;
62 }
Note: See TracBrowser for help on using the browser.