Mon, 31 Mar 2014 14:08:00 +0200
improved network performance
10
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
1 | /* |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
2 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
3 | * |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
4 | * Copyright 2014 Mike Becker. All rights reserved. |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
5 | * |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
6 | * Redistribution and use in source and binary forms, with or without |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
7 | * modification, are permitted provided that the following conditions are met: |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
8 | * |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
9 | * 1. Redistributions of source code must retain the above copyright |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
10 | * notice, this list of conditions and the following disclaimer. |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
11 | * |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
12 | * 2. Redistributions in binary form must reproduce the above copyright |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
13 | * notice, this list of conditions and the following disclaimer in the |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
14 | * documentation and/or other materials provided with the distribution. |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
15 | * |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
16 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
17 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
26 | * POSSIBILITY OF SUCH DAMAGE. |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
27 | * |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
28 | */ |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
29 | |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
30 | #include "knight.h" |
16
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
31 | #include "rules.h" |
19
6a26114297a1
moved chess rules to separate lib
Mike Becker <universe@uap-core.de>
parents:
16
diff
changeset
|
32 | #include <stdlib.h> |
10
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
33 | |
16
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
34 | _Bool knight_chkrules(Move *move) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
35 | int dx = abs(move->fromfile - move->tofile); |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
36 | int dy = abs(move->fromrow - move->torow); |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
37 | |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
38 | return (dx == 2 && dy == 1) || (dx == 1 && dy == 2); |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
39 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
40 | |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
41 | static int knight_getloc_fixedrow(Board board, Move *move) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
42 | int d = 3 - abs(move->fromrow - move->torow); |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
43 | |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
44 | if (d == 1 || d == 2) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
45 | if (move->tofile < 6 && |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
46 | board[move->fromrow][move->tofile + d] == move->piece) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
47 | if (move->fromfile == POS_UNSPECIFIED) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
48 | move->fromfile = move->tofile + d; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
49 | return VALID_MOVE_SYNTAX; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
50 | } else { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
51 | return AMBIGUOUS_MOVE; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
52 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
53 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
54 | if (move->tofile > 1 && |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
55 | board[move->fromrow][move->tofile - d] == move->piece) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
56 | if (move->fromfile == POS_UNSPECIFIED) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
57 | move->fromfile = move->tofile - d; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
58 | return VALID_MOVE_SYNTAX; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
59 | } else { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
60 | return AMBIGUOUS_MOVE; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
61 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
62 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
63 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
64 | |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
65 | return INVALID_POSITION; |
10
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
66 | } |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
67 | |
16
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
68 | static int knight_getloc_fixedfile(Board board, Move *move) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
69 | int d = 3 - abs(move->fromfile - move->tofile); |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
70 | |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
71 | if (d == 1 || d == 2) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
72 | if (move->torow < 6 && |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
73 | board[move->torow + d][move->fromfile] == move->piece) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
74 | if (move->fromrow == POS_UNSPECIFIED) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
75 | move->fromrow = move->torow + d; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
76 | return VALID_MOVE_SYNTAX; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
77 | } else { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
78 | return AMBIGUOUS_MOVE; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
79 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
80 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
81 | if (move->torow > 1 && |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
82 | board[move->torow - d][move->fromfile] == move->piece) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
83 | if (move->fromrow == POS_UNSPECIFIED) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
84 | move->fromrow = move->torow - d; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
85 | return VALID_MOVE_SYNTAX; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
86 | } else { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
87 | return AMBIGUOUS_MOVE; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
88 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
89 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
90 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
91 | |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
92 | return INVALID_POSITION; |
10
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
93 | } |
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
94 | |
16
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
95 | int knight_getlocation(Board board, Move *move) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
96 | |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
97 | if (move->fromfile != POS_UNSPECIFIED) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
98 | return knight_getloc_fixedfile(board, move); |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
99 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
100 | |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
101 | if (move->fromrow != POS_UNSPECIFIED) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
102 | return knight_getloc_fixedrow(board, move); |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
103 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
104 | |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
105 | for (int x = -2 ; x <= 2 ; x++) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
106 | if (x == 0) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
107 | continue; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
108 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
109 | for (int y = -2 ; y <= 2 ; y++) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
110 | if (y == 0 || y == x) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
111 | continue; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
112 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
113 | uint8_t cx = move->tofile + x; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
114 | uint8_t cy = move->torow + y; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
115 | |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
116 | if (isidx(cx) && isidx(cy) && board[cy][cx] == move->piece) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
117 | if (move->fromfile == POS_UNSPECIFIED |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
118 | && move->fromrow == POS_UNSPECIFIED) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
119 | move->fromfile = cx; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
120 | move->fromrow = cy; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
121 | } else { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
122 | return AMBIGUOUS_MOVE; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
123 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
124 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
125 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
126 | } |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
127 | |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
128 | if (move->fromfile == POS_UNSPECIFIED || move->fromrow == POS_UNSPECIFIED) { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
129 | return INVALID_POSITION; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
130 | } else { |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
131 | return VALID_MOVE_SYNTAX; |
a298c6637c30
introduced status codes for get_location to produce detailed error messages + added knight rules
Mike Becker <universe@uap-core.de>
parents:
12
diff
changeset
|
132 | } |
10
1347e4dabac0
prepared code base for implementing rules
Mike Becker <universe@uap-core.de>
parents:
diff
changeset
|
133 | } |