@@ -18,287 +18,287 @@ |
||
| 18 | 18 | define('_MD_CHESS_DELETE_FORM', 'Delete challenge'); |
| 19 | 19 | |
| 20 | 20 | // game type |
| 21 | -define('_MD_CHESS_LABEL_GAMETYPE', 'Game type'); |
|
| 21 | +define('_MD_CHESS_LABEL_GAMETYPE', 'Game type'); |
|
| 22 | 22 | define('_MD_CHESS_LABEL_GAMETYPE_OPEN', 'Open challenge'); |
| 23 | 23 | define('_MD_CHESS_LABEL_GAMETYPE_USER', 'Individual challenge'); |
| 24 | 24 | define('_MD_CHESS_LABEL_GAMETYPE_SELF', 'Self-play'); |
| 25 | -define('_MD_CHESS_MENU_GAMETYPE_OPEN', _MD_CHESS_LABEL_GAMETYPE_OPEN . ' - anyone can accept your challenge'); |
|
| 26 | -define('_MD_CHESS_MENU_GAMETYPE_USER', _MD_CHESS_LABEL_GAMETYPE_USER . ' - only the specified user can accept your challenge'); |
|
| 27 | -define('_MD_CHESS_MENU_GAMETYPE_SELF', _MD_CHESS_LABEL_GAMETYPE_SELF . ' - play against yourself (for learning or testing)'); |
|
| 25 | +define('_MD_CHESS_MENU_GAMETYPE_OPEN', _MD_CHESS_LABEL_GAMETYPE_OPEN.' - anyone can accept your challenge'); |
|
| 26 | +define('_MD_CHESS_MENU_GAMETYPE_USER', _MD_CHESS_LABEL_GAMETYPE_USER.' - only the specified user can accept your challenge'); |
|
| 27 | +define('_MD_CHESS_MENU_GAMETYPE_SELF', _MD_CHESS_LABEL_GAMETYPE_SELF.' - play against yourself (for learning or testing)'); |
|
| 28 | 28 | |
| 29 | 29 | // opponent |
| 30 | 30 | define('_MD_CHESS_LABEL_OPPONENT', 'Opponent'); |
| 31 | 31 | |
| 32 | 32 | // FEN setup |
| 33 | -define('_MD_CHESS_LABEL_FEN_SETUP', 'FEN setup'); |
|
| 33 | +define('_MD_CHESS_LABEL_FEN_SETUP', 'FEN setup'); |
|
| 34 | 34 | define('_MD_CHESS_LABEL_FEN_EXPLAIN', 'You may optionally provide a board setup position, using FEN (Forsyth-Edwards Notation). If omitted, the standard board setup will be used.'); |
| 35 | 35 | |
| 36 | 36 | // color preference |
| 37 | -define('_MD_CHESS_LABEL_COLOR', 'My color will be'); |
|
| 37 | +define('_MD_CHESS_LABEL_COLOR', 'My color will be'); |
|
| 38 | 38 | define('_MD_CHESS_RADIO_COLOR_OPPONENT', 'Assigned by my opponent'); |
| 39 | -define('_MD_CHESS_RADIO_COLOR_RANDOM', 'Assigned randomly'); |
|
| 40 | -define('_MD_CHESS_RADIO_COLOR_WHITE', 'White'); |
|
| 41 | -define('_MD_CHESS_RADIO_COLOR_BLACK', 'Black'); |
|
| 39 | +define('_MD_CHESS_RADIO_COLOR_RANDOM', 'Assigned randomly'); |
|
| 40 | +define('_MD_CHESS_RADIO_COLOR_WHITE', 'White'); |
|
| 41 | +define('_MD_CHESS_RADIO_COLOR_BLACK', 'Black'); |
|
| 42 | 42 | |
| 43 | 43 | // notifications |
| 44 | 44 | define('_MD_CHESS_NEVT_ACPT_CHAL_CAP', 'Notify me when someone accepts my challenge to a game.'); |
| 45 | -define('_MD_CHESS_NEVT_MOVE_CAP', 'Notify me when a new move is made in this game.'); |
|
| 45 | +define('_MD_CHESS_NEVT_MOVE_CAP', 'Notify me when a new move is made in this game.'); |
|
| 46 | 46 | |
| 47 | 47 | // buttons |
| 48 | -define('_MD_CHESS_CREATE_SUBMIT', 'Submit'); |
|
| 49 | -define('_MD_CHESS_CREATE_ACCEPT', 'Accept'); |
|
| 50 | -define('_MD_CHESS_CREATE_CANCEL', 'Cancel'); |
|
| 51 | -define('_MD_CHESS_CREATE_DELETE', 'Delete'); |
|
| 48 | +define('_MD_CHESS_CREATE_SUBMIT', 'Submit'); |
|
| 49 | +define('_MD_CHESS_CREATE_ACCEPT', 'Accept'); |
|
| 50 | +define('_MD_CHESS_CREATE_CANCEL', 'Cancel'); |
|
| 51 | +define('_MD_CHESS_CREATE_DELETE', 'Delete'); |
|
| 52 | 52 | define('_MD_CHESS_CONFIRM_DELETE', 'Yes, I am sure I want to delete this'); |
| 53 | 53 | |
| 54 | 54 | // errors |
| 55 | -define('_MD_CHESS_ERROR', 'Error'); |
|
| 56 | -define('_MD_CHESS_GAMETYPE_INVALID', 'Game type not valid'); |
|
| 57 | -define('_MD_CHESS_FEN_INVALID', 'FEN setup not valid'); |
|
| 58 | -define('_MD_CHESS_OPPONENT_MISSING', 'You must specify the username of your opponent.'); |
|
| 59 | -define('_MD_CHESS_OPPONENT_INVALID', 'That opponent is unknown or not available for game play.'); |
|
| 60 | -define('_MD_CHESS_OPPONENT_SELF', 'You cannot challenge yourself.'); |
|
| 61 | -define('_MD_CHESS_GAME_NOT_FOUND', 'Game not found.'); |
|
| 62 | -define('_MD_CHESS_GAME_DELETED', 'Game deleted'); |
|
| 63 | -define('_MD_CHESS_WRONG_PLAYER2', 'You may not accept a challenge offered to another user.'); |
|
| 64 | -define('_MD_CHESS_SAME_PLAYER2', 'You may not accept a challenge from yourself.'); |
|
| 55 | +define('_MD_CHESS_ERROR', 'Error'); |
|
| 56 | +define('_MD_CHESS_GAMETYPE_INVALID', 'Game type not valid'); |
|
| 57 | +define('_MD_CHESS_FEN_INVALID', 'FEN setup not valid'); |
|
| 58 | +define('_MD_CHESS_OPPONENT_MISSING', 'You must specify the username of your opponent.'); |
|
| 59 | +define('_MD_CHESS_OPPONENT_INVALID', 'That opponent is unknown or not available for game play.'); |
|
| 60 | +define('_MD_CHESS_OPPONENT_SELF', 'You cannot challenge yourself.'); |
|
| 61 | +define('_MD_CHESS_GAME_NOT_FOUND', 'Game not found.'); |
|
| 62 | +define('_MD_CHESS_GAME_DELETED', 'Game deleted'); |
|
| 63 | +define('_MD_CHESS_WRONG_PLAYER2', 'You may not accept a challenge offered to another user.'); |
|
| 64 | +define('_MD_CHESS_SAME_PLAYER2', 'You may not accept a challenge from yourself.'); |
|
| 65 | 65 | define('_MD_CHESS_NO_CONFIRM_DELETE', 'You must check the confirmation box'); |
| 66 | -define('_MD_CHESS_NO_JAVASCRIPT', 'Javascript not enabled. Moves must be made by text entry.'); |
|
| 67 | -define('_MD_CHESS_MODHEAD_MISSING', 'WARNING: <{$xoops_module_header}> missing from themes/%s/theme.html.'); |
|
| 68 | -define('_MD_CHESS_TOKEN_ERROR', 'Token missing or invalid.'); |
|
| 66 | +define('_MD_CHESS_NO_JAVASCRIPT', 'Javascript not enabled. Moves must be made by text entry.'); |
|
| 67 | +define('_MD_CHESS_MODHEAD_MISSING', 'WARNING: <{$xoops_module_header}> missing from themes/%s/theme.html.'); |
|
| 68 | +define('_MD_CHESS_TOKEN_ERROR', 'Token missing or invalid.'); |
|
| 69 | 69 | |
| 70 | 70 | // templates |
| 71 | -define('_MD_CHESS_LABEL_GAMES', 'Games'); |
|
| 72 | -define('_MD_CHESS_LABEL_NO_GAMES', 'No games'); |
|
| 73 | -define('_MD_CHESS_LABEL_GAME', 'Game'); |
|
| 74 | -define('_MD_CHESS_LABEL_CREATED', 'Created'); |
|
| 75 | -define('_MD_CHESS_LABEL_LAST_MOVE', 'Last move'); |
|
| 76 | -define('_MD_CHESS_LABEL_STATUS', 'Status'); |
|
| 77 | -define('_MD_CHESS_LABEL_VS', 'vs.'); |
|
| 78 | -define('_MD_CHESS_LABEL_DRAW', 'Draw'); |
|
| 79 | -define('_MD_CHESS_LABEL_WHITE_WON', 'White won'); |
|
| 80 | -define('_MD_CHESS_LABEL_BLACK_WON', 'Black won'); |
|
| 81 | -define('_MD_CHESS_LABEL_WHITE', 'White'); |
|
| 82 | -define('_MD_CHESS_LABEL_BLACK', 'Black'); |
|
| 83 | -define('_MD_CHESS_LABEL_TO_MOVE', 'to move'); |
|
| 71 | +define('_MD_CHESS_LABEL_GAMES', 'Games'); |
|
| 72 | +define('_MD_CHESS_LABEL_NO_GAMES', 'No games'); |
|
| 73 | +define('_MD_CHESS_LABEL_GAME', 'Game'); |
|
| 74 | +define('_MD_CHESS_LABEL_CREATED', 'Created'); |
|
| 75 | +define('_MD_CHESS_LABEL_LAST_MOVE', 'Last move'); |
|
| 76 | +define('_MD_CHESS_LABEL_STATUS', 'Status'); |
|
| 77 | +define('_MD_CHESS_LABEL_VS', 'vs.'); |
|
| 78 | +define('_MD_CHESS_LABEL_DRAW', 'Draw'); |
|
| 79 | +define('_MD_CHESS_LABEL_WHITE_WON', 'White won'); |
|
| 80 | +define('_MD_CHESS_LABEL_BLACK_WON', 'Black won'); |
|
| 81 | +define('_MD_CHESS_LABEL_WHITE', 'White'); |
|
| 82 | +define('_MD_CHESS_LABEL_BLACK', 'Black'); |
|
| 83 | +define('_MD_CHESS_LABEL_TO_MOVE', 'to move'); |
|
| 84 | 84 | define('_MD_CHESS_LABEL_WHITE_TO_MOVE', 'White to move'); |
| 85 | 85 | define('_MD_CHESS_LABEL_BLACK_TO_MOVE', 'Black to move'); |
| 86 | -define('_MD_CHESS_LABEL_CHALLENGES', 'Challenges'); |
|
| 86 | +define('_MD_CHESS_LABEL_CHALLENGES', 'Challenges'); |
|
| 87 | 87 | define('_MD_CHESS_LABEL_NO_CHALLENGES', 'No challenges'); |
| 88 | -define('_MD_CHESS_LABEL_TYPE', 'Type'); |
|
| 89 | -define('_MD_CHESS_LABEL_CHALLENGER', 'Challenger'); |
|
| 90 | -define('_MD_CHESS_LABEL_COLOR_OPTION', 'Color Option'); |
|
| 91 | -define('_MD_CHESS_LABEL_GAME_OVER', 'Game over, score'); |
|
| 92 | -define('_MD_CHESS_PGN_FULL', 'Portable Game Notation'); |
|
| 93 | -define('_MD_CHESS_PGN_ABBREV', 'PGN'); |
|
| 94 | -define('_MD_CHESS_FEN_FULL', 'Forsyth-Edwards Notation'); |
|
| 95 | -define('_MD_CHESS_FEN_ABBREV', 'FEN'); |
|
| 96 | -define('_MD_CHESS_LABEL_ERROR', '*error*'); |
|
| 97 | -define('_MD_CHESS_PROMOTE_TO', 'Promote pawn to'); |
|
| 98 | - |
|
| 99 | -define('_MD_CHESS_ALT_EMPTY', 'empty square'); |
|
| 100 | -define('_MD_CHESS_ALT_WKING', 'white king'); |
|
| 101 | -define('_MD_CHESS_ALT_WQUEEN', 'white queen'); |
|
| 102 | -define('_MD_CHESS_ALT_WROOK', 'white rook'); |
|
| 88 | +define('_MD_CHESS_LABEL_TYPE', 'Type'); |
|
| 89 | +define('_MD_CHESS_LABEL_CHALLENGER', 'Challenger'); |
|
| 90 | +define('_MD_CHESS_LABEL_COLOR_OPTION', 'Color Option'); |
|
| 91 | +define('_MD_CHESS_LABEL_GAME_OVER', 'Game over, score'); |
|
| 92 | +define('_MD_CHESS_PGN_FULL', 'Portable Game Notation'); |
|
| 93 | +define('_MD_CHESS_PGN_ABBREV', 'PGN'); |
|
| 94 | +define('_MD_CHESS_FEN_FULL', 'Forsyth-Edwards Notation'); |
|
| 95 | +define('_MD_CHESS_FEN_ABBREV', 'FEN'); |
|
| 96 | +define('_MD_CHESS_LABEL_ERROR', '*error*'); |
|
| 97 | +define('_MD_CHESS_PROMOTE_TO', 'Promote pawn to'); |
|
| 98 | + |
|
| 99 | +define('_MD_CHESS_ALT_EMPTY', 'empty square'); |
|
| 100 | +define('_MD_CHESS_ALT_WKING', 'white king'); |
|
| 101 | +define('_MD_CHESS_ALT_WQUEEN', 'white queen'); |
|
| 102 | +define('_MD_CHESS_ALT_WROOK', 'white rook'); |
|
| 103 | 103 | define('_MD_CHESS_ALT_WBISHOP', 'white bishop'); |
| 104 | 104 | define('_MD_CHESS_ALT_WKNIGHT', 'white knight'); |
| 105 | -define('_MD_CHESS_ALT_WPAWN', 'white pawn'); |
|
| 106 | -define('_MD_CHESS_ALT_BKING', 'black king'); |
|
| 107 | -define('_MD_CHESS_ALT_BQUEEN', 'black queen'); |
|
| 108 | -define('_MD_CHESS_ALT_BROOK', 'black rook'); |
|
| 105 | +define('_MD_CHESS_ALT_WPAWN', 'white pawn'); |
|
| 106 | +define('_MD_CHESS_ALT_BKING', 'black king'); |
|
| 107 | +define('_MD_CHESS_ALT_BQUEEN', 'black queen'); |
|
| 108 | +define('_MD_CHESS_ALT_BROOK', 'black rook'); |
|
| 109 | 109 | define('_MD_CHESS_ALT_BBISHOP', 'black bishop'); |
| 110 | 110 | define('_MD_CHESS_ALT_BKNIGHT', 'black knight'); |
| 111 | -define('_MD_CHESS_ALT_BPAWN', 'black pawn'); |
|
| 111 | +define('_MD_CHESS_ALT_BPAWN', 'black pawn'); |
|
| 112 | 112 | |
| 113 | -define('_MD_CHESS_CONFIRM', 'Confirm'); |
|
| 113 | +define('_MD_CHESS_CONFIRM', 'Confirm'); |
|
| 114 | 114 | |
| 115 | 115 | define('_MD_CHESS_BUTTON_MOVE', 'Submit'); |
| 116 | 116 | |
| 117 | -define('_MD_CHESS_NORMAL_MOVE', 'Normal move'); |
|
| 118 | -define('_MD_CHESS_RESIGN', 'Resign'); |
|
| 119 | -define('_MD_CHESS_OFFER_DRAW', 'Offer draw'); |
|
| 120 | -define('_MD_CHESS_ACCEPT_DRAW', 'Accept draw'); |
|
| 121 | -define('_MD_CHESS_REJECT_DRAW', 'Reject draw'); |
|
| 122 | -define('_MD_CHESS_CLAIM_DRAW_50', 'Claim draw (50-move rule)'); |
|
| 123 | -define('_MD_CHESS_CLAIM_DRAW_3', 'Claim draw (threefold repetition)'); |
|
| 124 | -define('_MD_CHESS_RESTART', 'Restart game'); |
|
| 125 | -define('_MD_CHESS_DELETE', 'Delete game'); |
|
| 126 | -define('_MD_CHESS_WANT_ARBITRATION', 'Request arbitration'); |
|
| 127 | -define('_MD_CHESS_MOVE_EXPLAIN', 'Please state reason.'); |
|
| 128 | -define('_MD_CHESS_AFTER_MOVE', 'after move'); |
|
| 117 | +define('_MD_CHESS_NORMAL_MOVE', 'Normal move'); |
|
| 118 | +define('_MD_CHESS_RESIGN', 'Resign'); |
|
| 119 | +define('_MD_CHESS_OFFER_DRAW', 'Offer draw'); |
|
| 120 | +define('_MD_CHESS_ACCEPT_DRAW', 'Accept draw'); |
|
| 121 | +define('_MD_CHESS_REJECT_DRAW', 'Reject draw'); |
|
| 122 | +define('_MD_CHESS_CLAIM_DRAW_50', 'Claim draw (50-move rule)'); |
|
| 123 | +define('_MD_CHESS_CLAIM_DRAW_3', 'Claim draw (threefold repetition)'); |
|
| 124 | +define('_MD_CHESS_RESTART', 'Restart game'); |
|
| 125 | +define('_MD_CHESS_DELETE', 'Delete game'); |
|
| 126 | +define('_MD_CHESS_WANT_ARBITRATION', 'Request arbitration'); |
|
| 127 | +define('_MD_CHESS_MOVE_EXPLAIN', 'Please state reason.'); |
|
| 128 | +define('_MD_CHESS_AFTER_MOVE', 'after move'); |
|
| 129 | 129 | |
| 130 | 130 | define('_MD_CHESS_DELETE_WARNING', 'This will permanently remove the game from the database!'); |
| 131 | 131 | |
| 132 | 132 | define('_MD_CHESS_BUTTON_REFRESH', 'Refresh'); |
| 133 | 133 | |
| 134 | 134 | define('_MD_CHESS_ORIENTATION_ACTIVE', 'Active color at bottom'); |
| 135 | -define('_MD_CHESS_ORIENTATION_WHITE', 'White at bottom'); |
|
| 136 | -define('_MD_CHESS_ORIENTATION_BLACK', 'Black at bottom'); |
|
| 137 | - |
|
| 138 | -define('_MD_CHESS_ARBITER_CONTROLS', 'Arbiter Controls'); |
|
| 139 | -define('_MD_CHESS_ARBITER_SUSPEND', 'Suspend play'); |
|
| 140 | -define('_MD_CHESS_ARBITER_RESUME', 'Resume normal play'); |
|
| 141 | -define('_MD_CHESS_ARBITER_DRAW', 'Declare draw'); |
|
| 142 | -define('_MD_CHESS_ARBITER_EXPLAIN', 'Please state reason.'); |
|
| 143 | -define('_MD_CHESS_ARBITER_DELETE', 'Delete game'); |
|
| 144 | -define('_MD_CHESS_ARBITER_NOACTION', 'No action'); |
|
| 145 | -define('_MD_CHESS_ARBITER_SHOWCTRL', 'Show arbiter controls'); |
|
| 135 | +define('_MD_CHESS_ORIENTATION_WHITE', 'White at bottom'); |
|
| 136 | +define('_MD_CHESS_ORIENTATION_BLACK', 'Black at bottom'); |
|
| 137 | + |
|
| 138 | +define('_MD_CHESS_ARBITER_CONTROLS', 'Arbiter Controls'); |
|
| 139 | +define('_MD_CHESS_ARBITER_SUSPEND', 'Suspend play'); |
|
| 140 | +define('_MD_CHESS_ARBITER_RESUME', 'Resume normal play'); |
|
| 141 | +define('_MD_CHESS_ARBITER_DRAW', 'Declare draw'); |
|
| 142 | +define('_MD_CHESS_ARBITER_EXPLAIN', 'Please state reason.'); |
|
| 143 | +define('_MD_CHESS_ARBITER_DELETE', 'Delete game'); |
|
| 144 | +define('_MD_CHESS_ARBITER_NOACTION', 'No action'); |
|
| 145 | +define('_MD_CHESS_ARBITER_SHOWCTRL', 'Show arbiter controls'); |
|
| 146 | 146 | |
| 147 | 147 | define('_MD_CHESS_ARBITER_DELETE_WARNING', 'This will permanently remove the game from the database!'); |
| 148 | 148 | |
| 149 | 149 | define('_MD_CHESS_BUTTON_ARBITRATE', 'Submit'); |
| 150 | 150 | |
| 151 | -define('_MD_CHESS_WHEN_SUSPENDED', 'When suspended'); |
|
| 152 | -define('_MD_CHESS_SUSPENDED_BY', 'Suspended by'); |
|
| 153 | -define('_MD_CHESS_SUSPENSION_TYPE', 'Suspension type'); |
|
| 151 | +define('_MD_CHESS_WHEN_SUSPENDED', 'When suspended'); |
|
| 152 | +define('_MD_CHESS_SUSPENDED_BY', 'Suspended by'); |
|
| 153 | +define('_MD_CHESS_SUSPENSION_TYPE', 'Suspension type'); |
|
| 154 | 154 | define('_MD_CHESS_SUSPENSION_REASON', 'Suspension reason'); |
| 155 | -define('_MD_CHESS_UNKNOWN', '*unknown*'); |
|
| 155 | +define('_MD_CHESS_UNKNOWN', '*unknown*'); |
|
| 156 | 156 | define('_MD_CHESS_SUSP_TYPE_ARBITER', 'Suspended by arbiter'); |
| 157 | -define('_MD_CHESS_SUSP_TYPE_PLAYER', 'Arbitration requested'); |
|
| 157 | +define('_MD_CHESS_SUSP_TYPE_PLAYER', 'Arbitration requested'); |
|
| 158 | 158 | |
| 159 | -define('_MD_CHESS_MOVE_ENTRY', 'Move Entry'); |
|
| 160 | -define('_MD_CHESS_MOVE_LIST', 'Move List'); |
|
| 161 | -define('_MD_CHESS_EXPORT_FORMATS', 'Export'); |
|
| 159 | +define('_MD_CHESS_MOVE_ENTRY', 'Move Entry'); |
|
| 160 | +define('_MD_CHESS_MOVE_LIST', 'Move List'); |
|
| 161 | +define('_MD_CHESS_EXPORT_FORMATS', 'Export'); |
|
| 162 | 162 | define('_MD_CHESS_CAPTURED_PIECES', 'Captured Pieces'); |
| 163 | 163 | |
| 164 | 164 | // Notifications |
| 165 | -define('_MD_CHESS_WHITE', 'White'); |
|
| 166 | -define('_MD_CHESS_BLACK', 'Black'); |
|
| 167 | -define('_MD_CHESS_RESIGNED', 'resigned.'); |
|
| 168 | -define('_MD_CHESS_OFFERED_DRAW', 'offered a draw.'); |
|
| 169 | -define('_MD_CHESS_ACCEPTED_DRAW', 'accepted a draw offer.'); |
|
| 170 | -define('_MD_CHESS_REJECTED_DRAW', 'rejected a draw offer.'); |
|
| 171 | -define('_MD_CHESS_RQSTED_ARBT', 'requested arbitration.'); |
|
| 165 | +define('_MD_CHESS_WHITE', 'White'); |
|
| 166 | +define('_MD_CHESS_BLACK', 'Black'); |
|
| 167 | +define('_MD_CHESS_RESIGNED', 'resigned.'); |
|
| 168 | +define('_MD_CHESS_OFFERED_DRAW', 'offered a draw.'); |
|
| 169 | +define('_MD_CHESS_ACCEPTED_DRAW', 'accepted a draw offer.'); |
|
| 170 | +define('_MD_CHESS_REJECTED_DRAW', 'rejected a draw offer.'); |
|
| 171 | +define('_MD_CHESS_RQSTED_ARBT', 'requested arbitration.'); |
|
| 172 | 172 | define('_MD_CHESS_BEEN_SUSPENDED', 'Game suspended pending review by an arbiter.'); |
| 173 | -define('_MD_CHESS_AS_ARBITER', 'acting as arbiter'); |
|
| 174 | -define('_MD_CHESS_RESUMED_PLAY', 'resumed normal play.'); |
|
| 175 | -define('_MD_CHESS_DECLARED_DRAW', 'declared a draw.'); |
|
| 176 | -define('_MD_CHESS_DELETED_GAME', 'deleted the game.'); |
|
| 173 | +define('_MD_CHESS_AS_ARBITER', 'acting as arbiter'); |
|
| 174 | +define('_MD_CHESS_RESUMED_PLAY', 'resumed normal play.'); |
|
| 175 | +define('_MD_CHESS_DECLARED_DRAW', 'declared a draw.'); |
|
| 176 | +define('_MD_CHESS_DELETED_GAME', 'deleted the game.'); |
|
| 177 | 177 | define('_MD_CHESS_SUSPENDED_PLAY', '$username (acting as arbiter) suspended play.'); |
| 178 | 178 | |
| 179 | 179 | // FEN setup errors |
| 180 | -define('_MD_CHESS_FENBAD_LENGTH', 'invalid length'); |
|
| 181 | -define('_MD_CHESS_FENBAD_FIELD_COUNT', 'wrong number of fields'); |
|
| 182 | -define('_MD_CHESS_FENBAD_PP_INVALID', 'piece placement invalid'); |
|
| 183 | -define('_MD_CHESS_FENBAD_AC_INVALID', 'active color invalid'); |
|
| 184 | -define('_MD_CHESS_FENBAD_CA_INVALID', 'castling availability invalid'); |
|
| 185 | -define('_MD_CHESS_FENBAD_EP_INVALID', 'en passant target_square invalid'); |
|
| 186 | -define('_MD_CHESS_FENBAD_HC_INVALID', 'halfmove clock invalid'); |
|
| 187 | -define('_MD_CHESS_FENBAD_FN_INVALID', 'fullmove number invalid'); |
|
| 188 | -define('_MD_CHESS_FENBAD_MATERIAL', 'insufficient mating material'); |
|
| 189 | -define('_MD_CHESS_FENBAD_IN_CHECK', 'player to move cannot have opponent in check'); |
|
| 180 | +define('_MD_CHESS_FENBAD_LENGTH', 'invalid length'); |
|
| 181 | +define('_MD_CHESS_FENBAD_FIELD_COUNT', 'wrong number of fields'); |
|
| 182 | +define('_MD_CHESS_FENBAD_PP_INVALID', 'piece placement invalid'); |
|
| 183 | +define('_MD_CHESS_FENBAD_AC_INVALID', 'active color invalid'); |
|
| 184 | +define('_MD_CHESS_FENBAD_CA_INVALID', 'castling availability invalid'); |
|
| 185 | +define('_MD_CHESS_FENBAD_EP_INVALID', 'en passant target_square invalid'); |
|
| 186 | +define('_MD_CHESS_FENBAD_HC_INVALID', 'halfmove clock invalid'); |
|
| 187 | +define('_MD_CHESS_FENBAD_FN_INVALID', 'fullmove number invalid'); |
|
| 188 | +define('_MD_CHESS_FENBAD_MATERIAL', 'insufficient mating material'); |
|
| 189 | +define('_MD_CHESS_FENBAD_IN_CHECK', 'player to move cannot have opponent in check'); |
|
| 190 | 190 | define('_MD_CHESS_FENBAD_CA_INCONSISTENT', 'castling availability inconsistent with piece placement'); |
| 191 | -define('_MD_CHESS_FENBAD_EP_COLOR', 'en passant target square wrong color'); |
|
| 192 | -define('_MD_CHESS_FENBAD_EP_NO_PAWN', 'en passant target square for nonexistent pawn'); |
|
| 191 | +define('_MD_CHESS_FENBAD_EP_COLOR', 'en passant target square wrong color'); |
|
| 192 | +define('_MD_CHESS_FENBAD_EP_NO_PAWN', 'en passant target square for nonexistent pawn'); |
|
| 193 | 193 | |
| 194 | 194 | // Move-messages |
| 195 | 195 | // Some of these messages are processed with eval() in ChessGame::move_msg(), and may contain parameters $param[1], $param[2], etc. |
| 196 | -define('_MD_CHESS_MOVE_UNKNOWN', 'ERROR (autocomplete): format is totally unknown!'); |
|
| 197 | -define('_MD_CHESS_MOVE_PAWN_MAY_BECOME', 'ERROR (autocomplete): A pawn may only become either a knight, a bishop, a rook or a queen!'); |
|
| 198 | -define('_MD_CHESS_MOVE_USE_X', 'ERROR (autocomplete): use x to indicate an attack'); |
|
| 199 | -define('_MD_CHESS_MOVE_COORD_INVALID', 'ERROR (autocomplete): coordinate {$param[1]} is invalid'); |
|
| 200 | -define('_MD_CHESS_MOVE_CANNOT_FIND_PAWN', 'ERROR (autocomplete): cannot find {$param[1]} pawn in column {$param[2]}'); |
|
| 201 | -define('_MD_CHESS_MOVE_USE_NOTATION', 'ERROR (autocomplete): please use denotation [a-h]x[a-h][1-8] for pawn attacks (see help for more information)'); |
|
| 202 | -define('_MD_CHESS_MOVE_NO_PAWN', 'ERROR (autocomplete): there is no pawn in column {$param[1]}'); |
|
| 203 | -define('_MD_CHESS_MOVE_TWO_PAWNS', 'ERROR (autocomplete): there is more than one pawn in column {$param[1]}'); |
|
| 204 | -define('_MD_CHESS_MOVE_NO_FIGURE', 'ERROR (autocomplete): there is no figure {$param[1]} = {$param[2]}'); |
|
| 196 | +define('_MD_CHESS_MOVE_UNKNOWN', 'ERROR (autocomplete): format is totally unknown!'); |
|
| 197 | +define('_MD_CHESS_MOVE_PAWN_MAY_BECOME', 'ERROR (autocomplete): A pawn may only become either a knight, a bishop, a rook or a queen!'); |
|
| 198 | +define('_MD_CHESS_MOVE_USE_X', 'ERROR (autocomplete): use x to indicate an attack'); |
|
| 199 | +define('_MD_CHESS_MOVE_COORD_INVALID', 'ERROR (autocomplete): coordinate {$param[1]} is invalid'); |
|
| 200 | +define('_MD_CHESS_MOVE_CANNOT_FIND_PAWN', 'ERROR (autocomplete): cannot find {$param[1]} pawn in column {$param[2]}'); |
|
| 201 | +define('_MD_CHESS_MOVE_USE_NOTATION', 'ERROR (autocomplete): please use denotation [a-h]x[a-h][1-8] for pawn attacks (see help for more information)'); |
|
| 202 | +define('_MD_CHESS_MOVE_NO_PAWN', 'ERROR (autocomplete): there is no pawn in column {$param[1]}'); |
|
| 203 | +define('_MD_CHESS_MOVE_TWO_PAWNS', 'ERROR (autocomplete): there is more than one pawn in column {$param[1]}'); |
|
| 204 | +define('_MD_CHESS_MOVE_NO_FIGURE', 'ERROR (autocomplete): there is no figure {$param[1]} = {$param[2]}'); |
|
| 205 | 205 | define('_MD_CHESS_MOVE_NEITHER_CAN_REACH', 'ERROR (autocomplete): neither of the {$param[1]} = {$param[2]} can reach {$param[3]}'); |
| 206 | -define('_MD_CHESS_MOVE_BOTH_CAN_REACH', 'ERROR (autocomplete): both of the {$param[1]} = {$param[2]} can reach {$param[3]}'); |
|
| 207 | -define('_MD_CHESS_MOVE_AMBIGUOUS', 'ERROR (autocomplete): ambiguity is not properly resolved'); |
|
| 208 | -define('_MD_CHESS_MOVE_UNDEFINED', 'ERROR: undefined'); |
|
| 209 | -define('_MD_CHESS_MOVE_GAME_OVER', 'ERROR: This game is over. It is not possible to enter any further moves.'); |
|
| 210 | -define('_MD_CHESS_MOVE_NO_CASTLE', 'ERROR: You cannot castle.'); |
|
| 211 | -define('_MD_CHESS_MOVE_INVALID_PIECE', 'ERROR: only N (knight), B (bishop), R (rook) and Q (queen) are valid chessman identifiers'); |
|
| 212 | -define('_MD_CHESS_MOVE_UNKNOWN_FIGURE', 'ERROR: Figure {$param[1]} is unknown!'); |
|
| 213 | -define('_MD_CHESS_MOVE_TILE_EMPTY', 'ERROR: Tile {$param[1]} is empty'); |
|
| 214 | -define('_MD_CHESS_MOVE_NOT_YOUR_PIECE', 'ERROR: Figure does not belong to you!'); |
|
| 215 | -define('_MD_CHESS_MOVE_NOEXIST_FIGURE', 'ERROR: Figure does not exist!'); |
|
| 216 | -define('_MD_CHESS_MOVE_START_END_SAME', 'ERROR: Current position and destination are equal!'); |
|
| 217 | -define('_MD_CHESS_MOVE_UNKNOWN_ACTION', 'ERROR: {$param[1]} is unknown! Please use "-" for a move and "x" for an attack.'); |
|
| 218 | -define('_MD_CHESS_MOVE_OUT_OF_RANGE', 'ERROR: Tile {$param[1]} is out of range for {$param[2]} at {$param[3]}!'); |
|
| 219 | -define('_MD_CHESS_MOVE_OCCUPIED', 'ERROR: Tile {$param[1]} is occupied. You cannot move there.'); |
|
| 220 | -define('_MD_CHESS_MOVE_NO_EN_PASSANT' , 'ERROR: en-passant not possible!'); |
|
| 221 | -define('_MD_CHESS_MOVE_ATTACK_EMPTY', 'ERROR: Tile {$param[1]} is empty. You cannot attack it."'); |
|
| 222 | -define('_MD_CHESS_MOVE_ATTACK_SELF', 'ERROR: You cannot attack own unit at {$param[1]}.'); |
|
| 223 | -define('_MD_CHESS_MOVE_IN_CHECK', 'ERROR: Move is invalid because king would be under attack then.'); |
|
| 224 | -define('_MD_CHESS_MOVE_CASTLED_SHORT', 'You castled short.'); |
|
| 225 | -define('_MD_CHESS_MOVE_CASTLED_LONG', 'You castled long.'); |
|
| 226 | -define('_MD_CHESS_MOVE_MOVED', '{$param[1]} moved from {$param[2]} to {$param[3]}'); |
|
| 227 | -define('_MD_CHESS_MOVE_CAPTURED', '{$param[1]} captured {$param[2]} from {$param[3]}'); |
|
| 228 | -define('_MD_CHESS_MOVE_PROMOTED', 'and became a {$param[1]}!'); |
|
| 229 | -define('_MD_CHESS_MOVE_CHECKMATE', 'checkmate!'); |
|
| 230 | -define('_MD_CHESS_MOVE_STALEMATE', 'stalemate!'); |
|
| 231 | -define('_MD_CHESS_MOVE_MATERIAL', 'insufficient mating material!'); |
|
| 232 | -define('_MD_CHESS_MOVE_KING', 'king'); |
|
| 233 | -define('_MD_CHESS_MOVE_QUEEN', 'queen'); |
|
| 234 | -define('_MD_CHESS_MOVE_ROOK', 'rook'); |
|
| 235 | -define('_MD_CHESS_MOVE_BISHOP', 'bishop'); |
|
| 236 | -define('_MD_CHESS_MOVE_KNIGHT', 'knight'); |
|
| 237 | -define('_MD_CHESS_MOVE_PAWN', 'pawn'); |
|
| 238 | -define('_MD_CHESS_MOVE_EMPTY', 'empty'); |
|
| 206 | +define('_MD_CHESS_MOVE_BOTH_CAN_REACH', 'ERROR (autocomplete): both of the {$param[1]} = {$param[2]} can reach {$param[3]}'); |
|
| 207 | +define('_MD_CHESS_MOVE_AMBIGUOUS', 'ERROR (autocomplete): ambiguity is not properly resolved'); |
|
| 208 | +define('_MD_CHESS_MOVE_UNDEFINED', 'ERROR: undefined'); |
|
| 209 | +define('_MD_CHESS_MOVE_GAME_OVER', 'ERROR: This game is over. It is not possible to enter any further moves.'); |
|
| 210 | +define('_MD_CHESS_MOVE_NO_CASTLE', 'ERROR: You cannot castle.'); |
|
| 211 | +define('_MD_CHESS_MOVE_INVALID_PIECE', 'ERROR: only N (knight), B (bishop), R (rook) and Q (queen) are valid chessman identifiers'); |
|
| 212 | +define('_MD_CHESS_MOVE_UNKNOWN_FIGURE', 'ERROR: Figure {$param[1]} is unknown!'); |
|
| 213 | +define('_MD_CHESS_MOVE_TILE_EMPTY', 'ERROR: Tile {$param[1]} is empty'); |
|
| 214 | +define('_MD_CHESS_MOVE_NOT_YOUR_PIECE', 'ERROR: Figure does not belong to you!'); |
|
| 215 | +define('_MD_CHESS_MOVE_NOEXIST_FIGURE', 'ERROR: Figure does not exist!'); |
|
| 216 | +define('_MD_CHESS_MOVE_START_END_SAME', 'ERROR: Current position and destination are equal!'); |
|
| 217 | +define('_MD_CHESS_MOVE_UNKNOWN_ACTION', 'ERROR: {$param[1]} is unknown! Please use "-" for a move and "x" for an attack.'); |
|
| 218 | +define('_MD_CHESS_MOVE_OUT_OF_RANGE', 'ERROR: Tile {$param[1]} is out of range for {$param[2]} at {$param[3]}!'); |
|
| 219 | +define('_MD_CHESS_MOVE_OCCUPIED', 'ERROR: Tile {$param[1]} is occupied. You cannot move there.'); |
|
| 220 | +define('_MD_CHESS_MOVE_NO_EN_PASSANT', 'ERROR: en-passant not possible!'); |
|
| 221 | +define('_MD_CHESS_MOVE_ATTACK_EMPTY', 'ERROR: Tile {$param[1]} is empty. You cannot attack it."'); |
|
| 222 | +define('_MD_CHESS_MOVE_ATTACK_SELF', 'ERROR: You cannot attack own unit at {$param[1]}.'); |
|
| 223 | +define('_MD_CHESS_MOVE_IN_CHECK', 'ERROR: Move is invalid because king would be under attack then.'); |
|
| 224 | +define('_MD_CHESS_MOVE_CASTLED_SHORT', 'You castled short.'); |
|
| 225 | +define('_MD_CHESS_MOVE_CASTLED_LONG', 'You castled long.'); |
|
| 226 | +define('_MD_CHESS_MOVE_MOVED', '{$param[1]} moved from {$param[2]} to {$param[3]}'); |
|
| 227 | +define('_MD_CHESS_MOVE_CAPTURED', '{$param[1]} captured {$param[2]} from {$param[3]}'); |
|
| 228 | +define('_MD_CHESS_MOVE_PROMOTED', 'and became a {$param[1]}!'); |
|
| 229 | +define('_MD_CHESS_MOVE_CHECKMATE', 'checkmate!'); |
|
| 230 | +define('_MD_CHESS_MOVE_STALEMATE', 'stalemate!'); |
|
| 231 | +define('_MD_CHESS_MOVE_MATERIAL', 'insufficient mating material!'); |
|
| 232 | +define('_MD_CHESS_MOVE_KING', 'king'); |
|
| 233 | +define('_MD_CHESS_MOVE_QUEEN', 'queen'); |
|
| 234 | +define('_MD_CHESS_MOVE_ROOK', 'rook'); |
|
| 235 | +define('_MD_CHESS_MOVE_BISHOP', 'bishop'); |
|
| 236 | +define('_MD_CHESS_MOVE_KNIGHT', 'knight'); |
|
| 237 | +define('_MD_CHESS_MOVE_PAWN', 'pawn'); |
|
| 238 | +define('_MD_CHESS_MOVE_EMPTY', 'empty'); |
|
| 239 | 239 | |
| 240 | 240 | // miscellaneous |
| 241 | -define('_MD_CHESS_GAME_CONFIRM', 'Confirm your game preferences'); |
|
| 242 | -define('_MD_CHESS_GAME_CREATED', 'Game created'); |
|
| 243 | -define('_MD_CHESS_GAME_STARTED', 'Game started'); |
|
| 244 | -define('_MD_CHESS_LABEL_DATE_CREATED', 'Date created'); |
|
| 241 | +define('_MD_CHESS_GAME_CONFIRM', 'Confirm your game preferences'); |
|
| 242 | +define('_MD_CHESS_GAME_CREATED', 'Game created'); |
|
| 243 | +define('_MD_CHESS_GAME_STARTED', 'Game started'); |
|
| 244 | +define('_MD_CHESS_LABEL_DATE_CREATED', 'Date created'); |
|
| 245 | 245 | define('_MD_CHESS_LABEL_GAME_SUSPENDED', 'Game suspended'); |
| 246 | -define('_MD_CHESS_WHITE_OFFERED_DRAW', 'White has offered a draw. Black must either accept or reject the offer.'); |
|
| 247 | -define('_MD_CHESS_BLACK_OFFERED_DRAW', 'Black has offered a draw. White must either accept or reject the offer.'); |
|
| 246 | +define('_MD_CHESS_WHITE_OFFERED_DRAW', 'White has offered a draw. Black must either accept or reject the offer.'); |
|
| 247 | +define('_MD_CHESS_BLACK_OFFERED_DRAW', 'Black has offered a draw. White must either accept or reject the offer.'); |
|
| 248 | 248 | |
| 249 | 249 | // PGN movetext comments for drawn games - must not contain comment delimiters '{' or '}' |
| 250 | -define('_MD_CHESS_DRAW_STALEMATE', 'Drawn by stalemate.'); |
|
| 251 | -define('_MD_CHESS_DRAW_NO_MATE', 'Drawn since no checkmate is possible.'); |
|
| 250 | +define('_MD_CHESS_DRAW_STALEMATE', 'Drawn by stalemate.'); |
|
| 251 | +define('_MD_CHESS_DRAW_NO_MATE', 'Drawn since no checkmate is possible.'); |
|
| 252 | 252 | define('_MD_CHESS_DRAW_BY_AGREEMENT', 'Drawn by mutual agreement.'); |
| 253 | -define('_MD_CHESS_DRAW_DECLARED', 'Draw declared by arbiter, reason: %s.'); |
|
| 254 | -define('_MD_CHESS_DRAW_50', 'Drawn by 50-move rule.'); |
|
| 255 | -define('_MD_CHESS_DRAW_3', 'Drawn by threefold-repetition rule, based on board position immediately prior to moves %s.'); |
|
| 253 | +define('_MD_CHESS_DRAW_DECLARED', 'Draw declared by arbiter, reason: %s.'); |
|
| 254 | +define('_MD_CHESS_DRAW_50', 'Drawn by 50-move rule.'); |
|
| 255 | +define('_MD_CHESS_DRAW_3', 'Drawn by threefold-repetition rule, based on board position immediately prior to moves %s.'); |
|
| 256 | 256 | |
| 257 | -define('_MD_CHESS_NO_DRAW_50', 'The conditions for claiming a draw under the 50-move rule have not been satisfied.'); |
|
| 258 | -define('_MD_CHESS_NO_DRAW_3', 'The conditions for claiming a draw under the threefold-repetition rule have not been satisfied.'); |
|
| 257 | +define('_MD_CHESS_NO_DRAW_50', 'The conditions for claiming a draw under the 50-move rule have not been satisfied.'); |
|
| 258 | +define('_MD_CHESS_NO_DRAW_3', 'The conditions for claiming a draw under the threefold-repetition rule have not been satisfied.'); |
|
| 259 | 259 | |
| 260 | 260 | // menu options |
| 261 | -define('_MD_CHESS_SHOW_GAMES_INPLAY', 'Show games in play only'); |
|
| 261 | +define('_MD_CHESS_SHOW_GAMES_INPLAY', 'Show games in play only'); |
|
| 262 | 262 | define('_MD_CHESS_SHOW_GAMES_CONCLUDED', 'Show concluded games only'); |
| 263 | -define('_MD_CHESS_SHOW_GAMES_BOTH', 'Show all games'); |
|
| 264 | -define('_MD_CHESS_SHOW_GAMES_RATED', 'Show rated games only'); |
|
| 265 | -define('_MD_CHESS_SHOW_GAMES_UNRATED', 'Show rated and unrated games'); |
|
| 263 | +define('_MD_CHESS_SHOW_GAMES_BOTH', 'Show all games'); |
|
| 264 | +define('_MD_CHESS_SHOW_GAMES_RATED', 'Show rated games only'); |
|
| 265 | +define('_MD_CHESS_SHOW_GAMES_UNRATED', 'Show rated and unrated games'); |
|
| 266 | 266 | define('_MD_CHESS_SHOW_CHALLENGES_OPEN', 'Show open challenges only'); |
| 267 | 267 | define('_MD_CHESS_SHOW_CHALLENGES_USER', 'Show individual challenges only'); |
| 268 | 268 | define('_MD_CHESS_SHOW_CHALLENGES_BOTH', 'Show all challenges'); |
| 269 | 269 | |
| 270 | 270 | // ratings |
| 271 | -define('_MD_CHESS_RATED_GAME', 'Rated game'); |
|
| 272 | -define('_MD_CHESS_RATINGS_OFF', 'Rating feature not enabled.'); |
|
| 273 | -define('_MD_CHESS_PLAYER_RATINGS', 'Chess Player Ratings'); |
|
| 274 | -define('_MD_CHESS_RATING', 'Rating'); |
|
| 275 | -define('_MD_CHESS_PLAYER', 'Player'); |
|
| 276 | -define('_MD_CHESS_GAMES_PLAYED', 'Rated games played'); |
|
| 277 | -define('_MD_CHESS_PROVISIONAL', 'Provisional rating (less than %s rated games played)'); |
|
| 278 | -define('_MD_CHESS_NA', 'n/a'); // not applicable or not available |
|
| 279 | -define('_MD_CHESS_NO_RATING_INFO', 'No rating information found.'); |
|
| 280 | -define('_MD_CHESS_RECALC_RATINGS', 'Recalculate all player ratings (available only to module administrators)'); |
|
| 281 | -define('_MD_CHESS_SUBMIT_BUTTON', 'Submit'); |
|
| 282 | -define('_MD_CHESS_RECALC_CONFIRM', 'Yes, I am sure I want to do this.'); |
|
| 283 | -define('_MD_CHESS_RECALC_DONE', 'Ratings recalculated.'); |
|
| 284 | -define('_MD_CHESS_RECALC_NOT_DONE', 'Ratings not recalculated because confirmation box was not checked.'); |
|
| 285 | -define('_MD_CHESS_LAST_ACTIVITY', 'Last activity'); |
|
| 286 | -define('_MD_CHESS_STATUS', 'Status'); |
|
| 287 | -define('_MD_CHESS_DRAWN', 'drawn'); |
|
| 288 | -define('_MD_CHESS_WON', 'won'); |
|
| 289 | -define('_MD_CHESS_LOST', 'lost'); |
|
| 290 | -define('_MD_CHESS_RANKED', 'Ranked'); |
|
| 291 | -define('_MD_CHESS_RATED_GAMES_PLAYED', 'Rated games played'); |
|
| 292 | -define('_MD_CHESS_CHALLENGES_FOR', 'Chess challenges for: %s'); |
|
| 293 | -define('_MD_CHESS_GAMES_FOR', 'Chess games for: %s'); |
|
| 294 | -define('_MD_CHESS_STATS_FOR', 'Chess stats for: %s'); |
|
| 295 | -define('_MD_CHESS_SELECT_PLAYER', 'Select player and display option'); |
|
| 296 | -define('_MD_CHESS_USERNAME', 'Username'); |
|
| 297 | -define('_MD_CHESS_SHOW_ALL_GAMES', 'Show all games'); |
|
| 271 | +define('_MD_CHESS_RATED_GAME', 'Rated game'); |
|
| 272 | +define('_MD_CHESS_RATINGS_OFF', 'Rating feature not enabled.'); |
|
| 273 | +define('_MD_CHESS_PLAYER_RATINGS', 'Chess Player Ratings'); |
|
| 274 | +define('_MD_CHESS_RATING', 'Rating'); |
|
| 275 | +define('_MD_CHESS_PLAYER', 'Player'); |
|
| 276 | +define('_MD_CHESS_GAMES_PLAYED', 'Rated games played'); |
|
| 277 | +define('_MD_CHESS_PROVISIONAL', 'Provisional rating (less than %s rated games played)'); |
|
| 278 | +define('_MD_CHESS_NA', 'n/a'); // not applicable or not available |
|
| 279 | +define('_MD_CHESS_NO_RATING_INFO', 'No rating information found.'); |
|
| 280 | +define('_MD_CHESS_RECALC_RATINGS', 'Recalculate all player ratings (available only to module administrators)'); |
|
| 281 | +define('_MD_CHESS_SUBMIT_BUTTON', 'Submit'); |
|
| 282 | +define('_MD_CHESS_RECALC_CONFIRM', 'Yes, I am sure I want to do this.'); |
|
| 283 | +define('_MD_CHESS_RECALC_DONE', 'Ratings recalculated.'); |
|
| 284 | +define('_MD_CHESS_RECALC_NOT_DONE', 'Ratings not recalculated because confirmation box was not checked.'); |
|
| 285 | +define('_MD_CHESS_LAST_ACTIVITY', 'Last activity'); |
|
| 286 | +define('_MD_CHESS_STATUS', 'Status'); |
|
| 287 | +define('_MD_CHESS_DRAWN', 'drawn'); |
|
| 288 | +define('_MD_CHESS_WON', 'won'); |
|
| 289 | +define('_MD_CHESS_LOST', 'lost'); |
|
| 290 | +define('_MD_CHESS_RANKED', 'Ranked'); |
|
| 291 | +define('_MD_CHESS_RATED_GAMES_PLAYED', 'Rated games played'); |
|
| 292 | +define('_MD_CHESS_CHALLENGES_FOR', 'Chess challenges for: %s'); |
|
| 293 | +define('_MD_CHESS_GAMES_FOR', 'Chess games for: %s'); |
|
| 294 | +define('_MD_CHESS_STATS_FOR', 'Chess stats for: %s'); |
|
| 295 | +define('_MD_CHESS_SELECT_PLAYER', 'Select player and display option'); |
|
| 296 | +define('_MD_CHESS_USERNAME', 'Username'); |
|
| 297 | +define('_MD_CHESS_SHOW_ALL_GAMES', 'Show all games'); |
|
| 298 | 298 | define('_MD_CHESS_SHOW_EXCEPT_SELFPLAY', 'Show all games except self-play'); |
| 299 | -define('_MD_CHESS_SHOW_RATED_ONLY', 'Show rated games only'); |
|
| 300 | -define('_MD_CHESS_PLAYER_NOT_FOUND', 'No game information found for player.'); |
|
| 301 | -define('_MD_CHESS_VIEW_PROFILE', 'View player\'s profile'); |
|
| 299 | +define('_MD_CHESS_SHOW_RATED_ONLY', 'Show rated games only'); |
|
| 300 | +define('_MD_CHESS_PLAYER_NOT_FOUND', 'No game information found for player.'); |
|
| 301 | +define('_MD_CHESS_VIEW_PROFILE', 'View player\'s profile'); |
|
| 302 | 302 | |
| 303 | 303 | /**#@-*/ |
| 304 | 304 | |
@@ -11,41 +11,41 @@ |
||
| 11 | 11 | * @ignore |
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | -define('_AM_CHESS_CONF', 'Schach'); |
|
| 14 | +define('_AM_CHESS_CONF', 'Schach'); |
|
| 15 | 15 | |
| 16 | -define('_AM_CHESS_PREFS', 'Einstellungen'); |
|
| 16 | +define('_AM_CHESS_PREFS', 'Einstellungen'); |
|
| 17 | 17 | define('_AM_CHESS_PREFS_DESC', 'Einstellungen bearbeiten'); |
| 18 | 18 | |
| 19 | -define('_AM_CHESS_SUSPENDED_GAMES', 'unterbrochene Partien'); |
|
| 19 | +define('_AM_CHESS_SUSPENDED_GAMES', 'unterbrochene Partien'); |
|
| 20 | 20 | define('_AM_CHESS_SUSPENDED_GAMES_DES', 'Zeige unterbrochene Partien'); |
| 21 | 21 | |
| 22 | -define('_AM_CHESS_ACTIVE_GAMES', 'Aktive Partien'); |
|
| 22 | +define('_AM_CHESS_ACTIVE_GAMES', 'Aktive Partien'); |
|
| 23 | 23 | define('_AM_CHESS_ACTIVE_GAMES_DES', 'Zeige aktive Partien'); |
| 24 | 24 | |
| 25 | -define('_AM_CHESS_CHALLENGES', 'Herausforderungen'); |
|
| 25 | +define('_AM_CHESS_CHALLENGES', 'Herausforderungen'); |
|
| 26 | 26 | define('_AM_CHESS_CHALLENGES_DES', 'Zeige Herausforderungen'); |
| 27 | 27 | |
| 28 | -define('_AM_CHESS_GAME', 'Partie'); |
|
| 29 | -define('_AM_CHESS_CHALLENGE', 'Herausforderung'); |
|
| 30 | -define('_AM_CHESS_VS', 'gegen'); |
|
| 31 | -define('_AM_CHESS_CHALLENGED', 'herausgefordert'); |
|
| 32 | -define('_AM_CHESS_CREATED', 'gestartet'); |
|
| 28 | +define('_AM_CHESS_GAME', 'Partie'); |
|
| 29 | +define('_AM_CHESS_CHALLENGE', 'Herausforderung'); |
|
| 30 | +define('_AM_CHESS_VS', 'gegen'); |
|
| 31 | +define('_AM_CHESS_CHALLENGED', 'herausgefordert'); |
|
| 32 | +define('_AM_CHESS_CREATED', 'gestartet'); |
|
| 33 | 33 | |
| 34 | -define('_AM_CHESS_WHEN_SUSPENDED', 'Wenn unterbrochen'); |
|
| 35 | -define('_AM_CHESS_SUSPENDED_BY', 'Unterbrochen von'); |
|
| 36 | -define('_AM_CHESS_SUSPENSION_TYPE', 'Art der Unterbrechung'); |
|
| 34 | +define('_AM_CHESS_WHEN_SUSPENDED', 'Wenn unterbrochen'); |
|
| 35 | +define('_AM_CHESS_SUSPENDED_BY', 'Unterbrochen von'); |
|
| 36 | +define('_AM_CHESS_SUSPENSION_TYPE', 'Art der Unterbrechung'); |
|
| 37 | 37 | define('_AM_CHESS_SUSPENSION_REASON', 'Grund der Unterbrechung'); |
| 38 | 38 | define('_AM_CHESS_SUSP_TYPE_ARBITER', 'Vom Schiedsrichter unterbrochen'); |
| 39 | -define('_AM_CHESS_SUSP_TYPE_PLAYER', 'Schiedsurteil angefordert'); |
|
| 39 | +define('_AM_CHESS_SUSP_TYPE_PLAYER', 'Schiedsurteil angefordert'); |
|
| 40 | 40 | |
| 41 | -define('_AM_CHESS_ARBITRATE_SUBMIT', 'Schiedsspruch fällen'); |
|
| 41 | +define('_AM_CHESS_ARBITRATE_SUBMIT', 'Schiedsspruch fällen'); |
|
| 42 | 42 | |
| 43 | 43 | define('_AM_CHESS_NO_SUSPENDED_GAMES', 'Keine unterbrochenen Partien'); |
| 44 | -define('_AM_CHESS_NO_ACTIVE_GAMES', 'Keine aktiven Partien'); |
|
| 45 | -define('_AM_CHESS_NO_CHALLENGES', 'Keine Herausforderungen'); |
|
| 44 | +define('_AM_CHESS_NO_ACTIVE_GAMES', 'Keine aktiven Partien'); |
|
| 45 | +define('_AM_CHESS_NO_CHALLENGES', 'Keine Herausforderungen'); |
|
| 46 | 46 | |
| 47 | -define('_AM_CHESS_UNKNOWN_USER', '*unbekannt*'); |
|
| 48 | -define('_AM_CHESS_ERROR', '*error*'); |
|
| 47 | +define('_AM_CHESS_UNKNOWN_USER', '*unbekannt*'); |
|
| 48 | +define('_AM_CHESS_ERROR', '*error*'); |
|
| 49 | 49 | |
| 50 | 50 | /**#@-*/ |
| 51 | 51 | |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | |
| 72 | 72 | define('_HE_CHESS_RATINGS_TITLE', 'Bewertungssystem'); |
| 73 | 73 | |
| 74 | -define('_HE_CHESS_RATINGS_CXR', ' |
|
| 74 | +define('_HE_CHESS_RATINGS_CXR', ' |
|
| 75 | 75 | CXR - Eine Adaption des ELO Bewertungssystems, verwendet mit Genehmigung von <A target="_blank" href="http://chess-express.com/">Chess Express Ratings, Inc.</A> |
| 76 | 76 | '); |
| 77 | 77 | |
| 78 | -define('_HE_CHESS_RATINGS_LINEAR', ' |
|
| 78 | +define('_HE_CHESS_RATINGS_LINEAR', ' |
|
| 79 | 79 | Linear - Ein sehr einfaches System, das für einen Sieg (Niederlage) eine feste Anzahl an Punkten addiert (subtrahiert). |
| 80 | 80 | '); |
| 81 | 81 | |
@@ -248,22 +248,22 @@ discard block |
||
| 248 | 248 | define('_HE_CHESS_NOTATION_020', ' |
| 249 | 249 | Die Zugsequenz eines Zuges setzt sich aus vier Teilen zusammen (und einem fünften bei Verwandlung eines Bauern): |
| 250 | 250 | '); |
| 251 | -define('_HE_CHESS_NOTATION_020_1', 'Figur'); |
|
| 252 | -define('_HE_CHESS_NOTATION_020_1_A', 'K (König)'); |
|
| 253 | -define('_HE_CHESS_NOTATION_020_1_B', 'Q (Dame)'); |
|
| 254 | -define('_HE_CHESS_NOTATION_020_1_C', 'R (Turm)'); |
|
| 255 | -define('_HE_CHESS_NOTATION_020_1_D', 'B (Läufer)'); |
|
| 256 | -define('_HE_CHESS_NOTATION_020_1_E', 'N (Springer)'); |
|
| 257 | -define('_HE_CHESS_NOTATION_020_1_F', 'P (Bauer)'); |
|
| 258 | -define('_HE_CHESS_NOTATION_020_2', 'Ausgangsfeld'); |
|
| 259 | -define('_HE_CHESS_NOTATION_020_2_A', 'Beispiele: e4, f2, h8'); |
|
| 260 | -define('_HE_CHESS_NOTATION_020_3', 'Aktion'); |
|
| 261 | -define('_HE_CHESS_NOTATION_020_3_A', '- (ziehen)'); |
|
| 262 | -define('_HE_CHESS_NOTATION_020_3_B', 'x (schlagen)'); |
|
| 263 | -define('_HE_CHESS_NOTATION_020_4', 'Zielfeld'); |
|
| 264 | -define('_HE_CHESS_NOTATION_020_4_A', 'Beispiele: a8, c6, g5'); |
|
| 265 | -define('_HE_CHESS_NOTATION_020_5', 'Bauernverwandlung in (sofern erlaubt)'); |
|
| 266 | -define('_HE_CHESS_NOTATION_020_5_A', 'mögliche Werte: =Q, =R, =B, =N'); |
|
| 251 | +define('_HE_CHESS_NOTATION_020_1', 'Figur'); |
|
| 252 | +define('_HE_CHESS_NOTATION_020_1_A', 'K (König)'); |
|
| 253 | +define('_HE_CHESS_NOTATION_020_1_B', 'Q (Dame)'); |
|
| 254 | +define('_HE_CHESS_NOTATION_020_1_C', 'R (Turm)'); |
|
| 255 | +define('_HE_CHESS_NOTATION_020_1_D', 'B (Läufer)'); |
|
| 256 | +define('_HE_CHESS_NOTATION_020_1_E', 'N (Springer)'); |
|
| 257 | +define('_HE_CHESS_NOTATION_020_1_F', 'P (Bauer)'); |
|
| 258 | +define('_HE_CHESS_NOTATION_020_2', 'Ausgangsfeld'); |
|
| 259 | +define('_HE_CHESS_NOTATION_020_2_A', 'Beispiele: e4, f2, h8'); |
|
| 260 | +define('_HE_CHESS_NOTATION_020_3', 'Aktion'); |
|
| 261 | +define('_HE_CHESS_NOTATION_020_3_A', '- (ziehen)'); |
|
| 262 | +define('_HE_CHESS_NOTATION_020_3_B', 'x (schlagen)'); |
|
| 263 | +define('_HE_CHESS_NOTATION_020_4', 'Zielfeld'); |
|
| 264 | +define('_HE_CHESS_NOTATION_020_4_A', 'Beispiele: a8, c6, g5'); |
|
| 265 | +define('_HE_CHESS_NOTATION_020_5', 'Bauernverwandlung in (sofern erlaubt)'); |
|
| 266 | +define('_HE_CHESS_NOTATION_020_5_A', 'mögliche Werte: =Q, =R, =B, =N'); |
|
| 267 | 267 | |
| 268 | 268 | define('_HE_CHESS_NOTATION_030', ' |
| 269 | 269 | Beispiele für Züge: |
@@ -14,8 +14,8 @@ discard block |
||
| 14 | 14 | // Warning: Some of the these constant values contain the sprintf format code "%s". That format code must not be removed. |
| 15 | 15 | |
| 16 | 16 | // Main |
| 17 | -define('_MI_CHESS', 'Schach'); |
|
| 18 | -define('_MI_CHESS_DES', 'Ermöglicht den Benutzern, gegeneinander Schach zu spielen.'); |
|
| 17 | +define('_MI_CHESS', 'Schach'); |
|
| 18 | +define('_MI_CHESS_DES', 'Ermöglicht den Benutzern, gegeneinander Schach zu spielen.'); |
|
| 19 | 19 | define('_MI_CHESS_CREDITS', ' |
| 20 | 20 | Meiko Jensen (german language pack). |
| 21 | 21 | <BR /> |
@@ -23,24 +23,24 @@ discard block |
||
| 23 | 23 | '); |
| 24 | 24 | |
| 25 | 25 | // Blocks |
| 26 | -define('_MI_CHESS_GAMES', 'Letzte Schachpartien'); |
|
| 27 | -define('_MI_CHESS_GAMES_DES', 'Liste der letzten Schachpartien'); |
|
| 28 | -define('_MI_CHESS_CHALLENGES', 'Letzte Schach-Herausforderungen'); |
|
| 26 | +define('_MI_CHESS_GAMES', 'Letzte Schachpartien'); |
|
| 27 | +define('_MI_CHESS_GAMES_DES', 'Liste der letzten Schachpartien'); |
|
| 28 | +define('_MI_CHESS_CHALLENGES', 'Letzte Schach-Herausforderungen'); |
|
| 29 | 29 | define('_MI_CHESS_CHALLENGES_DES', 'Liste der letzten Schach-Herausforderungen'); |
| 30 | -define('_MI_CHESS_PLAYERS', 'Beste Schachspieler'); |
|
| 31 | -define('_MI_CHESS_PLAYERS_DES', 'Liste der besten Schachspieler'); |
|
| 30 | +define('_MI_CHESS_PLAYERS', 'Beste Schachspieler'); |
|
| 31 | +define('_MI_CHESS_PLAYERS_DES', 'Liste der besten Schachspieler'); |
|
| 32 | 32 | |
| 33 | 33 | // Templates |
| 34 | -define('_MI_CHESS_INDEX', 'Schach Übersicht'); |
|
| 35 | -define('_MI_CHESS_GAME', 'Schachpartie'); |
|
| 36 | -define('_MI_CHESS_MOVE_FORM', 'Schachzug-Seite'); |
|
| 34 | +define('_MI_CHESS_INDEX', 'Schach Übersicht'); |
|
| 35 | +define('_MI_CHESS_GAME', 'Schachpartie'); |
|
| 36 | +define('_MI_CHESS_MOVE_FORM', 'Schachzug-Seite'); |
|
| 37 | 37 | define('_MI_CHESS_PROMOTE_POPUP', 'Schach-Bauernverwandlungsfenster'); |
| 38 | -define('_MI_CHESS_BOARD', 'Schachbrett'); |
|
| 39 | -define('_MI_CHESS_PREFS_FORM', 'Einstellungen für Schach'); |
|
| 40 | -define('_MI_CHESS_ARBITER_FORM', 'Schach-Schiedsrichter'); |
|
| 41 | -define('_MI_CHESS_HELP', 'Schach-Hilfe'); |
|
| 42 | -define('_MI_CHESS_RATINGS', 'Schachspieler-Bewertungen (alle Spieler)'); |
|
| 43 | -define('_MI_CHESS_PLAYER_STATS', 'Schachspieler-Statistik'); |
|
| 38 | +define('_MI_CHESS_BOARD', 'Schachbrett'); |
|
| 39 | +define('_MI_CHESS_PREFS_FORM', 'Einstellungen für Schach'); |
|
| 40 | +define('_MI_CHESS_ARBITER_FORM', 'Schach-Schiedsrichter'); |
|
| 41 | +define('_MI_CHESS_HELP', 'Schach-Hilfe'); |
|
| 42 | +define('_MI_CHESS_RATINGS', 'Schachspieler-Bewertungen (alle Spieler)'); |
|
| 43 | +define('_MI_CHESS_PLAYER_STATS', 'Schachspieler-Statistik'); |
|
| 44 | 44 | |
| 45 | 45 | // Menu |
| 46 | 46 | define('_MI_CHESS_SMNAME1', 'Hilfe'); |
@@ -50,42 +50,42 @@ discard block |
||
| 50 | 50 | define('_MI_CHESS_SMNAME5', 'Meine Partien'); |
| 51 | 51 | |
| 52 | 52 | // Rating systems (used in config) |
| 53 | -define('_MI_CHESS_RATING_SYSTEM_NONE', 'kein'); |
|
| 54 | -define('_MI_CHESS_RATING_SYSTEM_CXR', 'CXR'); |
|
| 55 | -define('_MI_CHESS_RATING_SYSTEM_LINEAR', 'Linear'); |
|
| 53 | +define('_MI_CHESS_RATING_SYSTEM_NONE', 'kein'); |
|
| 54 | +define('_MI_CHESS_RATING_SYSTEM_CXR', 'CXR'); |
|
| 55 | +define('_MI_CHESS_RATING_SYSTEM_LINEAR', 'Linear'); |
|
| 56 | 56 | |
| 57 | 57 | // Config |
| 58 | -define('_MI_CHESS_GROUPS_PLAY', 'Schachspiel-Recht'); |
|
| 59 | -define('_MI_CHESS_GROUPS_PLAY_DES', 'Ein Benutzer in jeder der ausgewählten Gruppen darf andere Spieler herausfordern, Herausforderungen annehmen und gegen sich selbst spielen.'); |
|
| 60 | -define('_MI_CHESS_GROUPS_DELETE', 'Partie-löschen-Recht'); |
|
| 61 | -define('_MI_CHESS_GROUPS_DELETE_DES', 'Ein Benutzer in jeder der ausgewählten Gruppen darf eine Partie löschen, die er selbst spielt. Unabhängig davon, ob er dieses Recht hat, darf er Partien gegen sich selbst jederzeit löschen.'); |
|
| 62 | -define('_MI_CHESS_ALLOW_SETUP', 'Anfangsstellung ändern?'); |
|
| 63 | -define('_MI_CHESS_ALLOW_SETUP_DES', 'Darf ein Spieler die anfängliche Stellung der Figuren auf dem Schachbrett über die Forsyth-Edwards Notation (FEN) ändern?'); |
|
| 64 | -define('_MI_CHESS_MAX_ITEMS', 'Maximale Anzahl an Einträgen pro Seite'); |
|
| 65 | -define('_MI_CHESS_MAX_ITEMS_DES', 'Bezogen auf Partien, Herausforderungen und Spieler.'); |
|
| 66 | -define('_MI_CHESS_RATING_SYSTEM', 'Spielerbewertungssystem'); |
|
| 67 | -define('_MI_CHESS_RATING_SYSTEM_DES', ' |
|
| 58 | +define('_MI_CHESS_GROUPS_PLAY', 'Schachspiel-Recht'); |
|
| 59 | +define('_MI_CHESS_GROUPS_PLAY_DES', 'Ein Benutzer in jeder der ausgewählten Gruppen darf andere Spieler herausfordern, Herausforderungen annehmen und gegen sich selbst spielen.'); |
|
| 60 | +define('_MI_CHESS_GROUPS_DELETE', 'Partie-löschen-Recht'); |
|
| 61 | +define('_MI_CHESS_GROUPS_DELETE_DES', 'Ein Benutzer in jeder der ausgewählten Gruppen darf eine Partie löschen, die er selbst spielt. Unabhängig davon, ob er dieses Recht hat, darf er Partien gegen sich selbst jederzeit löschen.'); |
|
| 62 | +define('_MI_CHESS_ALLOW_SETUP', 'Anfangsstellung ändern?'); |
|
| 63 | +define('_MI_CHESS_ALLOW_SETUP_DES', 'Darf ein Spieler die anfängliche Stellung der Figuren auf dem Schachbrett über die Forsyth-Edwards Notation (FEN) ändern?'); |
|
| 64 | +define('_MI_CHESS_MAX_ITEMS', 'Maximale Anzahl an Einträgen pro Seite'); |
|
| 65 | +define('_MI_CHESS_MAX_ITEMS_DES', 'Bezogen auf Partien, Herausforderungen und Spieler.'); |
|
| 66 | +define('_MI_CHESS_RATING_SYSTEM', 'Spielerbewertungssystem'); |
|
| 67 | +define('_MI_CHESS_RATING_SYSTEM_DES', ' |
|
| 68 | 68 | Verfügbare Bewertungssysteme: |
| 69 | 69 | <BR /><BR /> |
| 70 | - ' ._MI_CHESS_RATING_SYSTEM_CXR. ' - Adaptation des ELO Bewertungssystem, Verwendung erlaubt durch <A target="_blank" href="http://chess-express.com/">Chess Express Ratings, Inc.</A> |
|
| 70 | + ' ._MI_CHESS_RATING_SYSTEM_CXR.' - Adaptation des ELO Bewertungssystem, Verwendung erlaubt durch <A target="_blank" href="http://chess-express.com/">Chess Express Ratings, Inc.</A> |
|
| 71 | 71 | <BR /><BR /> |
| 72 | - ' ._MI_CHESS_RATING_SYSTEM_LINEAR. ' - Ein sehr einfaches System, das für jeden Sieg (Niederlage) eine feste Anzahl an Punkten addiert (abzieht). |
|
| 72 | + ' ._MI_CHESS_RATING_SYSTEM_LINEAR.' - Ein sehr einfaches System, das für jeden Sieg (Niederlage) eine feste Anzahl an Punkten addiert (abzieht). |
|
| 73 | 73 | <BR /><BR /> |
| 74 | - Die Auswahl "' ._MI_CHESS_RATING_SYSTEM_NONE. '" schaltet das Bewertungssystem ab. |
|
| 74 | + Die Auswahl "' ._MI_CHESS_RATING_SYSTEM_NONE.'" schaltet das Bewertungssystem ab. |
|
| 75 | 75 | <BR /><BR /> |
| 76 | 76 | Nach Änderung dieser Auswahl sollten die Spielerbewertungen aktualisiert werden (unter Hauptmenü >> Schach >> |
| 77 | - ' ._MI_CHESS_SMNAME4. '). |
|
| 77 | + ' ._MI_CHESS_SMNAME4.'). |
|
| 78 | 78 | '); |
| 79 | -define('_MI_CHESS_INITIAL_RATING', 'Anfängliche Spielerbewertung'); |
|
| 79 | +define('_MI_CHESS_INITIAL_RATING', 'Anfängliche Spielerbewertung'); |
|
| 80 | 80 | define('_MI_CHESS_INITIAL_RATING_DES', ' |
| 81 | - Falls das "' ._MI_CHESS_RATING_SYSTEM_CXR. '" Bewertungssystem gewählt wird, sollte dieser Wert zwischen 800 und 2000 liegen. |
|
| 81 | + Falls das "' ._MI_CHESS_RATING_SYSTEM_CXR.'" Bewertungssystem gewählt wird, sollte dieser Wert zwischen 800 und 2000 liegen. |
|
| 82 | 82 | <BR /><BR /> |
| 83 | 83 | Nur wirksam, falls ein Bewertungssystem ausgewählt wurde. |
| 84 | 84 | <BR /><BR /> |
| 85 | - Nach Änderung dieser Auswahl sollten die Spielerbewertungen aktualisiert werden (unter Hauptmenü >> Schach >> ' ._MI_CHESS_SMNAME4. '). |
|
| 85 | + Nach Änderung dieser Auswahl sollten die Spielerbewertungen aktualisiert werden (unter Hauptmenü >> Schach >> ' ._MI_CHESS_SMNAME4.'). |
|
| 86 | 86 | '); |
| 87 | -define('_MI_CHESS_ALLOW_UNRATED', 'Unbewertete Partien erlauben?'); |
|
| 88 | -define('_MI_CHESS_ALLOW_UNRATED_DES', ' |
|
| 87 | +define('_MI_CHESS_ALLOW_UNRATED', 'Unbewertete Partien erlauben?'); |
|
| 88 | +define('_MI_CHESS_ALLOW_UNRATED_DES', ' |
|
| 89 | 89 | Darf ein Benutzer bei einer Herausforderung auswählen, daß diese Partie nicht in die Bewertung eingeht? |
| 90 | 90 | <BR /><BR /> |
| 91 | 91 | Nur wirksam, falls ein Bewertungssystem ausgewählt wurde. |
@@ -93,36 +93,36 @@ discard block |
||
| 93 | 93 | |
| 94 | 94 | // Notifications |
| 95 | 95 | |
| 96 | -define('_MI_CHESS_NCAT_GAME', 'Partie'); |
|
| 97 | -define('_MI_CHESS_NCAT_GAME_DES', 'Dies ist die Kategorie Partie.'); |
|
| 96 | +define('_MI_CHESS_NCAT_GAME', 'Partie'); |
|
| 97 | +define('_MI_CHESS_NCAT_GAME_DES', 'Dies ist die Kategorie Partie.'); |
|
| 98 | 98 | |
| 99 | -define('_MI_CHESS_NCAT_GLOBAL', 'Global'); |
|
| 100 | -define('_MI_CHESS_NCAT_GLOBAL_DES', 'Dies ist die Kategorie Schach.'); |
|
| 99 | +define('_MI_CHESS_NCAT_GLOBAL', 'Global'); |
|
| 100 | +define('_MI_CHESS_NCAT_GLOBAL_DES', 'Dies ist die Kategorie Schach.'); |
|
| 101 | 101 | |
| 102 | -define('_MI_CHESS_NEVT_MOVE', 'Neuer Zug'); |
|
| 103 | -define('_MI_CHESS_NEVT_MOVE_CAP', 'Benachrichtigen, wenn in dieser Partie ein neuer Zug gemacht wurde.'); |
|
| 104 | -define('_MI_CHESS_NEVT_MOVE_DES', 'Beschreibung des neuen Zuges'); |
|
| 105 | -define('_MI_CHESS_NEVT_MOVE_SUB', '[{X_SITENAME}] {X_MODULE} auto-notify : Neuer Zug'); |
|
| 102 | +define('_MI_CHESS_NEVT_MOVE', 'Neuer Zug'); |
|
| 103 | +define('_MI_CHESS_NEVT_MOVE_CAP', 'Benachrichtigen, wenn in dieser Partie ein neuer Zug gemacht wurde.'); |
|
| 104 | +define('_MI_CHESS_NEVT_MOVE_DES', 'Beschreibung des neuen Zuges'); |
|
| 105 | +define('_MI_CHESS_NEVT_MOVE_SUB', '[{X_SITENAME}] {X_MODULE} auto-notify : Neuer Zug'); |
|
| 106 | 106 | |
| 107 | -define('_MI_CHESS_NEVT_CHAL_USER', 'persönliche Herausforderung'); |
|
| 108 | -define('_MI_CHESS_NEVT_CHAL_USER_CAP', 'Benachrichtigen, wenn ich herausgefordert werde.'); |
|
| 109 | -define('_MI_CHESS_NEVT_CHAL_USER_DES', ''); |
|
| 110 | -define('_MI_CHESS_NEVT_CHAL_USER_SUB', '[{X_SITENAME}] {X_MODULE} auto-notify : persönliche Herausforderung'); |
|
| 107 | +define('_MI_CHESS_NEVT_CHAL_USER', 'persönliche Herausforderung'); |
|
| 108 | +define('_MI_CHESS_NEVT_CHAL_USER_CAP', 'Benachrichtigen, wenn ich herausgefordert werde.'); |
|
| 109 | +define('_MI_CHESS_NEVT_CHAL_USER_DES', ''); |
|
| 110 | +define('_MI_CHESS_NEVT_CHAL_USER_SUB', '[{X_SITENAME}] {X_MODULE} auto-notify : persönliche Herausforderung'); |
|
| 111 | 111 | |
| 112 | -define('_MI_CHESS_NEVT_CHAL_OPEN', 'Offene Herausforderung'); |
|
| 113 | -define('_MI_CHESS_NEVT_CHAL_OPEN_CAP', 'Benachrichtigen, wenn eine neue offene Herausforderung erstellt wird.'); |
|
| 114 | -define('_MI_CHESS_NEVT_CHAL_OPEN_DES', ''); |
|
| 115 | -define('_MI_CHESS_NEVT_CHAL_OPEN_SUB', '[{X_SITENAME}] {X_MODULE} auto-notify : Offene Herausforderung'); |
|
| 112 | +define('_MI_CHESS_NEVT_CHAL_OPEN', 'Offene Herausforderung'); |
|
| 113 | +define('_MI_CHESS_NEVT_CHAL_OPEN_CAP', 'Benachrichtigen, wenn eine neue offene Herausforderung erstellt wird.'); |
|
| 114 | +define('_MI_CHESS_NEVT_CHAL_OPEN_DES', ''); |
|
| 115 | +define('_MI_CHESS_NEVT_CHAL_OPEN_SUB', '[{X_SITENAME}] {X_MODULE} auto-notify : Offene Herausforderung'); |
|
| 116 | 116 | |
| 117 | -define('_MI_CHESS_NEVT_ACPT_CHAL', 'Herausforderung akzeptiert'); |
|
| 118 | -define('_MI_CHESS_NEVT_ACPT_CHAL_CAP', 'Benachrichtigen, wenn jemand meine Herausforderung annimmt.'); |
|
| 119 | -define('_MI_CHESS_NEVT_ACPT_CHAL_DES', ''); |
|
| 120 | -define('_MI_CHESS_NEVT_ACPT_CHAL_SUB', '[{X_SITENAME}] {X_MODULE} auto-notify : Herausforderung angenommen'); |
|
| 117 | +define('_MI_CHESS_NEVT_ACPT_CHAL', 'Herausforderung akzeptiert'); |
|
| 118 | +define('_MI_CHESS_NEVT_ACPT_CHAL_CAP', 'Benachrichtigen, wenn jemand meine Herausforderung annimmt.'); |
|
| 119 | +define('_MI_CHESS_NEVT_ACPT_CHAL_DES', ''); |
|
| 120 | +define('_MI_CHESS_NEVT_ACPT_CHAL_SUB', '[{X_SITENAME}] {X_MODULE} auto-notify : Herausforderung angenommen'); |
|
| 121 | 121 | |
| 122 | -define('_MI_CHESS_NEVT_RQST_ARBT', 'Schiedsurteil angefordert (admin only)'); |
|
| 123 | -define('_MI_CHESS_NEVT_RQST_ARBT_CAP', 'Benachrichtigen, wenn Schiedsurteil angefordert wird.'); |
|
| 124 | -define('_MI_CHESS_NEVT_RQST_ARBT_DES', ''); |
|
| 125 | -define('_MI_CHESS_NEVT_RQST_ARBT_SUB', '[{X_SITENAME}] {X_MODULE} auto-notify : Schiedsurteil angefordert'); |
|
| 122 | +define('_MI_CHESS_NEVT_RQST_ARBT', 'Schiedsurteil angefordert (admin only)'); |
|
| 123 | +define('_MI_CHESS_NEVT_RQST_ARBT_CAP', 'Benachrichtigen, wenn Schiedsurteil angefordert wird.'); |
|
| 124 | +define('_MI_CHESS_NEVT_RQST_ARBT_DES', ''); |
|
| 125 | +define('_MI_CHESS_NEVT_RQST_ARBT_SUB', '[{X_SITENAME}] {X_MODULE} auto-notify : Schiedsurteil angefordert'); |
|
| 126 | 126 | |
| 127 | 127 | // Admin menu items |
| 128 | 128 | define('_MI_CHESS_ADMENU1', 'Unterbrochene Partien'); |
@@ -130,19 +130,19 @@ discard block |
||
| 130 | 130 | define('_MI_CHESS_ADMENU3', 'Herausforderungen'); |
| 131 | 131 | |
| 132 | 132 | // Install/upgrade |
| 133 | -define('_MI_CHESS_OLD_VERSION', 'Direktes Update von Version "%s" nicht unterstützt! Bitte Datei "%s" lesen.'); |
|
| 134 | -define('_MI_CHESS_RATINGS_TABLE_1', 'Prüfe, ob Tabelle "%s" bereits existiert ...'); |
|
| 135 | -define('_MI_CHESS_RATINGS_TABLE_2', ' ... Existenzprüfung fehlgeschlagen für Tabelle "%s": (%s) %s'); |
|
| 136 | -define('_MI_CHESS_RATINGS_TABLE_3', ' ... Tabelle "%s" existiert bereits, also wurde dieses Update vermutlich bereits ausgeführt.'); |
|
| 137 | -define('_MI_CHESS_OK', ' ... Ok'); |
|
| 138 | -define('_MI_CHESS_CHK_DB_TABLES', 'Prüfe Datenbank-Tabellen ...'); |
|
| 139 | -define('_MI_CHESS_GAMES_TABLE_1', 'Inspiziere Tabelle "%s" vor der Änderung ...'); |
|
| 140 | -define('_MI_CHESS_GAMES_TABLE_2', ' ... Inspektion fehlgeschlagen für Tabelle "%s": (%s) %s'); |
|
| 141 | -define('_MI_CHESS_GAMES_TABLE_3', ' ... die Spalte "%s" in der Tabelle "%s" darf nur folgende Werte enthalten: %s.'); |
|
| 142 | -define('_MI_CHESS_GAMES_TABLE_4', ' ... Bitte die Fehler für diese Tabelle korrigieren und das Update erneut asführen.'); |
|
| 143 | -define('_MI_CHESS_UPDATING_DATABASE', 'Aktualisiere Datenbank-Tabellen ...'); |
|
| 133 | +define('_MI_CHESS_OLD_VERSION', 'Direktes Update von Version "%s" nicht unterstützt! Bitte Datei "%s" lesen.'); |
|
| 134 | +define('_MI_CHESS_RATINGS_TABLE_1', 'Prüfe, ob Tabelle "%s" bereits existiert ...'); |
|
| 135 | +define('_MI_CHESS_RATINGS_TABLE_2', ' ... Existenzprüfung fehlgeschlagen für Tabelle "%s": (%s) %s'); |
|
| 136 | +define('_MI_CHESS_RATINGS_TABLE_3', ' ... Tabelle "%s" existiert bereits, also wurde dieses Update vermutlich bereits ausgeführt.'); |
|
| 137 | +define('_MI_CHESS_OK', ' ... Ok'); |
|
| 138 | +define('_MI_CHESS_CHK_DB_TABLES', 'Prüfe Datenbank-Tabellen ...'); |
|
| 139 | +define('_MI_CHESS_GAMES_TABLE_1', 'Inspiziere Tabelle "%s" vor der Änderung ...'); |
|
| 140 | +define('_MI_CHESS_GAMES_TABLE_2', ' ... Inspektion fehlgeschlagen für Tabelle "%s": (%s) %s'); |
|
| 141 | +define('_MI_CHESS_GAMES_TABLE_3', ' ... die Spalte "%s" in der Tabelle "%s" darf nur folgende Werte enthalten: %s.'); |
|
| 142 | +define('_MI_CHESS_GAMES_TABLE_4', ' ... Bitte die Fehler für diese Tabelle korrigieren und das Update erneut asführen.'); |
|
| 143 | +define('_MI_CHESS_UPDATING_DATABASE', 'Aktualisiere Datenbank-Tabellen ...'); |
|
| 144 | 144 | define('_MI_CHESS_INIT_RATINGS_TABLE', 'Initialisiere Bewertungstabellen ...'); |
| 145 | -define('_MI_CHESS_UPDATE_SUCCESSFUL', 'Update erfolgreich abgeschlossen.'); |
|
| 145 | +define('_MI_CHESS_UPDATE_SUCCESSFUL', 'Update erfolgreich abgeschlossen.'); |
|
| 146 | 146 | |
| 147 | 147 | /**#@-*/ |
| 148 | 148 | |
@@ -14,47 +14,47 @@ |
||
| 14 | 14 | // Warning: Some of the these constant values contain the sprintf format code "%s". That format code must not be removed. |
| 15 | 15 | |
| 16 | 16 | // block editor |
| 17 | -define('_MB_CHESS_NUM_GAMES', 'Maximale Anzahl anzuzeigender Partien'); |
|
| 18 | -define('_MB_CHESS_SHOW_GAMES_INPLAY', 'Nur aktive Partien anzeigen'); |
|
| 17 | +define('_MB_CHESS_NUM_GAMES', 'Maximale Anzahl anzuzeigender Partien'); |
|
| 18 | +define('_MB_CHESS_SHOW_GAMES_INPLAY', 'Nur aktive Partien anzeigen'); |
|
| 19 | 19 | define('_MB_CHESS_SHOW_GAMES_CONCLUDED', 'Nur abgeschlossene Partien anzeigen'); |
| 20 | -define('_MB_CHESS_SHOW_GAMES_BOTH', 'Beides anzeigen'); |
|
| 21 | -define('_MB_CHESS_SHOW_GAMES_RATED', 'Nur bewertete Partien anzeigen'); |
|
| 22 | -define('_MB_CHESS_SHOW_GAMES_UNRATED', 'Bewertete und unbewertete Partien anzeigen'); |
|
| 23 | -define('_MB_CHESS_NUM_CHALLENGES', 'Maximale Anzahl anzuzeigender Herausforderungen'); |
|
| 20 | +define('_MB_CHESS_SHOW_GAMES_BOTH', 'Beides anzeigen'); |
|
| 21 | +define('_MB_CHESS_SHOW_GAMES_RATED', 'Nur bewertete Partien anzeigen'); |
|
| 22 | +define('_MB_CHESS_SHOW_GAMES_UNRATED', 'Bewertete und unbewertete Partien anzeigen'); |
|
| 23 | +define('_MB_CHESS_NUM_CHALLENGES', 'Maximale Anzahl anzuzeigender Herausforderungen'); |
|
| 24 | 24 | define('_MB_CHESS_SHOW_CHALLENGES_OPEN', 'Nur offene Herausforderungen anzeigen'); |
| 25 | 25 | define('_MB_CHESS_SHOW_CHALLENGES_USER', 'Nur persönliche Herausforderungen anzeigen'); |
| 26 | 26 | define('_MB_CHESS_SHOW_CHALLENGES_BOTH', 'Beides anzeigen'); |
| 27 | -define('_MB_CHESS_NUM_PLAYERS', 'Maximale anzuzeigende Spielerzahl'); |
|
| 28 | -define('_MB_CHESS_SHOW_NONPROVISIONAL', 'Nur Spieler mit nicht vorläufigen Bewertungen anzeigen'); |
|
| 29 | -define('_MB_CHESS_SHOW_ALL_RATINGS', 'Spieler mit allen Bewertungen anzeigen'); |
|
| 27 | +define('_MB_CHESS_NUM_PLAYERS', 'Maximale anzuzeigende Spielerzahl'); |
|
| 28 | +define('_MB_CHESS_SHOW_NONPROVISIONAL', 'Nur Spieler mit nicht vorläufigen Bewertungen anzeigen'); |
|
| 29 | +define('_MB_CHESS_SHOW_ALL_RATINGS', 'Spieler mit allen Bewertungen anzeigen'); |
|
| 30 | 30 | |
| 31 | 31 | // games |
| 32 | -define('_MB_CHESS_GAME', 'Partie'); |
|
| 33 | -define('_MB_CHESS_DATE', 'Letzte Aktivität'); |
|
| 34 | -define('_MB_CHESS_STATUS', 'Status'); |
|
| 35 | -define('_MB_CHESS_VS', 'gegen'); |
|
| 36 | -define('_MB_CHESS_DRAW', 'Remis'); |
|
| 37 | -define('_MB_CHESS_WHITE_WON', 'Weiß gewinnt'); |
|
| 38 | -define('_MB_CHESS_BLACK_WON', 'Schwarz gewinnt'); |
|
| 32 | +define('_MB_CHESS_GAME', 'Partie'); |
|
| 33 | +define('_MB_CHESS_DATE', 'Letzte Aktivität'); |
|
| 34 | +define('_MB_CHESS_STATUS', 'Status'); |
|
| 35 | +define('_MB_CHESS_VS', 'gegen'); |
|
| 36 | +define('_MB_CHESS_DRAW', 'Remis'); |
|
| 37 | +define('_MB_CHESS_WHITE_WON', 'Weiß gewinnt'); |
|
| 38 | +define('_MB_CHESS_BLACK_WON', 'Schwarz gewinnt'); |
|
| 39 | 39 | define('_MB_CHESS_WHITE_TO_MOVE', 'Weiß ist am Zug'); |
| 40 | 40 | define('_MB_CHESS_BLACK_TO_MOVE', 'Schwarz ist am Zug'); |
| 41 | -define('_MB_CHESS_NO_GAMES', 'Keine Partien'); |
|
| 41 | +define('_MB_CHESS_NO_GAMES', 'Keine Partien'); |
|
| 42 | 42 | |
| 43 | 43 | // challenges |
| 44 | -define('_MB_CHESS_TYPE', 'Typ'); |
|
| 45 | -define('_MB_CHESS_CHALLENGER', 'Herausforderer'); |
|
| 46 | -define('_MB_CHESS_CREATED', 'Gestartet'); |
|
| 44 | +define('_MB_CHESS_TYPE', 'Typ'); |
|
| 45 | +define('_MB_CHESS_CHALLENGER', 'Herausforderer'); |
|
| 46 | +define('_MB_CHESS_CREATED', 'Gestartet'); |
|
| 47 | 47 | define('_MB_CHESS_GAMETYPE_OPEN', 'Offene Herausforderungen'); |
| 48 | 48 | define('_MB_CHESS_GAMETYPE_USER', 'Persönliche Herausforderungen'); |
| 49 | 49 | define('_MB_CHESS_NO_CHALLENGES', 'keine Herausforderungen'); |
| 50 | 50 | |
| 51 | 51 | // players |
| 52 | -define('_MB_CHESS_RATINGS_OFF', 'Bewertungen sind abgeschaltet'); |
|
| 53 | -define('_MB_CHESS_PLAYER', 'Spieler'); |
|
| 54 | -define('_MB_CHESS_RATING', 'Bewertung'); |
|
| 55 | -define('_MB_CHESS_GAMES_PLAYED', 'Bewertete beendete Partien'); |
|
| 56 | -define('_MB_CHESS_PROVISIONAL', 'Vorläufige Bewertung (weniger als %s bewertete Partien gespielt)'); |
|
| 57 | -define('_MB_CHESS_NO_RATED_GAMES', 'Es wurden keine bewerteten Partien beendet.'); |
|
| 52 | +define('_MB_CHESS_RATINGS_OFF', 'Bewertungen sind abgeschaltet'); |
|
| 53 | +define('_MB_CHESS_PLAYER', 'Spieler'); |
|
| 54 | +define('_MB_CHESS_RATING', 'Bewertung'); |
|
| 55 | +define('_MB_CHESS_GAMES_PLAYED', 'Bewertete beendete Partien'); |
|
| 56 | +define('_MB_CHESS_PROVISIONAL', 'Vorläufige Bewertung (weniger als %s bewertete Partien gespielt)'); |
|
| 57 | +define('_MB_CHESS_NO_RATED_GAMES', 'Es wurden keine bewerteten Partien beendet.'); |
|
| 58 | 58 | define('_MB_CHESS_NO_NONPROV_GAMES', 'Es wurden keine bewerteten Partien beendet (Spieler mit vorläufigen Bewertungen sind nicht aufgeführt).'); |
| 59 | 59 | |
| 60 | 60 | // miscellaneous |
@@ -18,287 +18,287 @@ |
||
| 18 | 18 | define('_MD_CHESS_DELETE_FORM', 'Herausforderung löschen'); |
| 19 | 19 | |
| 20 | 20 | // game type |
| 21 | -define('_MD_CHESS_LABEL_GAMETYPE', 'Art der Partie'); |
|
| 21 | +define('_MD_CHESS_LABEL_GAMETYPE', 'Art der Partie'); |
|
| 22 | 22 | define('_MD_CHESS_LABEL_GAMETYPE_OPEN', 'Offene Herausforderung'); |
| 23 | 23 | define('_MD_CHESS_LABEL_GAMETYPE_USER', 'Persönliche Herausforderung'); |
| 24 | 24 | define('_MD_CHESS_LABEL_GAMETYPE_SELF', 'Spiel gegen sich selbst'); |
| 25 | -define('_MD_CHESS_MENU_GAMETYPE_OPEN', _MD_CHESS_LABEL_GAMETYPE_OPEN . ' - Jeder kann die Herausforderung annehmen'); |
|
| 26 | -define('_MD_CHESS_MENU_GAMETYPE_USER', _MD_CHESS_LABEL_GAMETYPE_USER . ' - nur der herausgeforderte Benutzer kann die Herausforderung annehmen'); |
|
| 27 | -define('_MD_CHESS_MENU_GAMETYPE_SELF', _MD_CHESS_LABEL_GAMETYPE_SELF . ' - Partie mit sich selbst spielen'); |
|
| 25 | +define('_MD_CHESS_MENU_GAMETYPE_OPEN', _MD_CHESS_LABEL_GAMETYPE_OPEN.' - Jeder kann die Herausforderung annehmen'); |
|
| 26 | +define('_MD_CHESS_MENU_GAMETYPE_USER', _MD_CHESS_LABEL_GAMETYPE_USER.' - nur der herausgeforderte Benutzer kann die Herausforderung annehmen'); |
|
| 27 | +define('_MD_CHESS_MENU_GAMETYPE_SELF', _MD_CHESS_LABEL_GAMETYPE_SELF.' - Partie mit sich selbst spielen'); |
|
| 28 | 28 | |
| 29 | 29 | // opponent |
| 30 | 30 | define('_MD_CHESS_LABEL_OPPONENT', 'Gegner'); |
| 31 | 31 | |
| 32 | 32 | // FEN setup |
| 33 | -define('_MD_CHESS_LABEL_FEN_SETUP', 'Ausgangssituation'); |
|
| 33 | +define('_MD_CHESS_LABEL_FEN_SETUP', 'Ausgangssituation'); |
|
| 34 | 34 | define('_MD_CHESS_LABEL_FEN_EXPLAIN', 'Optional kann eine Ausgangssituation angegeben werden, die in FEN (Forsyth-Edwards Notation) angegeben wird. Ansonsten wird die Standard-Ausgangssituation gewählt.'); |
| 35 | 35 | |
| 36 | 36 | // color preference |
| 37 | -define('_MD_CHESS_LABEL_COLOR', 'Meine Farbe wird'); |
|
| 37 | +define('_MD_CHESS_LABEL_COLOR', 'Meine Farbe wird'); |
|
| 38 | 38 | define('_MD_CHESS_RADIO_COLOR_OPPONENT', 'von meinem Gegner bestimmt'); |
| 39 | -define('_MD_CHESS_RADIO_COLOR_RANDOM', 'zufällig zugewiesen'); |
|
| 40 | -define('_MD_CHESS_RADIO_COLOR_WHITE', 'Weiß'); |
|
| 41 | -define('_MD_CHESS_RADIO_COLOR_BLACK', 'Schwarz'); |
|
| 39 | +define('_MD_CHESS_RADIO_COLOR_RANDOM', 'zufällig zugewiesen'); |
|
| 40 | +define('_MD_CHESS_RADIO_COLOR_WHITE', 'Weiß'); |
|
| 41 | +define('_MD_CHESS_RADIO_COLOR_BLACK', 'Schwarz'); |
|
| 42 | 42 | |
| 43 | 43 | // notifications |
| 44 | 44 | define('_MD_CHESS_NEVT_ACPT_CHAL_CAP', 'Benachrichtigung senden, wenn meine Herausforderung angenommen wird.'); |
| 45 | -define('_MD_CHESS_NEVT_MOVE_CAP', 'Benachrichtigung senden, wenn ein neuer Zug in dieser Partie gemacht wurde.'); |
|
| 45 | +define('_MD_CHESS_NEVT_MOVE_CAP', 'Benachrichtigung senden, wenn ein neuer Zug in dieser Partie gemacht wurde.'); |
|
| 46 | 46 | |
| 47 | 47 | // buttons |
| 48 | -define('_MD_CHESS_CREATE_SUBMIT', 'ziehen!'); |
|
| 49 | -define('_MD_CHESS_CREATE_ACCEPT', 'akzeptieren'); |
|
| 50 | -define('_MD_CHESS_CREATE_CANCEL', 'abbrechen'); |
|
| 51 | -define('_MD_CHESS_CREATE_DELETE', 'löschen'); |
|
| 48 | +define('_MD_CHESS_CREATE_SUBMIT', 'ziehen!'); |
|
| 49 | +define('_MD_CHESS_CREATE_ACCEPT', 'akzeptieren'); |
|
| 50 | +define('_MD_CHESS_CREATE_CANCEL', 'abbrechen'); |
|
| 51 | +define('_MD_CHESS_CREATE_DELETE', 'löschen'); |
|
| 52 | 52 | define('_MD_CHESS_CONFIRM_DELETE', 'Ja, ich bin sicher, daß ich dies löschen will'); |
| 53 | 53 | |
| 54 | 54 | // errors |
| 55 | -define('_MD_CHESS_ERROR', 'Error'); |
|
| 56 | -define('_MD_CHESS_GAMETYPE_INVALID', 'Partie-Typ nicht gültig'); |
|
| 57 | -define('_MD_CHESS_FEN_INVALID', 'Ausgangssituation/FEN nicht gültig'); |
|
| 58 | -define('_MD_CHESS_OPPONENT_MISSING', 'Der Benutzername des Gegners muß angegeben werden.'); |
|
| 59 | -define('_MD_CHESS_OPPONENT_INVALID', 'Der angegebene Benutzer ist unbekannt oder nicht für eine Partie verfügbar.'); |
|
| 60 | -define('_MD_CHESS_OPPONENT_SELF', 'Es ist nicht möglich, sich selbst herauszufordern.'); |
|
| 61 | -define('_MD_CHESS_GAME_NOT_FOUND', 'Partie nicht gefunden.'); |
|
| 62 | -define('_MD_CHESS_GAME_DELETED', 'Partie gelöscht'); |
|
| 63 | -define('_MD_CHESS_WRONG_PLAYER2', 'Es ist nicht möglich, eine Herausforderung zu akzeptieren, die an einen anderen Spieler gerichtet ist.'); |
|
| 64 | -define('_MD_CHESS_SAME_PLAYER2', 'Es ist nicht möglich, eine Herausforderung von sich selbst anzunehmen.'); |
|
| 55 | +define('_MD_CHESS_ERROR', 'Error'); |
|
| 56 | +define('_MD_CHESS_GAMETYPE_INVALID', 'Partie-Typ nicht gültig'); |
|
| 57 | +define('_MD_CHESS_FEN_INVALID', 'Ausgangssituation/FEN nicht gültig'); |
|
| 58 | +define('_MD_CHESS_OPPONENT_MISSING', 'Der Benutzername des Gegners muß angegeben werden.'); |
|
| 59 | +define('_MD_CHESS_OPPONENT_INVALID', 'Der angegebene Benutzer ist unbekannt oder nicht für eine Partie verfügbar.'); |
|
| 60 | +define('_MD_CHESS_OPPONENT_SELF', 'Es ist nicht möglich, sich selbst herauszufordern.'); |
|
| 61 | +define('_MD_CHESS_GAME_NOT_FOUND', 'Partie nicht gefunden.'); |
|
| 62 | +define('_MD_CHESS_GAME_DELETED', 'Partie gelöscht'); |
|
| 63 | +define('_MD_CHESS_WRONG_PLAYER2', 'Es ist nicht möglich, eine Herausforderung zu akzeptieren, die an einen anderen Spieler gerichtet ist.'); |
|
| 64 | +define('_MD_CHESS_SAME_PLAYER2', 'Es ist nicht möglich, eine Herausforderung von sich selbst anzunehmen.'); |
|
| 65 | 65 | define('_MD_CHESS_NO_CONFIRM_DELETE', 'Es ist erforderlich, den Bestätigungskasten zu aktivieren'); |
| 66 | -define('_MD_CHESS_NO_JAVASCRIPT', 'Javascript ist nicht aktiviert. Die Züge müssen durch textuelle Eintragung abgegeben werden.'); |
|
| 67 | -define('_MD_CHESS_MODHEAD_MISSING', 'WARNUNG: <{$xoops_module_header}> fehlt in themes/%s/theme.html.'); |
|
| 68 | -define('_MD_CHESS_TOKEN_ERROR', 'Figur fehlt oder ist ungültig.'); |
|
| 66 | +define('_MD_CHESS_NO_JAVASCRIPT', 'Javascript ist nicht aktiviert. Die Züge müssen durch textuelle Eintragung abgegeben werden.'); |
|
| 67 | +define('_MD_CHESS_MODHEAD_MISSING', 'WARNUNG: <{$xoops_module_header}> fehlt in themes/%s/theme.html.'); |
|
| 68 | +define('_MD_CHESS_TOKEN_ERROR', 'Figur fehlt oder ist ungültig.'); |
|
| 69 | 69 | |
| 70 | 70 | // templates |
| 71 | -define('_MD_CHESS_LABEL_GAMES', 'Partien'); |
|
| 72 | -define('_MD_CHESS_LABEL_NO_GAMES', 'Keine Partien'); |
|
| 73 | -define('_MD_CHESS_LABEL_GAME', 'Partie'); |
|
| 74 | -define('_MD_CHESS_LABEL_CREATED', 'Begonnen'); |
|
| 75 | -define('_MD_CHESS_LABEL_LAST_MOVE', 'Letzter Zug'); |
|
| 76 | -define('_MD_CHESS_LABEL_STATUS', 'Status'); |
|
| 77 | -define('_MD_CHESS_LABEL_VS', 'gegen'); |
|
| 78 | -define('_MD_CHESS_LABEL_DRAW', 'Zug'); |
|
| 79 | -define('_MD_CHESS_LABEL_WHITE_WON', 'Weiß gewinnt'); |
|
| 80 | -define('_MD_CHESS_LABEL_BLACK_WON', 'Schwarz gewinnt'); |
|
| 81 | -define('_MD_CHESS_LABEL_WHITE', 'Weiß'); |
|
| 82 | -define('_MD_CHESS_LABEL_BLACK', 'Schwarz'); |
|
| 83 | -define('_MD_CHESS_LABEL_TO_MOVE', 'ist am Zug'); |
|
| 71 | +define('_MD_CHESS_LABEL_GAMES', 'Partien'); |
|
| 72 | +define('_MD_CHESS_LABEL_NO_GAMES', 'Keine Partien'); |
|
| 73 | +define('_MD_CHESS_LABEL_GAME', 'Partie'); |
|
| 74 | +define('_MD_CHESS_LABEL_CREATED', 'Begonnen'); |
|
| 75 | +define('_MD_CHESS_LABEL_LAST_MOVE', 'Letzter Zug'); |
|
| 76 | +define('_MD_CHESS_LABEL_STATUS', 'Status'); |
|
| 77 | +define('_MD_CHESS_LABEL_VS', 'gegen'); |
|
| 78 | +define('_MD_CHESS_LABEL_DRAW', 'Zug'); |
|
| 79 | +define('_MD_CHESS_LABEL_WHITE_WON', 'Weiß gewinnt'); |
|
| 80 | +define('_MD_CHESS_LABEL_BLACK_WON', 'Schwarz gewinnt'); |
|
| 81 | +define('_MD_CHESS_LABEL_WHITE', 'Weiß'); |
|
| 82 | +define('_MD_CHESS_LABEL_BLACK', 'Schwarz'); |
|
| 83 | +define('_MD_CHESS_LABEL_TO_MOVE', 'ist am Zug'); |
|
| 84 | 84 | define('_MD_CHESS_LABEL_WHITE_TO_MOVE', 'Weiß ist am Zug'); |
| 85 | 85 | define('_MD_CHESS_LABEL_BLACK_TO_MOVE', 'Schwarz ist am Zug'); |
| 86 | -define('_MD_CHESS_LABEL_CHALLENGES', 'Herausforderungen'); |
|
| 86 | +define('_MD_CHESS_LABEL_CHALLENGES', 'Herausforderungen'); |
|
| 87 | 87 | define('_MD_CHESS_LABEL_NO_CHALLENGES', 'Keine Herausforderungen'); |
| 88 | -define('_MD_CHESS_LABEL_TYPE', 'Typ'); |
|
| 89 | -define('_MD_CHESS_LABEL_CHALLENGER', 'Herausforderer'); |
|
| 90 | -define('_MD_CHESS_LABEL_COLOR_OPTION', 'Farbwahl'); |
|
| 91 | -define('_MD_CHESS_LABEL_GAME_OVER', 'Spiel beendet, Punktzahl'); |
|
| 92 | -define('_MD_CHESS_PGN_FULL', 'Portable Game Notation'); |
|
| 93 | -define('_MD_CHESS_PGN_ABBREV', 'PGN'); |
|
| 94 | -define('_MD_CHESS_FEN_FULL', 'Forsyth-Edwards Notation'); |
|
| 95 | -define('_MD_CHESS_FEN_ABBREV', 'FEN'); |
|
| 96 | -define('_MD_CHESS_LABEL_ERROR', '*error*'); |
|
| 97 | -define('_MD_CHESS_PROMOTE_TO', 'Bauer verwandeln in'); |
|
| 98 | - |
|
| 99 | -define('_MD_CHESS_ALT_EMPTY', 'leeres Feld'); |
|
| 100 | -define('_MD_CHESS_ALT_WKING', 'weißer König'); |
|
| 101 | -define('_MD_CHESS_ALT_WQUEEN', 'weiße Dame'); |
|
| 102 | -define('_MD_CHESS_ALT_WROOK', 'weißer Turm'); |
|
| 88 | +define('_MD_CHESS_LABEL_TYPE', 'Typ'); |
|
| 89 | +define('_MD_CHESS_LABEL_CHALLENGER', 'Herausforderer'); |
|
| 90 | +define('_MD_CHESS_LABEL_COLOR_OPTION', 'Farbwahl'); |
|
| 91 | +define('_MD_CHESS_LABEL_GAME_OVER', 'Spiel beendet, Punktzahl'); |
|
| 92 | +define('_MD_CHESS_PGN_FULL', 'Portable Game Notation'); |
|
| 93 | +define('_MD_CHESS_PGN_ABBREV', 'PGN'); |
|
| 94 | +define('_MD_CHESS_FEN_FULL', 'Forsyth-Edwards Notation'); |
|
| 95 | +define('_MD_CHESS_FEN_ABBREV', 'FEN'); |
|
| 96 | +define('_MD_CHESS_LABEL_ERROR', '*error*'); |
|
| 97 | +define('_MD_CHESS_PROMOTE_TO', 'Bauer verwandeln in'); |
|
| 98 | + |
|
| 99 | +define('_MD_CHESS_ALT_EMPTY', 'leeres Feld'); |
|
| 100 | +define('_MD_CHESS_ALT_WKING', 'weißer König'); |
|
| 101 | +define('_MD_CHESS_ALT_WQUEEN', 'weiße Dame'); |
|
| 102 | +define('_MD_CHESS_ALT_WROOK', 'weißer Turm'); |
|
| 103 | 103 | define('_MD_CHESS_ALT_WBISHOP', 'weißer Läufer'); |
| 104 | 104 | define('_MD_CHESS_ALT_WKNIGHT', 'weißer Springer'); |
| 105 | -define('_MD_CHESS_ALT_WPAWN', 'weißer Bauer'); |
|
| 106 | -define('_MD_CHESS_ALT_BKING', 'schwarzer König'); |
|
| 107 | -define('_MD_CHESS_ALT_BQUEEN', 'schwarze Dame'); |
|
| 108 | -define('_MD_CHESS_ALT_BROOK', 'schwarzer Turm'); |
|
| 105 | +define('_MD_CHESS_ALT_WPAWN', 'weißer Bauer'); |
|
| 106 | +define('_MD_CHESS_ALT_BKING', 'schwarzer König'); |
|
| 107 | +define('_MD_CHESS_ALT_BQUEEN', 'schwarze Dame'); |
|
| 108 | +define('_MD_CHESS_ALT_BROOK', 'schwarzer Turm'); |
|
| 109 | 109 | define('_MD_CHESS_ALT_BBISHOP', 'schwarzer Läufer'); |
| 110 | 110 | define('_MD_CHESS_ALT_BKNIGHT', 'schwarzer Springer'); |
| 111 | -define('_MD_CHESS_ALT_BPAWN', 'schwarzer Bauer'); |
|
| 111 | +define('_MD_CHESS_ALT_BPAWN', 'schwarzer Bauer'); |
|
| 112 | 112 | |
| 113 | -define('_MD_CHESS_CONFIRM', 'bestätigen'); |
|
| 113 | +define('_MD_CHESS_CONFIRM', 'bestätigen'); |
|
| 114 | 114 | |
| 115 | 115 | define('_MD_CHESS_BUTTON_MOVE', 'ziehen'); |
| 116 | 116 | |
| 117 | -define('_MD_CHESS_NORMAL_MOVE', 'Normaler Zug'); |
|
| 118 | -define('_MD_CHESS_RESIGN', 'Aufgeben'); |
|
| 119 | -define('_MD_CHESS_OFFER_DRAW', 'Remis anbieten'); |
|
| 120 | -define('_MD_CHESS_ACCEPT_DRAW', 'Remis annehmen'); |
|
| 121 | -define('_MD_CHESS_REJECT_DRAW', 'Remis ablehnen'); |
|
| 122 | -define('_MD_CHESS_CLAIM_DRAW_50', 'Remis fordern (50-Zug-Regel)'); |
|
| 123 | -define('_MD_CHESS_CLAIM_DRAW_3', 'Remis fordern (dreifache Wiederholung)'); |
|
| 124 | -define('_MD_CHESS_RESTART', 'Partie neu starten'); |
|
| 125 | -define('_MD_CHESS_DELETE', 'Partie löschen'); |
|
| 126 | -define('_MD_CHESS_WANT_ARBITRATION', 'Schiedsurteil anfordern'); |
|
| 127 | -define('_MD_CHESS_MOVE_EXPLAIN', 'Bitte Begründung angeben.'); |
|
| 128 | -define('_MD_CHESS_AFTER_MOVE', 'nach Zug'); |
|
| 117 | +define('_MD_CHESS_NORMAL_MOVE', 'Normaler Zug'); |
|
| 118 | +define('_MD_CHESS_RESIGN', 'Aufgeben'); |
|
| 119 | +define('_MD_CHESS_OFFER_DRAW', 'Remis anbieten'); |
|
| 120 | +define('_MD_CHESS_ACCEPT_DRAW', 'Remis annehmen'); |
|
| 121 | +define('_MD_CHESS_REJECT_DRAW', 'Remis ablehnen'); |
|
| 122 | +define('_MD_CHESS_CLAIM_DRAW_50', 'Remis fordern (50-Zug-Regel)'); |
|
| 123 | +define('_MD_CHESS_CLAIM_DRAW_3', 'Remis fordern (dreifache Wiederholung)'); |
|
| 124 | +define('_MD_CHESS_RESTART', 'Partie neu starten'); |
|
| 125 | +define('_MD_CHESS_DELETE', 'Partie löschen'); |
|
| 126 | +define('_MD_CHESS_WANT_ARBITRATION', 'Schiedsurteil anfordern'); |
|
| 127 | +define('_MD_CHESS_MOVE_EXPLAIN', 'Bitte Begründung angeben.'); |
|
| 128 | +define('_MD_CHESS_AFTER_MOVE', 'nach Zug'); |
|
| 129 | 129 | |
| 130 | 130 | define('_MD_CHESS_DELETE_WARNING', 'Dieser Vorgang wird die Partie unwiederruflich aus der Datenbank löschen!'); |
| 131 | 131 | |
| 132 | 132 | define('_MD_CHESS_BUTTON_REFRESH', 'Aktualisieren'); |
| 133 | 133 | |
| 134 | 134 | define('_MD_CHESS_ORIENTATION_ACTIVE', 'Aktive Farbe unten'); |
| 135 | -define('_MD_CHESS_ORIENTATION_WHITE', 'Weiß unten'); |
|
| 136 | -define('_MD_CHESS_ORIENTATION_BLACK', 'Schwarz unten'); |
|
| 137 | - |
|
| 138 | -define('_MD_CHESS_ARBITER_CONTROLS', 'Schiedsrichter-Optionen'); |
|
| 139 | -define('_MD_CHESS_ARBITER_SUSPEND', 'Spiel unterbrechen'); |
|
| 140 | -define('_MD_CHESS_ARBITER_RESUME', 'Spiel wieder aufnehmen'); |
|
| 141 | -define('_MD_CHESS_ARBITER_DRAW', 'Remis verkünden'); |
|
| 142 | -define('_MD_CHESS_ARBITER_EXPLAIN', 'Bitte Begründung angeben.'); |
|
| 143 | -define('_MD_CHESS_ARBITER_DELETE', 'Partie löschen'); |
|
| 144 | -define('_MD_CHESS_ARBITER_NOACTION', 'Keine Aktion'); |
|
| 145 | -define('_MD_CHESS_ARBITER_SHOWCTRL', 'Schiedsrichter-Optionen zeigen'); |
|
| 135 | +define('_MD_CHESS_ORIENTATION_WHITE', 'Weiß unten'); |
|
| 136 | +define('_MD_CHESS_ORIENTATION_BLACK', 'Schwarz unten'); |
|
| 137 | + |
|
| 138 | +define('_MD_CHESS_ARBITER_CONTROLS', 'Schiedsrichter-Optionen'); |
|
| 139 | +define('_MD_CHESS_ARBITER_SUSPEND', 'Spiel unterbrechen'); |
|
| 140 | +define('_MD_CHESS_ARBITER_RESUME', 'Spiel wieder aufnehmen'); |
|
| 141 | +define('_MD_CHESS_ARBITER_DRAW', 'Remis verkünden'); |
|
| 142 | +define('_MD_CHESS_ARBITER_EXPLAIN', 'Bitte Begründung angeben.'); |
|
| 143 | +define('_MD_CHESS_ARBITER_DELETE', 'Partie löschen'); |
|
| 144 | +define('_MD_CHESS_ARBITER_NOACTION', 'Keine Aktion'); |
|
| 145 | +define('_MD_CHESS_ARBITER_SHOWCTRL', 'Schiedsrichter-Optionen zeigen'); |
|
| 146 | 146 | |
| 147 | 147 | define('_MD_CHESS_ARBITER_DELETE_WARNING', 'Dieser Vorgang wird die Partie unwiederruflich aus der Datenbank löschen!'); |
| 148 | 148 | |
| 149 | 149 | define('_MD_CHESS_BUTTON_ARBITRATE', 'absenden'); |
| 150 | 150 | |
| 151 | -define('_MD_CHESS_WHEN_SUSPENDED', 'Wenn unterbrochen'); |
|
| 152 | -define('_MD_CHESS_SUSPENDED_BY', 'Unterbrochen von'); |
|
| 153 | -define('_MD_CHESS_SUSPENSION_TYPE', 'Art der Unterbrechung'); |
|
| 151 | +define('_MD_CHESS_WHEN_SUSPENDED', 'Wenn unterbrochen'); |
|
| 152 | +define('_MD_CHESS_SUSPENDED_BY', 'Unterbrochen von'); |
|
| 153 | +define('_MD_CHESS_SUSPENSION_TYPE', 'Art der Unterbrechung'); |
|
| 154 | 154 | define('_MD_CHESS_SUSPENSION_REASON', 'Grund der Unterbrechung'); |
| 155 | -define('_MD_CHESS_UNKNOWN', '*unbekannt*'); |
|
| 155 | +define('_MD_CHESS_UNKNOWN', '*unbekannt*'); |
|
| 156 | 156 | define('_MD_CHESS_SUSP_TYPE_ARBITER', 'Vom Schiedsrichter unterbrochen'); |
| 157 | -define('_MD_CHESS_SUSP_TYPE_PLAYER', 'Schiedsurteil angefordert'); |
|
| 157 | +define('_MD_CHESS_SUSP_TYPE_PLAYER', 'Schiedsurteil angefordert'); |
|
| 158 | 158 | |
| 159 | -define('_MD_CHESS_MOVE_ENTRY', 'Zug-Eintrag'); |
|
| 160 | -define('_MD_CHESS_MOVE_LIST', 'Liste der Züge'); |
|
| 161 | -define('_MD_CHESS_EXPORT_FORMATS', 'Exportieren'); |
|
| 159 | +define('_MD_CHESS_MOVE_ENTRY', 'Zug-Eintrag'); |
|
| 160 | +define('_MD_CHESS_MOVE_LIST', 'Liste der Züge'); |
|
| 161 | +define('_MD_CHESS_EXPORT_FORMATS', 'Exportieren'); |
|
| 162 | 162 | define('_MD_CHESS_CAPTURED_PIECES', 'Eroberte Figuren'); |
| 163 | 163 | |
| 164 | 164 | // Notifications |
| 165 | -define('_MD_CHESS_WHITE', 'Weiß'); |
|
| 166 | -define('_MD_CHESS_BLACK', 'Schwarz'); |
|
| 167 | -define('_MD_CHESS_RESIGNED', 'hat aufgegeben.'); |
|
| 168 | -define('_MD_CHESS_OFFERED_DRAW', 'hat Remis angeboten.'); |
|
| 169 | -define('_MD_CHESS_ACCEPTED_DRAW', 'hat Remis angenommen.'); |
|
| 170 | -define('_MD_CHESS_REJECTED_DRAW', 'hat Remis abgelehnt.'); |
|
| 171 | -define('_MD_CHESS_RQSTED_ARBT', 'hat Schiedsurteil angefordert.'); |
|
| 165 | +define('_MD_CHESS_WHITE', 'Weiß'); |
|
| 166 | +define('_MD_CHESS_BLACK', 'Schwarz'); |
|
| 167 | +define('_MD_CHESS_RESIGNED', 'hat aufgegeben.'); |
|
| 168 | +define('_MD_CHESS_OFFERED_DRAW', 'hat Remis angeboten.'); |
|
| 169 | +define('_MD_CHESS_ACCEPTED_DRAW', 'hat Remis angenommen.'); |
|
| 170 | +define('_MD_CHESS_REJECTED_DRAW', 'hat Remis abgelehnt.'); |
|
| 171 | +define('_MD_CHESS_RQSTED_ARBT', 'hat Schiedsurteil angefordert.'); |
|
| 172 | 172 | define('_MD_CHESS_BEEN_SUSPENDED', 'Partie ist unterbrochen, Schiedsurteil wird erwartet.'); |
| 173 | -define('_MD_CHESS_AS_ARBITER', 'ist Schiedsrichter'); |
|
| 174 | -define('_MD_CHESS_RESUMED_PLAY', 'hat Partie wieder aufgenommen.'); |
|
| 175 | -define('_MD_CHESS_DECLARED_DRAW', 'hat Remis gefordert.'); |
|
| 176 | -define('_MD_CHESS_DELETED_GAME', 'hat die Partie gelöscht.'); |
|
| 173 | +define('_MD_CHESS_AS_ARBITER', 'ist Schiedsrichter'); |
|
| 174 | +define('_MD_CHESS_RESUMED_PLAY', 'hat Partie wieder aufgenommen.'); |
|
| 175 | +define('_MD_CHESS_DECLARED_DRAW', 'hat Remis gefordert.'); |
|
| 176 | +define('_MD_CHESS_DELETED_GAME', 'hat die Partie gelöscht.'); |
|
| 177 | 177 | define('_MD_CHESS_SUSPENDED_PLAY', '$username (Schiedsrichter) hat die Partie unterbrochen.'); |
| 178 | 178 | |
| 179 | 179 | // FEN setup errors |
| 180 | -define('_MD_CHESS_FENBAD_LENGTH', 'ungültige Länge'); |
|
| 181 | -define('_MD_CHESS_FENBAD_FIELD_COUNT', 'falsche Anzahl an Feldern'); |
|
| 182 | -define('_MD_CHESS_FENBAD_PP_INVALID', 'Figur ungültig plaziert.'); |
|
| 183 | -define('_MD_CHESS_FENBAD_AC_INVALID', 'aktive Farbe ungültig'); |
|
| 184 | -define('_MD_CHESS_FENBAD_CA_INVALID', 'ungültige Rochade'); |
|
| 185 | -define('_MD_CHESS_FENBAD_EP_INVALID', 'en passant Zielfeld ungültig'); |
|
| 186 | -define('_MD_CHESS_FENBAD_HC_INVALID', 'ungültige Zeit für halben Zug'); |
|
| 187 | -define('_MD_CHESS_FENBAD_FN_INVALID', 'ungültige Zuganzahl'); |
|
| 188 | -define('_MD_CHESS_FENBAD_MATERIAL', 'unzureichende Paar-Informationen'); |
|
| 189 | -define('_MD_CHESS_FENBAD_IN_CHECK', 'aktiver Spieler darf Gegner nicht in Schach haben'); |
|
| 180 | +define('_MD_CHESS_FENBAD_LENGTH', 'ungültige Länge'); |
|
| 181 | +define('_MD_CHESS_FENBAD_FIELD_COUNT', 'falsche Anzahl an Feldern'); |
|
| 182 | +define('_MD_CHESS_FENBAD_PP_INVALID', 'Figur ungültig plaziert.'); |
|
| 183 | +define('_MD_CHESS_FENBAD_AC_INVALID', 'aktive Farbe ungültig'); |
|
| 184 | +define('_MD_CHESS_FENBAD_CA_INVALID', 'ungültige Rochade'); |
|
| 185 | +define('_MD_CHESS_FENBAD_EP_INVALID', 'en passant Zielfeld ungültig'); |
|
| 186 | +define('_MD_CHESS_FENBAD_HC_INVALID', 'ungültige Zeit für halben Zug'); |
|
| 187 | +define('_MD_CHESS_FENBAD_FN_INVALID', 'ungültige Zuganzahl'); |
|
| 188 | +define('_MD_CHESS_FENBAD_MATERIAL', 'unzureichende Paar-Informationen'); |
|
| 189 | +define('_MD_CHESS_FENBAD_IN_CHECK', 'aktiver Spieler darf Gegner nicht in Schach haben'); |
|
| 190 | 190 | define('_MD_CHESS_FENBAD_CA_INCONSISTENT', 'Möglichkeit zur Rochade in dieser Spielsituation ungültig'); |
| 191 | -define('_MD_CHESS_FENBAD_EP_COLOR', 'en passant Zielfeld hat die falsche Farbe'); |
|
| 192 | -define('_MD_CHESS_FENBAD_EP_NO_PAWN', 'en passant Zielfeld für nicht existenten Bauern'); |
|
| 191 | +define('_MD_CHESS_FENBAD_EP_COLOR', 'en passant Zielfeld hat die falsche Farbe'); |
|
| 192 | +define('_MD_CHESS_FENBAD_EP_NO_PAWN', 'en passant Zielfeld für nicht existenten Bauern'); |
|
| 193 | 193 | |
| 194 | 194 | // Move-messages |
| 195 | 195 | // Some of these messages are processed with eval() in ChessGame::move_msg(), and may contain parameters $param[1], $param[2], etc. |
| 196 | -define('_MD_CHESS_MOVE_UNKNOWN', 'ERROR (autocomplete): format ist unbekannt!'); |
|
| 197 | -define('_MD_CHESS_MOVE_PAWN_MAY_BECOME', 'ERROR (autocomplete): Ein Bauer kann nur zu einem Turm, einem Läufer, einem Springer oder einer Dame werden!'); |
|
| 198 | -define('_MD_CHESS_MOVE_USE_X', 'ERROR (autocomplete): x erforderlich, weist auf Angriff hin'); |
|
| 199 | -define('_MD_CHESS_MOVE_COORD_INVALID', 'ERROR (autocomplete): Feld {$param[1]} existiert nicht'); |
|
| 200 | -define('_MD_CHESS_MOVE_CANNOT_FIND_PAWN', 'ERROR (autocomplete): Kein {$param[1]} Bauer in Spalte {$param[2]}'); |
|
| 201 | -define('_MD_CHESS_MOVE_USE_NOTATION', 'ERROR (autocomplete): Bitte folgende Notation für Bauernangriffe benutzen: [a-h]x[a-h][1-8] (siehe Hilfeseiten)'); |
|
| 202 | -define('_MD_CHESS_MOVE_NO_PAWN', 'ERROR (autocomplete): Es gibt keinen Bauern in Spalte in {$param[1]}'); |
|
| 203 | -define('_MD_CHESS_MOVE_TWO_PAWNS', 'ERROR (autocomplete): Es gibt mehr als einen Bauern in Spalte {$param[1]}'); |
|
| 204 | -define('_MD_CHESS_MOVE_NO_FIGURE', 'ERROR (autocomplete): Es gibt keine Figur {$param[1]} = {$param[2]}'); |
|
| 196 | +define('_MD_CHESS_MOVE_UNKNOWN', 'ERROR (autocomplete): format ist unbekannt!'); |
|
| 197 | +define('_MD_CHESS_MOVE_PAWN_MAY_BECOME', 'ERROR (autocomplete): Ein Bauer kann nur zu einem Turm, einem Läufer, einem Springer oder einer Dame werden!'); |
|
| 198 | +define('_MD_CHESS_MOVE_USE_X', 'ERROR (autocomplete): x erforderlich, weist auf Angriff hin'); |
|
| 199 | +define('_MD_CHESS_MOVE_COORD_INVALID', 'ERROR (autocomplete): Feld {$param[1]} existiert nicht'); |
|
| 200 | +define('_MD_CHESS_MOVE_CANNOT_FIND_PAWN', 'ERROR (autocomplete): Kein {$param[1]} Bauer in Spalte {$param[2]}'); |
|
| 201 | +define('_MD_CHESS_MOVE_USE_NOTATION', 'ERROR (autocomplete): Bitte folgende Notation für Bauernangriffe benutzen: [a-h]x[a-h][1-8] (siehe Hilfeseiten)'); |
|
| 202 | +define('_MD_CHESS_MOVE_NO_PAWN', 'ERROR (autocomplete): Es gibt keinen Bauern in Spalte in {$param[1]}'); |
|
| 203 | +define('_MD_CHESS_MOVE_TWO_PAWNS', 'ERROR (autocomplete): Es gibt mehr als einen Bauern in Spalte {$param[1]}'); |
|
| 204 | +define('_MD_CHESS_MOVE_NO_FIGURE', 'ERROR (autocomplete): Es gibt keine Figur {$param[1]} = {$param[2]}'); |
|
| 205 | 205 | define('_MD_CHESS_MOVE_NEITHER_CAN_REACH', 'ERROR (autocomplete): keiner von {$param[1]} = {$param[2]} kann {$param[3]} erreichen'); |
| 206 | -define('_MD_CHESS_MOVE_BOTH_CAN_REACH', 'ERROR (autocomplete): beide {$param[1]} = {$param[2]} können {$param[3]} erreichen'); |
|
| 207 | -define('_MD_CHESS_MOVE_AMBIGUOUS', 'ERROR (autocomplete): Mehrdeutigkeit konnte nicht gelöst werden'); |
|
| 208 | -define('_MD_CHESS_MOVE_UNDEFINED', 'ERROR: undefiniert'); |
|
| 209 | -define('_MD_CHESS_MOVE_GAME_OVER', 'ERROR: Diese Partie ist beendet. Es ist nicht möglich, weitere Züge abzusetzen.'); |
|
| 210 | -define('_MD_CHESS_MOVE_NO_CASTLE', 'ERROR: Rochade nicht möglich.'); |
|
| 211 | -define('_MD_CHESS_MOVE_INVALID_PIECE', 'ERROR: Nur N (Springer), B (Läufer), R (Turm) und Q (Dame) sind gültige Figurenbezeichner'); |
|
| 212 | -define('_MD_CHESS_MOVE_UNKNOWN_FIGURE', 'ERROR: Figur {$param[1]} ist nicht bekannt!'); |
|
| 213 | -define('_MD_CHESS_MOVE_TILE_EMPTY', 'ERROR: Feld {$param[1]} ist leer'); |
|
| 214 | -define('_MD_CHESS_MOVE_NOT_YOUR_PIECE', 'ERROR: Diese Figur gehört nicht zu den eigenen!'); |
|
| 215 | -define('_MD_CHESS_MOVE_NOEXIST_FIGURE', 'ERROR: Diese Figur existiert nicht!'); |
|
| 216 | -define('_MD_CHESS_MOVE_START_END_SAME', 'ERROR: Position und Zielfeld sind identisch!'); |
|
| 217 | -define('_MD_CHESS_MOVE_UNKNOWN_ACTION', 'ERROR: {$param[1]} ist unbekannt! Bitte "-" für Bewegungen und "x" für Angriffe angeben.'); |
|
| 218 | -define('_MD_CHESS_MOVE_OUT_OF_RANGE', 'ERROR: Feld {$param[1]} ist außer Reichweite für {$param[2]} auf {$param[3]}!'); |
|
| 219 | -define('_MD_CHESS_MOVE_OCCUPIED', 'ERROR: Feld {$param[1]} ist besetzt. Zug nicht möglich.'); |
|
| 220 | -define('_MD_CHESS_MOVE_NO_EN_PASSANT' , 'ERROR: en-passant nicht möglich!'); |
|
| 221 | -define('_MD_CHESS_MOVE_ATTACK_EMPTY', 'ERROR: Feld {$param[1]} ist leer. Angriff nicht möglich."'); |
|
| 222 | -define('_MD_CHESS_MOVE_ATTACK_SELF', 'ERROR: Angriff auf eigene Figur auf {$param[1]} nicht möglich.'); |
|
| 223 | -define('_MD_CHESS_MOVE_IN_CHECK', 'ERROR: Zug nicht möglich, würde den eigenen König in Schach setzen.'); |
|
| 224 | -define('_MD_CHESS_MOVE_CASTLED_SHORT', 'Kurze Rochade ausgeführt.'); |
|
| 225 | -define('_MD_CHESS_MOVE_CASTLED_LONG', 'Lange Rochade ausgeführt.'); |
|
| 226 | -define('_MD_CHESS_MOVE_MOVED', '{$param[1]} von {$param[2]} nach {$param[3]} gesetzt'); |
|
| 227 | -define('_MD_CHESS_MOVE_CAPTURED', '{$param[1]} schlägt {$param[2]} auf {$param[3]}'); |
|
| 228 | -define('_MD_CHESS_MOVE_PROMOTED', 'und wird zu {$param[1]}!'); |
|
| 229 | -define('_MD_CHESS_MOVE_CHECKMATE', 'Schachmatt!'); |
|
| 230 | -define('_MD_CHESS_MOVE_STALEMATE', 'Patt!'); |
|
| 231 | -define('_MD_CHESS_MOVE_MATERIAL', 'unzureichende Paar-Information!'); |
|
| 232 | -define('_MD_CHESS_MOVE_KING', 'König'); |
|
| 233 | -define('_MD_CHESS_MOVE_QUEEN', 'Dame'); |
|
| 234 | -define('_MD_CHESS_MOVE_ROOK', 'Turm'); |
|
| 235 | -define('_MD_CHESS_MOVE_BISHOP', 'Läufer'); |
|
| 236 | -define('_MD_CHESS_MOVE_KNIGHT', 'Springer'); |
|
| 237 | -define('_MD_CHESS_MOVE_PAWN', 'Bauer'); |
|
| 238 | -define('_MD_CHESS_MOVE_EMPTY', 'leer'); |
|
| 206 | +define('_MD_CHESS_MOVE_BOTH_CAN_REACH', 'ERROR (autocomplete): beide {$param[1]} = {$param[2]} können {$param[3]} erreichen'); |
|
| 207 | +define('_MD_CHESS_MOVE_AMBIGUOUS', 'ERROR (autocomplete): Mehrdeutigkeit konnte nicht gelöst werden'); |
|
| 208 | +define('_MD_CHESS_MOVE_UNDEFINED', 'ERROR: undefiniert'); |
|
| 209 | +define('_MD_CHESS_MOVE_GAME_OVER', 'ERROR: Diese Partie ist beendet. Es ist nicht möglich, weitere Züge abzusetzen.'); |
|
| 210 | +define('_MD_CHESS_MOVE_NO_CASTLE', 'ERROR: Rochade nicht möglich.'); |
|
| 211 | +define('_MD_CHESS_MOVE_INVALID_PIECE', 'ERROR: Nur N (Springer), B (Läufer), R (Turm) und Q (Dame) sind gültige Figurenbezeichner'); |
|
| 212 | +define('_MD_CHESS_MOVE_UNKNOWN_FIGURE', 'ERROR: Figur {$param[1]} ist nicht bekannt!'); |
|
| 213 | +define('_MD_CHESS_MOVE_TILE_EMPTY', 'ERROR: Feld {$param[1]} ist leer'); |
|
| 214 | +define('_MD_CHESS_MOVE_NOT_YOUR_PIECE', 'ERROR: Diese Figur gehört nicht zu den eigenen!'); |
|
| 215 | +define('_MD_CHESS_MOVE_NOEXIST_FIGURE', 'ERROR: Diese Figur existiert nicht!'); |
|
| 216 | +define('_MD_CHESS_MOVE_START_END_SAME', 'ERROR: Position und Zielfeld sind identisch!'); |
|
| 217 | +define('_MD_CHESS_MOVE_UNKNOWN_ACTION', 'ERROR: {$param[1]} ist unbekannt! Bitte "-" für Bewegungen und "x" für Angriffe angeben.'); |
|
| 218 | +define('_MD_CHESS_MOVE_OUT_OF_RANGE', 'ERROR: Feld {$param[1]} ist außer Reichweite für {$param[2]} auf {$param[3]}!'); |
|
| 219 | +define('_MD_CHESS_MOVE_OCCUPIED', 'ERROR: Feld {$param[1]} ist besetzt. Zug nicht möglich.'); |
|
| 220 | +define('_MD_CHESS_MOVE_NO_EN_PASSANT', 'ERROR: en-passant nicht möglich!'); |
|
| 221 | +define('_MD_CHESS_MOVE_ATTACK_EMPTY', 'ERROR: Feld {$param[1]} ist leer. Angriff nicht möglich."'); |
|
| 222 | +define('_MD_CHESS_MOVE_ATTACK_SELF', 'ERROR: Angriff auf eigene Figur auf {$param[1]} nicht möglich.'); |
|
| 223 | +define('_MD_CHESS_MOVE_IN_CHECK', 'ERROR: Zug nicht möglich, würde den eigenen König in Schach setzen.'); |
|
| 224 | +define('_MD_CHESS_MOVE_CASTLED_SHORT', 'Kurze Rochade ausgeführt.'); |
|
| 225 | +define('_MD_CHESS_MOVE_CASTLED_LONG', 'Lange Rochade ausgeführt.'); |
|
| 226 | +define('_MD_CHESS_MOVE_MOVED', '{$param[1]} von {$param[2]} nach {$param[3]} gesetzt'); |
|
| 227 | +define('_MD_CHESS_MOVE_CAPTURED', '{$param[1]} schlägt {$param[2]} auf {$param[3]}'); |
|
| 228 | +define('_MD_CHESS_MOVE_PROMOTED', 'und wird zu {$param[1]}!'); |
|
| 229 | +define('_MD_CHESS_MOVE_CHECKMATE', 'Schachmatt!'); |
|
| 230 | +define('_MD_CHESS_MOVE_STALEMATE', 'Patt!'); |
|
| 231 | +define('_MD_CHESS_MOVE_MATERIAL', 'unzureichende Paar-Information!'); |
|
| 232 | +define('_MD_CHESS_MOVE_KING', 'König'); |
|
| 233 | +define('_MD_CHESS_MOVE_QUEEN', 'Dame'); |
|
| 234 | +define('_MD_CHESS_MOVE_ROOK', 'Turm'); |
|
| 235 | +define('_MD_CHESS_MOVE_BISHOP', 'Läufer'); |
|
| 236 | +define('_MD_CHESS_MOVE_KNIGHT', 'Springer'); |
|
| 237 | +define('_MD_CHESS_MOVE_PAWN', 'Bauer'); |
|
| 238 | +define('_MD_CHESS_MOVE_EMPTY', 'leer'); |
|
| 239 | 239 | |
| 240 | 240 | // miscellaneous |
| 241 | -define('_MD_CHESS_GAME_CONFIRM', 'Einstellungen für diese Partie bestätigen.'); |
|
| 242 | -define('_MD_CHESS_GAME_CREATED', 'Partie erstellt'); |
|
| 243 | -define('_MD_CHESS_GAME_STARTED', 'Partie begonnen'); |
|
| 244 | -define('_MD_CHESS_LABEL_DATE_CREATED', 'Datum erstellt'); |
|
| 241 | +define('_MD_CHESS_GAME_CONFIRM', 'Einstellungen für diese Partie bestätigen.'); |
|
| 242 | +define('_MD_CHESS_GAME_CREATED', 'Partie erstellt'); |
|
| 243 | +define('_MD_CHESS_GAME_STARTED', 'Partie begonnen'); |
|
| 244 | +define('_MD_CHESS_LABEL_DATE_CREATED', 'Datum erstellt'); |
|
| 245 | 245 | define('_MD_CHESS_LABEL_GAME_SUSPENDED', 'Partie unterbrochen'); |
| 246 | -define('_MD_CHESS_WHITE_OFFERED_DRAW', 'Weiß hat Remis angeboten. Schwarz muß annehmen oder ablehnen.'); |
|
| 247 | -define('_MD_CHESS_BLACK_OFFERED_DRAW', 'Schwarz hat Remis angeboten. Weiß muß annehmen oder ablehnen.'); |
|
| 246 | +define('_MD_CHESS_WHITE_OFFERED_DRAW', 'Weiß hat Remis angeboten. Schwarz muß annehmen oder ablehnen.'); |
|
| 247 | +define('_MD_CHESS_BLACK_OFFERED_DRAW', 'Schwarz hat Remis angeboten. Weiß muß annehmen oder ablehnen.'); |
|
| 248 | 248 | |
| 249 | 249 | // PGN movetext comments for drawn games - must not contain comment delimiters '{' or '}' |
| 250 | -define('_MD_CHESS_DRAW_STALEMATE', 'Remis durch Patt.'); |
|
| 251 | -define('_MD_CHESS_DRAW_NO_MATE', 'Remis, da kein Schachmatt mehr möglich.'); |
|
| 250 | +define('_MD_CHESS_DRAW_STALEMATE', 'Remis durch Patt.'); |
|
| 251 | +define('_MD_CHESS_DRAW_NO_MATE', 'Remis, da kein Schachmatt mehr möglich.'); |
|
| 252 | 252 | define('_MD_CHESS_DRAW_BY_AGREEMENT', 'Remis in beidseitigem Einvernehmen.'); |
| 253 | -define('_MD_CHESS_DRAW_DECLARED', 'Remis vom Schiedsrichter entschieden, Begründung: %s.'); |
|
| 254 | -define('_MD_CHESS_DRAW_50', 'Remis durch 50-Zug-Regel.'); |
|
| 255 | -define('_MD_CHESS_DRAW_3', 'Remis durch dreimalige-Wiederholung-Regel, ausgehend von Brettstellung vor den Zügen %s.'); |
|
| 253 | +define('_MD_CHESS_DRAW_DECLARED', 'Remis vom Schiedsrichter entschieden, Begründung: %s.'); |
|
| 254 | +define('_MD_CHESS_DRAW_50', 'Remis durch 50-Zug-Regel.'); |
|
| 255 | +define('_MD_CHESS_DRAW_3', 'Remis durch dreimalige-Wiederholung-Regel, ausgehend von Brettstellung vor den Zügen %s.'); |
|
| 256 | 256 | |
| 257 | -define('_MD_CHESS_NO_DRAW_50', 'Die Bedingungen für ein Remis nach der 50-Zug-Regel wurden nicht erfüllt.'); |
|
| 258 | -define('_MD_CHESS_NO_DRAW_3', 'Die Bedingungen für ein Remis nach der dreimalige-Wiederholung-Regel wurden nicht erfüllt.'); |
|
| 257 | +define('_MD_CHESS_NO_DRAW_50', 'Die Bedingungen für ein Remis nach der 50-Zug-Regel wurden nicht erfüllt.'); |
|
| 258 | +define('_MD_CHESS_NO_DRAW_3', 'Die Bedingungen für ein Remis nach der dreimalige-Wiederholung-Regel wurden nicht erfüllt.'); |
|
| 259 | 259 | |
| 260 | 260 | // menu options |
| 261 | -define('_MD_CHESS_SHOW_GAMES_INPLAY', 'Zeige nur aktive Partien'); |
|
| 261 | +define('_MD_CHESS_SHOW_GAMES_INPLAY', 'Zeige nur aktive Partien'); |
|
| 262 | 262 | define('_MD_CHESS_SHOW_GAMES_CONCLUDED', 'Zeige nur beendete Partien'); |
| 263 | -define('_MD_CHESS_SHOW_GAMES_BOTH', 'Zeige alle Partien'); |
|
| 264 | -define('_MD_CHESS_SHOW_GAMES_RATED', 'Zeige nur bewertete Partien'); |
|
| 265 | -define('_MD_CHESS_SHOW_GAMES_UNRATED', 'Zeige bewertete und unbewertete Partien'); |
|
| 263 | +define('_MD_CHESS_SHOW_GAMES_BOTH', 'Zeige alle Partien'); |
|
| 264 | +define('_MD_CHESS_SHOW_GAMES_RATED', 'Zeige nur bewertete Partien'); |
|
| 265 | +define('_MD_CHESS_SHOW_GAMES_UNRATED', 'Zeige bewertete und unbewertete Partien'); |
|
| 266 | 266 | define('_MD_CHESS_SHOW_CHALLENGES_OPEN', 'Zeige nur offene Herausforderungen'); |
| 267 | 267 | define('_MD_CHESS_SHOW_CHALLENGES_USER', 'Zeige nur persönliche Herausforderungen'); |
| 268 | 268 | define('_MD_CHESS_SHOW_CHALLENGES_BOTH', 'Zeige alle Herausforderungen'); |
| 269 | 269 | |
| 270 | 270 | // ratings |
| 271 | -define('_MD_CHESS_RATED_GAME', 'Bewertete Partie'); |
|
| 272 | -define('_MD_CHESS_RATINGS_OFF', 'Bewertungen nicht aktiv.'); |
|
| 273 | -define('_MD_CHESS_PLAYER_RATINGS', 'Bewertung des Spielers'); |
|
| 274 | -define('_MD_CHESS_RATING', 'Bewertung'); |
|
| 275 | -define('_MD_CHESS_PLAYER', 'Spieler'); |
|
| 276 | -define('_MD_CHESS_GAMES_PLAYED', 'Bewertete beendete Partien'); |
|
| 277 | -define('_MD_CHESS_PROVISIONAL', 'vorläufige Bewertung (weniger als %s bewertete Partien gespielt)'); |
|
| 278 | -define('_MD_CHESS_NA', 'n/a'); // not applicable or not available |
|
| 279 | -define('_MD_CHESS_NO_RATING_INFO', 'Keine Bewertungen gefunden.'); |
|
| 280 | -define('_MD_CHESS_RECALC_RATINGS', 'Bewertungen für alle Spieler neu berechnen (nur für Modul-Administratoren möglich)'); |
|
| 281 | -define('_MD_CHESS_SUBMIT_BUTTON', 'absenden'); |
|
| 282 | -define('_MD_CHESS_RECALC_CONFIRM', 'Ja, ich bin sicher, daß ich das tun will.'); |
|
| 283 | -define('_MD_CHESS_RECALC_DONE', 'Bewertungen neu berechnet.'); |
|
| 284 | -define('_MD_CHESS_RECALC_NOT_DONE', 'Bewertungen nicht neu berechnet, da Bestätigungskästchen nicht gesetzt war.'); |
|
| 285 | -define('_MD_CHESS_LAST_ACTIVITY', 'Letzte Aktivität'); |
|
| 286 | -define('_MD_CHESS_STATUS', 'Status'); |
|
| 287 | -define('_MD_CHESS_DRAWN', 'Remis'); |
|
| 288 | -define('_MD_CHESS_WON', 'gewonnen'); |
|
| 289 | -define('_MD_CHESS_LOST', 'verloren'); |
|
| 290 | -define('_MD_CHESS_RANKED', 'bewertet'); |
|
| 291 | -define('_MD_CHESS_RATED_GAMES_PLAYED', 'bewertete Partien'); |
|
| 292 | -define('_MD_CHESS_CHALLENGES_FOR', 'Herausforderungen für: %s'); |
|
| 293 | -define('_MD_CHESS_GAMES_FOR', 'Schachpartien für: %s'); |
|
| 294 | -define('_MD_CHESS_STATS_FOR', 'Statistiken für: %s'); |
|
| 295 | -define('_MD_CHESS_SELECT_PLAYER', 'Auswahl Spieler und Sichtbarkeit'); |
|
| 296 | -define('_MD_CHESS_USERNAME', 'Benutzername'); |
|
| 297 | -define('_MD_CHESS_SHOW_ALL_GAMES', 'Zeige alle Partien'); |
|
| 271 | +define('_MD_CHESS_RATED_GAME', 'Bewertete Partie'); |
|
| 272 | +define('_MD_CHESS_RATINGS_OFF', 'Bewertungen nicht aktiv.'); |
|
| 273 | +define('_MD_CHESS_PLAYER_RATINGS', 'Bewertung des Spielers'); |
|
| 274 | +define('_MD_CHESS_RATING', 'Bewertung'); |
|
| 275 | +define('_MD_CHESS_PLAYER', 'Spieler'); |
|
| 276 | +define('_MD_CHESS_GAMES_PLAYED', 'Bewertete beendete Partien'); |
|
| 277 | +define('_MD_CHESS_PROVISIONAL', 'vorläufige Bewertung (weniger als %s bewertete Partien gespielt)'); |
|
| 278 | +define('_MD_CHESS_NA', 'n/a'); // not applicable or not available |
|
| 279 | +define('_MD_CHESS_NO_RATING_INFO', 'Keine Bewertungen gefunden.'); |
|
| 280 | +define('_MD_CHESS_RECALC_RATINGS', 'Bewertungen für alle Spieler neu berechnen (nur für Modul-Administratoren möglich)'); |
|
| 281 | +define('_MD_CHESS_SUBMIT_BUTTON', 'absenden'); |
|
| 282 | +define('_MD_CHESS_RECALC_CONFIRM', 'Ja, ich bin sicher, daß ich das tun will.'); |
|
| 283 | +define('_MD_CHESS_RECALC_DONE', 'Bewertungen neu berechnet.'); |
|
| 284 | +define('_MD_CHESS_RECALC_NOT_DONE', 'Bewertungen nicht neu berechnet, da Bestätigungskästchen nicht gesetzt war.'); |
|
| 285 | +define('_MD_CHESS_LAST_ACTIVITY', 'Letzte Aktivität'); |
|
| 286 | +define('_MD_CHESS_STATUS', 'Status'); |
|
| 287 | +define('_MD_CHESS_DRAWN', 'Remis'); |
|
| 288 | +define('_MD_CHESS_WON', 'gewonnen'); |
|
| 289 | +define('_MD_CHESS_LOST', 'verloren'); |
|
| 290 | +define('_MD_CHESS_RANKED', 'bewertet'); |
|
| 291 | +define('_MD_CHESS_RATED_GAMES_PLAYED', 'bewertete Partien'); |
|
| 292 | +define('_MD_CHESS_CHALLENGES_FOR', 'Herausforderungen für: %s'); |
|
| 293 | +define('_MD_CHESS_GAMES_FOR', 'Schachpartien für: %s'); |
|
| 294 | +define('_MD_CHESS_STATS_FOR', 'Statistiken für: %s'); |
|
| 295 | +define('_MD_CHESS_SELECT_PLAYER', 'Auswahl Spieler und Sichtbarkeit'); |
|
| 296 | +define('_MD_CHESS_USERNAME', 'Benutzername'); |
|
| 297 | +define('_MD_CHESS_SHOW_ALL_GAMES', 'Zeige alle Partien'); |
|
| 298 | 298 | define('_MD_CHESS_SHOW_EXCEPT_SELFPLAY', 'Zeige alle Partien außer denen gegen mich selbst'); |
| 299 | -define('_MD_CHESS_SHOW_RATED_ONLY', 'Zeige nur bewertete Partien'); |
|
| 300 | -define('_MD_CHESS_PLAYER_NOT_FOUND', 'Keine Partie-Informationen für diesen Spieler gefunden.'); |
|
| 301 | -define('_MD_CHESS_VIEW_PROFILE', 'Zeige Profil dieses Spielers'); |
|
| 299 | +define('_MD_CHESS_SHOW_RATED_ONLY', 'Zeige nur bewertete Partien'); |
|
| 300 | +define('_MD_CHESS_PLAYER_NOT_FOUND', 'Keine Partie-Informationen für diesen Spieler gefunden.'); |
|
| 301 | +define('_MD_CHESS_VIEW_PROFILE', 'Zeige Profil dieses Spielers'); |
|
| 302 | 302 | |
| 303 | 303 | /**#@-*/ |
| 304 | 304 | |
@@ -35,20 +35,20 @@ discard block |
||
| 35 | 35 | /**#@+ |
| 36 | 36 | */ |
| 37 | 37 | require_once '../../mainfile.php'; |
| 38 | -require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
|
| 39 | -require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
| 40 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/constants.inc.php'; |
|
| 41 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/functions.inc.php'; |
|
| 42 | -require_once XOOPS_ROOT_PATH . '/modules/chess/include/ratings.inc.php'; |
|
| 38 | +require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
|
| 39 | +require_once XOOPS_ROOT_PATH.'/class/pagenav.php'; |
|
| 40 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/constants.inc.php'; |
|
| 41 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/functions.inc.php'; |
|
| 42 | +require_once XOOPS_ROOT_PATH.'/modules/chess/include/ratings.inc.php'; |
|
| 43 | 43 | |
| 44 | 44 | // check whether the rating feature is enabled |
| 45 | 45 | if (chess_moduleConfig('rating_system') == 'none') { |
| 46 | - redirect_header(XOOPS_URL . '/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_RATINGS_OFF); |
|
| 46 | + redirect_header(XOOPS_URL.'/modules/chess/index.php', _CHESS_REDIRECT_DELAY_FAILURE, _MD_CHESS_RATINGS_OFF); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | $xoopsOption['template_main'] = 'chess_ratings.html'; |
| 50 | 50 | $xoopsConfig['module_cache'][$xoopsModule->getVar('mid')] = 0; // disable caching |
| 51 | -require_once XOOPS_ROOT_PATH . '/header.php'; |
|
| 51 | +require_once XOOPS_ROOT_PATH.'/header.php'; |
|
| 52 | 52 | |
| 53 | 53 | // user input |
| 54 | 54 | $submit_recalc_ratings = isset($_POST['submit_recalc_ratings']); |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | |
| 60 | 60 | // If form-submit, check security token. |
| 61 | 61 | if ($submit_recalc_ratings and is_object($GLOBALS['xoopsSecurity']) and !$GLOBALS['xoopsSecurity']->check()) { |
| 62 | - redirect_header(XOOPS_URL . '/modules/chess/ratings.php', _CHESS_REDIRECT_DELAY_FAILURE, |
|
| 63 | - _MD_CHESS_TOKEN_ERROR . '<br />' . implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 62 | + redirect_header(XOOPS_URL.'/modules/chess/ratings.php', _CHESS_REDIRECT_DELAY_FAILURE, |
|
| 63 | + _MD_CHESS_TOKEN_ERROR.'<br />'.implode('<br />', $GLOBALS['xoopsSecurity']->getErrors())); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $msg = ''; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | // Display the ratings. |
| 82 | 82 | chess_ratings($start, $msg, $msg_class); |
| 83 | 83 | |
| 84 | -require_once XOOPS_ROOT_PATH . '/footer.php'; |
|
| 84 | +require_once XOOPS_ROOT_PATH.'/footer.php'; |
|
| 85 | 85 | /**#@-*/ |
| 86 | 86 | |
| 87 | 87 | /** |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | $xoopsDB->freeRecordSet($result); |
| 144 | 144 | |
| 145 | 145 | // get mapping of user IDs to usernames |
| 146 | - $member_handler =& xoops_gethandler('member'); |
|
| 147 | - $criteria = new Criteria('uid', '(' . implode(',', $userids) . ')', 'IN'); |
|
| 148 | - $usernames = $member_handler->getUserList($criteria); |
|
| 146 | + $member_handler = & xoops_gethandler('member'); |
|
| 147 | + $criteria = new Criteria('uid', '('.implode(',', $userids).')', 'IN'); |
|
| 148 | + $usernames = $member_handler->getUserList($criteria); |
|
| 149 | 149 | |
| 150 | 150 | // add usernames to $players |
| 151 | 151 | foreach ($players as $k => $player) { |
@@ -177,10 +177,10 @@ discard block |
||
| 177 | 177 | // Template variables |
| 178 | 178 | |
| 179 | 179 | $xoopsTpl->assign('chess_provisional_games', chess_ratings_num_provisional_games()); |
| 180 | - $xoopsTpl->assign('chess_msg', $msg); |
|
| 181 | - $xoopsTpl->assign('chess_msg_class', $msg_class); |
|
| 182 | - $xoopsTpl->assign('chess_players_pagenav', $pagenav->renderNav()); |
|
| 183 | - $xoopsTpl->assign('chess_players', $players); |
|
| 180 | + $xoopsTpl->assign('chess_msg', $msg); |
|
| 181 | + $xoopsTpl->assign('chess_msg_class', $msg_class); |
|
| 182 | + $xoopsTpl->assign('chess_players_pagenav', $pagenav->renderNav()); |
|
| 183 | + $xoopsTpl->assign('chess_players', $players); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | ?> |
@@ -53,34 +53,34 @@ discard block |
||
| 53 | 53 | class ChessGame { |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - * Indicates whether object is valid. |
|
| 57 | - * |
|
| 58 | - * If empty string (''), indicates this is a valid object; otherwise contains an error message. |
|
| 56 | + * Indicates whether object is valid. |
|
| 57 | + * |
|
| 58 | + * If empty string (''), indicates this is a valid object; otherwise contains an error message. |
|
| 59 | 59 | * Should be checked after creating an instance of this class. |
| 60 | - * |
|
| 61 | - * @var string $error |
|
| 62 | - */ |
|
| 60 | + * |
|
| 61 | + * @var string $error |
|
| 62 | + */ |
|
| 63 | 63 | var $error; |
| 64 | 64 | |
| 65 | 65 | /** |
| 66 | 66 | * gamestate |
| 67 | 67 | * |
| 68 | - * The game state is represented as an array with the following elements: |
|
| 69 | - * |
|
| 70 | - * - 'fen_piece_placement' |
|
| 71 | - * - 'fen_active_color' |
|
| 72 | - * - 'fen_castling_availability' |
|
| 73 | - * - 'fen_en_passant_target_square' |
|
| 74 | - * - 'fen_halfmove_clock' |
|
| 75 | - * - 'fen_fullmove_number' |
|
| 76 | - * - 'pgn_result' |
|
| 77 | - * - 'pgn_fen' |
|
| 78 | - * - 'pgn_movetext' |
|
| 79 | - * |
|
| 80 | - * The elements prefixed with 'fen_' are standard Forsyth-Edwards Notation (FEN) elements, |
|
| 81 | - * and the elements prefixed with 'pgn_' are standard Portable Game Notation (PGN) elements. |
|
| 82 | - * |
|
| 83 | - * Each element is a string. |
|
| 68 | + * The game state is represented as an array with the following elements: |
|
| 69 | + * |
|
| 70 | + * - 'fen_piece_placement' |
|
| 71 | + * - 'fen_active_color' |
|
| 72 | + * - 'fen_castling_availability' |
|
| 73 | + * - 'fen_en_passant_target_square' |
|
| 74 | + * - 'fen_halfmove_clock' |
|
| 75 | + * - 'fen_fullmove_number' |
|
| 76 | + * - 'pgn_result' |
|
| 77 | + * - 'pgn_fen' |
|
| 78 | + * - 'pgn_movetext' |
|
| 79 | + * |
|
| 80 | + * The elements prefixed with 'fen_' are standard Forsyth-Edwards Notation (FEN) elements, |
|
| 81 | + * and the elements prefixed with 'pgn_' are standard Portable Game Notation (PGN) elements. |
|
| 82 | + * |
|
| 83 | + * Each element is a string. |
|
| 84 | 84 | * |
| 85 | 85 | * @var array $gamestate |
| 86 | 86 | */ |
@@ -89,23 +89,23 @@ discard block |
||
| 89 | 89 | /** |
| 90 | 90 | * board |
| 91 | 91 | * |
| 92 | - * A 64-element array, constructed from fen_piece_placement, is used for handling moves. |
|
| 93 | - * Its indices are related to the standard tile coordinates as follows: |
|
| 94 | - * |
|
| 92 | + * A 64-element array, constructed from fen_piece_placement, is used for handling moves. |
|
| 93 | + * Its indices are related to the standard tile coordinates as follows: |
|
| 94 | + * |
|
| 95 | 95 | * <pre> |
| 96 | - * 8 | 56 57 58 59 60 61 62 63 |
|
| 97 | - * 7 | 48 49 50 51 52 53 54 55 |
|
| 98 | - * 6 | 40 41 42 43 44 45 46 47 |
|
| 99 | - * 5 | 32 33 34 35 36 37 38 39 |
|
| 100 | - * 4 | 24 25 26 27 28 29 30 31 |
|
| 101 | - * 3 | 16 17 18 19 20 21 22 23 |
|
| 102 | - * 2 | 8 9 10 11 12 13 14 15 |
|
| 103 | - * 1 | 0 1 2 3 4 5 6 7 |
|
| 104 | - * ------------------------ |
|
| 105 | - * a b c d e f g h |
|
| 96 | + * 8 | 56 57 58 59 60 61 62 63 |
|
| 97 | + * 7 | 48 49 50 51 52 53 54 55 |
|
| 98 | + * 6 | 40 41 42 43 44 45 46 47 |
|
| 99 | + * 5 | 32 33 34 35 36 37 38 39 |
|
| 100 | + * 4 | 24 25 26 27 28 29 30 31 |
|
| 101 | + * 3 | 16 17 18 19 20 21 22 23 |
|
| 102 | + * 2 | 8 9 10 11 12 13 14 15 |
|
| 103 | + * 1 | 0 1 2 3 4 5 6 7 |
|
| 104 | + * ------------------------ |
|
| 105 | + * a b c d e f g h |
|
| 106 | 106 | * </pre> |
| 107 | - * |
|
| 108 | - * For example, $board[17] is tile b3 and $board[55] is tile h7. |
|
| 107 | + * |
|
| 108 | + * For example, $board[17] is tile b3 and $board[55] is tile h7. |
|
| 109 | 109 | * |
| 110 | 110 | * @var array $board |
| 111 | 111 | */ |
@@ -131,13 +131,13 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | - * updated by handleMove, not used now but might be used in future |
|
| 134 | + * updated by handleMove, not used now but might be used in future |
|
| 135 | 135 | * @var string $last_move |
| 136 | 136 | */ |
| 137 | 137 | var $last_move; |
| 138 | 138 | |
| 139 | 139 | /** |
| 140 | - * updated by handleMove, not used now but might be used in future |
|
| 140 | + * updated by handleMove, not used now but might be used in future |
|
| 141 | 141 | * @var string $captured_piece |
| 142 | 142 | */ |
| 143 | 143 | var $captured_piece; |
@@ -455,65 +455,65 @@ discard block |
||
| 455 | 455 | /* DEBUG: echo "$fx,$fy --> $dx,$dy: "; */ |
| 456 | 456 | switch ( $fig ) |
| 457 | 457 | { |
| 458 | - /* knight */ |
|
| 459 | - case 'N': |
|
| 460 | - if ( abs($fx-$dx)==1 && abs($fy-$dy)==2 ) |
|
| 461 | - $result = 1; |
|
| 462 | - if ( abs($fy-$dy)==1 && abs($fx-$dx)==2 ) |
|
| 463 | - $result = 1; |
|
| 464 | - break; |
|
| 465 | - /* bishop */ |
|
| 466 | - case 'B': |
|
| 467 | - if ( abs($fx-$dx) != abs($fy-$dy) ) |
|
| 468 | - break; |
|
| 469 | - if ( $dy < $fy ) $change = -8; else $change = 8; |
|
| 470 | - if ( $dx < $fx ) $change -= 1; else $change += 1; |
|
| 471 | - if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 472 | - $result = 1; |
|
| 473 | - break; |
|
| 474 | - /* rook */ |
|
| 475 | - case 'R': |
|
| 476 | - if ( $fx!=$dx && $fy!=$dy ) |
|
| 477 | - break; |
|
| 478 | - if ( $fx==$dx ) |
|
| 479 | - { |
|
| 480 | - if ( $dy<$fy ) $change = -8; else $change = 8; |
|
| 481 | - } |
|
| 482 | - else { |
|
| 483 | - if ( $dx<$fx ) $change = -1; else $change = 1; |
|
| 484 | - } |
|
| 485 | - if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 486 | - $result = 1; |
|
| 487 | - break; |
|
| 488 | - /* queen */ |
|
| 489 | - case 'Q': |
|
| 490 | - if ( abs($fx-$dx) != abs($fy-$dy) && $fx!=$dx && $fy!=$dy ) |
|
| 491 | - break; |
|
| 492 | - if ( abs($fx-$dx) == abs($fy-$dy) ) |
|
| 493 | - { |
|
| 494 | - if ( $dy < $fy ) $change = -8; else $change = 8; |
|
| 495 | - if ( $dx < $fx ) $change -= 1; else $change += 1; |
|
| 496 | - } |
|
| 497 | - else if ( $fx==$dx ) { |
|
| 498 | - if ( $dy<$fy ) $change = -8; else $change = 8; |
|
| 499 | - } |
|
| 500 | - else |
|
| 501 | - { |
|
| 502 | - if ( $dx<$fx ) $change = -1; else $change = 1; |
|
| 503 | - } |
|
| 504 | - if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 505 | - $result = 1; |
|
| 506 | - break; |
|
| 507 | - /* king */ |
|
| 508 | - case 'K': |
|
| 509 | - if ( abs($fx-$dx) > 1 || abs($fy-$dy) > 1 ) break; |
|
| 510 | - $kings = 0; |
|
| 511 | - $adj_tiles = $this->getAdjTiles( $dest_pos ); |
|
| 512 | - foreach( $adj_tiles as $tile ) |
|
| 513 | - if ($this->board[$tile]{1} == 'K' ) $kings++; |
|
| 514 | - if ( $kings == 2 ) break; |
|
| 515 | - $result = 1; |
|
| 516 | - break; |
|
| 458 | + /* knight */ |
|
| 459 | + case 'N': |
|
| 460 | + if ( abs($fx-$dx)==1 && abs($fy-$dy)==2 ) |
|
| 461 | + $result = 1; |
|
| 462 | + if ( abs($fy-$dy)==1 && abs($fx-$dx)==2 ) |
|
| 463 | + $result = 1; |
|
| 464 | + break; |
|
| 465 | + /* bishop */ |
|
| 466 | + case 'B': |
|
| 467 | + if ( abs($fx-$dx) != abs($fy-$dy) ) |
|
| 468 | + break; |
|
| 469 | + if ( $dy < $fy ) $change = -8; else $change = 8; |
|
| 470 | + if ( $dx < $fx ) $change -= 1; else $change += 1; |
|
| 471 | + if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 472 | + $result = 1; |
|
| 473 | + break; |
|
| 474 | + /* rook */ |
|
| 475 | + case 'R': |
|
| 476 | + if ( $fx!=$dx && $fy!=$dy ) |
|
| 477 | + break; |
|
| 478 | + if ( $fx==$dx ) |
|
| 479 | + { |
|
| 480 | + if ( $dy<$fy ) $change = -8; else $change = 8; |
|
| 481 | + } |
|
| 482 | + else { |
|
| 483 | + if ( $dx<$fx ) $change = -1; else $change = 1; |
|
| 484 | + } |
|
| 485 | + if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 486 | + $result = 1; |
|
| 487 | + break; |
|
| 488 | + /* queen */ |
|
| 489 | + case 'Q': |
|
| 490 | + if ( abs($fx-$dx) != abs($fy-$dy) && $fx!=$dx && $fy!=$dy ) |
|
| 491 | + break; |
|
| 492 | + if ( abs($fx-$dx) == abs($fy-$dy) ) |
|
| 493 | + { |
|
| 494 | + if ( $dy < $fy ) $change = -8; else $change = 8; |
|
| 495 | + if ( $dx < $fx ) $change -= 1; else $change += 1; |
|
| 496 | + } |
|
| 497 | + else if ( $fx==$dx ) { |
|
| 498 | + if ( $dy<$fy ) $change = -8; else $change = 8; |
|
| 499 | + } |
|
| 500 | + else |
|
| 501 | + { |
|
| 502 | + if ( $dx<$fx ) $change = -1; else $change = 1; |
|
| 503 | + } |
|
| 504 | + if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 505 | + $result = 1; |
|
| 506 | + break; |
|
| 507 | + /* king */ |
|
| 508 | + case 'K': |
|
| 509 | + if ( abs($fx-$dx) > 1 || abs($fy-$dy) > 1 ) break; |
|
| 510 | + $kings = 0; |
|
| 511 | + $adj_tiles = $this->getAdjTiles( $dest_pos ); |
|
| 512 | + foreach( $adj_tiles as $tile ) |
|
| 513 | + if ($this->board[$tile]{1} == 'K' ) $kings++; |
|
| 514 | + if ( $kings == 2 ) break; |
|
| 515 | + $result = 1; |
|
| 516 | + break; |
|
| 517 | 517 | } |
| 518 | 518 | |
| 519 | 519 | /* DEBUG: echo " $result<BR>"; */ |
@@ -533,17 +533,17 @@ discard block |
||
| 533 | 533 | { |
| 534 | 534 | if ( $this->board[$fig_pos]{0} == 'w' ) |
| 535 | 535 | { |
| 536 | - if ( ($fig_pos % 8) > 0 && $dest_pos == $fig_pos+7 ) |
|
| 537 | - return 1; |
|
| 538 | - if ( ($fig_pos % 8) < 7 && $dest_pos == $fig_pos+9 ) |
|
| 539 | - return 1; |
|
| 536 | + if ( ($fig_pos % 8) > 0 && $dest_pos == $fig_pos+7 ) |
|
| 537 | + return 1; |
|
| 538 | + if ( ($fig_pos % 8) < 7 && $dest_pos == $fig_pos+9 ) |
|
| 539 | + return 1; |
|
| 540 | 540 | } |
| 541 | 541 | else if ( $this->board[$fig_pos]{0} == 'b' ) |
| 542 | 542 | { |
| 543 | - if ( ($fig_pos % 8) < 7 && $dest_pos == $fig_pos-7 ) |
|
| 544 | - return 1; |
|
| 545 | - if ( ($fig_pos % 8) > 0 && $dest_pos == $fig_pos-9 ) |
|
| 546 | - return 1; |
|
| 543 | + if ( ($fig_pos % 8) < 7 && $dest_pos == $fig_pos-7 ) |
|
| 544 | + return 1; |
|
| 545 | + if ( ($fig_pos % 8) > 0 && $dest_pos == $fig_pos-9 ) |
|
| 546 | + return 1; |
|
| 547 | 547 | } |
| 548 | 548 | return 0; |
| 549 | 549 | } |
@@ -568,23 +568,23 @@ discard block |
||
| 568 | 568 | |
| 569 | 569 | if ( $this->board[$fig_pos]{0} == 'w' ) |
| 570 | 570 | { |
| 571 | - if ( $fig_pos >= 8 && $fig_pos <= 15 ) |
|
| 572 | - $first_move = 1; |
|
| 573 | - if ( $dest_pos==$fig_pos+8 ) |
|
| 574 | - return 1; |
|
| 575 | - if ( $first_move && ( $dest_pos==$fig_pos+16 ) ) |
|
| 576 | - if ($this->is_empty_tile($fig_pos + 8)) |
|
| 577 | - return 1; |
|
| 571 | + if ( $fig_pos >= 8 && $fig_pos <= 15 ) |
|
| 572 | + $first_move = 1; |
|
| 573 | + if ( $dest_pos==$fig_pos+8 ) |
|
| 574 | + return 1; |
|
| 575 | + if ( $first_move && ( $dest_pos==$fig_pos+16 ) ) |
|
| 576 | + if ($this->is_empty_tile($fig_pos + 8)) |
|
| 577 | + return 1; |
|
| 578 | 578 | } |
| 579 | 579 | else if ($this->board[$fig_pos]{0} == 'b' ) |
| 580 | 580 | { |
| 581 | - if ( $fig_pos >= 48 && $fig_pos <= 55 ) |
|
| 582 | - $first_move = 1; |
|
| 583 | - if ( $dest_pos==$fig_pos-8 ) |
|
| 584 | - return 1; |
|
| 585 | - if ( $first_move && ( $dest_pos==$fig_pos-16 ) ) |
|
| 586 | - if ($this->is_empty_tile($fig_pos - 8)) |
|
| 587 | - return 1; |
|
| 581 | + if ( $fig_pos >= 48 && $fig_pos <= 55 ) |
|
| 582 | + $first_move = 1; |
|
| 583 | + if ( $dest_pos==$fig_pos-8 ) |
|
| 584 | + return 1; |
|
| 585 | + if ( $first_move && ( $dest_pos==$fig_pos-16 ) ) |
|
| 586 | + if ($this->is_empty_tile($fig_pos - 8)) |
|
| 587 | + return 1; |
|
| 588 | 588 | } |
| 589 | 589 | return 0; |
| 590 | 590 | } |
@@ -602,16 +602,16 @@ discard block |
||
| 602 | 602 | { |
| 603 | 603 | #var_dump('tileIsUnderAttack, opp', $opp, 'dest_pos', $dest_pos, 'board', $board);#*#DEBUG# |
| 604 | 604 | for ( $i = 0; $i < 64; $i++ ) |
| 605 | - if ($this->board[$i]{0} == $opp ) |
|
| 606 | - { |
|
| 607 | - if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$dest_pos)) || |
|
| 608 | - ($this->board[$i]{1}!='P' && |
|
| 609 | - $this->tileIsReachable($this->board[$i]{1},$i,$dest_pos)) ) |
|
| 610 | - { |
|
| 611 | - /*DEBUG: echo "attack test: $i: ",$opp,"P<BR>"; */ |
|
| 612 | - return 1; |
|
| 613 | - } |
|
| 614 | - } |
|
| 605 | + if ($this->board[$i]{0} == $opp ) |
|
| 606 | + { |
|
| 607 | + if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$dest_pos)) || |
|
| 608 | + ($this->board[$i]{1}!='P' && |
|
| 609 | + $this->tileIsReachable($this->board[$i]{1},$i,$dest_pos)) ) |
|
| 610 | + { |
|
| 611 | + /*DEBUG: echo "attack test: $i: ",$opp,"P<BR>"; */ |
|
| 612 | + return 1; |
|
| 613 | + } |
|
| 614 | + } |
|
| 615 | 615 | return 0; |
| 616 | 616 | } |
| 617 | 617 | |
@@ -629,11 +629,11 @@ discard block |
||
| 629 | 629 | |
| 630 | 630 | #var_dump('kingIsUnderAttack, player', $player, 'opp', $opp, 'board', $board);#*#DEBUG# |
| 631 | 631 | for ( $i = 0; $i < 64; $i++ ) |
| 632 | - if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K' ) |
|
| 633 | - { |
|
| 634 | - $king_pos = $i; |
|
| 635 | - break; |
|
| 636 | - } |
|
| 632 | + if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K' ) |
|
| 633 | + { |
|
| 634 | + $king_pos = $i; |
|
| 635 | + break; |
|
| 636 | + } |
|
| 637 | 637 | /*DEBUG: echo "$player king is at $king_pos<BR>"; */ |
| 638 | 638 | |
| 639 | 639 | return $this->tileIsUnderAttack( $opp, $king_pos ); |
@@ -651,23 +651,23 @@ discard block |
||
| 651 | 651 | function isCheckMate($player, $opp) |
| 652 | 652 | { |
| 653 | 653 | for ( $i = 0; $i < 64; $i++ ) |
| 654 | - if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K' ) |
|
| 655 | - { |
|
| 656 | - $king_pos = $i; |
|
| 657 | - $king_x = $i % 8; |
|
| 658 | - $king_y = floor($i/8); |
|
| 659 | - break; |
|
| 660 | - } |
|
| 654 | + if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K' ) |
|
| 655 | + { |
|
| 656 | + $king_pos = $i; |
|
| 657 | + $king_x = $i % 8; |
|
| 658 | + $king_y = floor($i/8); |
|
| 659 | + break; |
|
| 660 | + } |
|
| 661 | 661 | |
| 662 | 662 | /* test adjacent tiles while king is temporarly removed */ |
| 663 | 663 | $adj_tiles = $this->getAdjTiles( $king_pos ); |
| 664 | 664 | $contents = $this->board[$king_pos]; $this->clear_tile($king_pos); |
| 665 | 665 | foreach ( $adj_tiles as $dest_pos ) |
| 666 | 666 | { |
| 667 | - if ($this->board[$dest_pos]{0} == $player ) continue; |
|
| 668 | - if ( $this->tileIsUnderAttack($opp,$dest_pos) ) continue; |
|
| 669 | - $this->board[$king_pos] = $contents; |
|
| 670 | - return 0; |
|
| 667 | + if ($this->board[$dest_pos]{0} == $player ) continue; |
|
| 668 | + if ( $this->tileIsUnderAttack($opp,$dest_pos) ) continue; |
|
| 669 | + $this->board[$king_pos] = $contents; |
|
| 670 | + return 0; |
|
| 671 | 671 | } |
| 672 | 672 | $this->board[$king_pos] = $contents; |
| 673 | 673 | |
@@ -676,15 +676,15 @@ discard block |
||
| 676 | 676 | /* get all figures that attack the king */ |
| 677 | 677 | $attackers = array(); $count = 0; |
| 678 | 678 | for ( $i = 0; $i < 64; $i++ ) |
| 679 | - if ( $this->board[$i]{0} == $opp ) |
|
| 680 | - { |
|
| 681 | - if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$king_pos)) || |
|
| 682 | - ($this->board[$i]{1}!='P' && |
|
| 683 | - $this->tileIsReachable($this->board[$i]{1},$i,$king_pos)) ) |
|
| 684 | - { |
|
| 685 | - $attackers[$count++] = $i; |
|
| 686 | - } |
|
| 687 | - } |
|
| 679 | + if ( $this->board[$i]{0} == $opp ) |
|
| 680 | + { |
|
| 681 | + if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$king_pos)) || |
|
| 682 | + ($this->board[$i]{1}!='P' && |
|
| 683 | + $this->tileIsReachable($this->board[$i]{1},$i,$king_pos)) ) |
|
| 684 | + { |
|
| 685 | + $attackers[$count++] = $i; |
|
| 686 | + } |
|
| 687 | + } |
|
| 688 | 688 | /* DEBUG: |
| 689 | 689 | for( $i = 0; $i < $count; $i++ ) |
| 690 | 690 | echo "Attacker: $attackers[$i] "; |
@@ -696,32 +696,32 @@ discard block |
||
| 696 | 696 | /* check whether attacker can be killed by own figure */ |
| 697 | 697 | $dest_pos = $attackers[0]; |
| 698 | 698 | for ( $i = 0; $i < 64; $i++ ) |
| 699 | - if ( $this->board[$i]{0} == $player ) |
|
| 700 | - { |
|
| 701 | - if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$dest_pos)) || |
|
| 702 | - ($this->board[$i]{1}!='P' && $this->board[$i]{1}!='K' && |
|
| 703 | - $this->tileIsReachable($this->board[$i]{1},$i,$dest_pos)) || |
|
| 704 | - ($this->board[$i]{1}=='K' && |
|
| 705 | - $this->tileIsReachable($this->board[$i]{1},$i,$dest_pos) && |
|
| 706 | - !$this->tileIsUnderAttack($opp,$dest_pos)) ) |
|
| 707 | - { |
|
| 708 | - /* DEBUG: echo "candidate: $i "; */ |
|
| 709 | - $can_kill_atk = 0; |
|
| 710 | - $contents_def = $this->board[$i]; |
|
| 711 | - $contents_atk = $this->board[$dest_pos]; |
|
| 712 | - $this->board[$dest_pos] = $this->board[$i]; |
|
| 713 | - $this->clear_tile($i); |
|
| 714 | - if ( !$this->tileIsUnderAttack($opp,$king_pos) ) |
|
| 715 | - $can_kill_atk = 1; |
|
| 716 | - $this->board[$i] = $contents_def; |
|
| 717 | - $this->board[$dest_pos] = $contents_atk; |
|
| 718 | - if ( $can_kill_atk ) |
|
| 719 | - { |
|
| 720 | - /* DEBUG: echo "$i can kill attacker"; */ |
|
| 721 | - return 0; |
|
| 722 | - } |
|
| 723 | - } |
|
| 724 | - } |
|
| 699 | + if ( $this->board[$i]{0} == $player ) |
|
| 700 | + { |
|
| 701 | + if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$dest_pos)) || |
|
| 702 | + ($this->board[$i]{1}!='P' && $this->board[$i]{1}!='K' && |
|
| 703 | + $this->tileIsReachable($this->board[$i]{1},$i,$dest_pos)) || |
|
| 704 | + ($this->board[$i]{1}=='K' && |
|
| 705 | + $this->tileIsReachable($this->board[$i]{1},$i,$dest_pos) && |
|
| 706 | + !$this->tileIsUnderAttack($opp,$dest_pos)) ) |
|
| 707 | + { |
|
| 708 | + /* DEBUG: echo "candidate: $i "; */ |
|
| 709 | + $can_kill_atk = 0; |
|
| 710 | + $contents_def = $this->board[$i]; |
|
| 711 | + $contents_atk = $this->board[$dest_pos]; |
|
| 712 | + $this->board[$dest_pos] = $this->board[$i]; |
|
| 713 | + $this->clear_tile($i); |
|
| 714 | + if ( !$this->tileIsUnderAttack($opp,$king_pos) ) |
|
| 715 | + $can_kill_atk = 1; |
|
| 716 | + $this->board[$i] = $contents_def; |
|
| 717 | + $this->board[$dest_pos] = $contents_atk; |
|
| 718 | + if ( $can_kill_atk ) |
|
| 719 | + { |
|
| 720 | + /* DEBUG: echo "$i can kill attacker"; */ |
|
| 721 | + return 0; |
|
| 722 | + } |
|
| 723 | + } |
|
| 724 | + } |
|
| 725 | 725 | |
| 726 | 726 | /* check whether own unit can block the way */ |
| 727 | 727 | |
@@ -734,7 +734,7 @@ discard block |
||
| 734 | 734 | $dest_x = $dest_pos % 8; |
| 735 | 735 | $dest_y = floor($dest_pos/8); |
| 736 | 736 | if ( abs($dest_x-$king_x)<=1 && abs($dest_y-$king_y)<=1 ) |
| 737 | - return 1; |
|
| 737 | + return 1; |
|
| 738 | 738 | |
| 739 | 739 | /* get the list of tiles between king and attacking |
| 740 | 740 | * unit that can be blocked to stop the attack */ |
@@ -744,17 +744,17 @@ discard block |
||
| 744 | 744 | /* DEBUG: foreach( $path as $tile ) echo "tile: $tile "; */ |
| 745 | 745 | foreach( $path as $pos ) |
| 746 | 746 | { |
| 747 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 748 | - if ( $this->board[$i]{0} == $player ) |
|
| 749 | - { |
|
| 750 | - if ( ($this->board[$i]{1}=='P' && $this->checkPawnMove($i,$pos)) || |
|
| 751 | - ($this->board[$i]{1}!='P' && $this->board[$i]{1}!='K' && |
|
| 752 | - $this->tileIsReachable($this->board[$i]{1},$i,$pos)) ) |
|
| 753 | - { |
|
| 754 | - /* DEBUG: echo "$i can block "; */ |
|
| 755 | - return 0; |
|
| 756 | - } |
|
| 757 | - } |
|
| 747 | + for ( $i = 0; $i < 64; $i++ ) |
|
| 748 | + if ( $this->board[$i]{0} == $player ) |
|
| 749 | + { |
|
| 750 | + if ( ($this->board[$i]{1}=='P' && $this->checkPawnMove($i,$pos)) || |
|
| 751 | + ($this->board[$i]{1}!='P' && $this->board[$i]{1}!='K' && |
|
| 752 | + $this->tileIsReachable($this->board[$i]{1},$i,$pos)) ) |
|
| 753 | + { |
|
| 754 | + /* DEBUG: echo "$i can block "; */ |
|
| 755 | + return 0; |
|
| 756 | + } |
|
| 757 | + } |
|
| 758 | 758 | } |
| 759 | 759 | return 1; |
| 760 | 760 | } |
@@ -773,62 +773,62 @@ discard block |
||
| 773 | 773 | function isStaleMate($player, $opp) |
| 774 | 774 | { |
| 775 | 775 | for ( $i = 0; $i < 64; $i++ ) |
| 776 | - if ($this->board[$i]{0} == $player ) |
|
| 777 | - switch ($this->board[$i]{1} ) |
|
| 778 | - { |
|
| 779 | - case 'K': |
|
| 780 | - $adj_tiles = $this->getAdjTiles( $i ); |
|
| 781 | - foreach ( $adj_tiles as $pos ) |
|
| 782 | - { |
|
| 783 | - if ( $this->board[$pos]{0} == $player ) continue; |
|
| 784 | - if ( $this->tileIsUnderAttack($opp,$pos) ) continue; |
|
| 785 | - return 0; |
|
| 786 | - } |
|
| 787 | - /* DEBUG: echo "King cannot escape by itself! "; */ |
|
| 788 | - break; |
|
| 789 | - case 'P': |
|
| 790 | - if ( $player == 'w' ) |
|
| 791 | - { |
|
| 792 | - if ($this->is_empty_tile($i + 8)) return 0; |
|
| 793 | - if ( ($i%8) > 0 && $this->board[$i+7]{0} != $player ) return 0; |
|
| 794 | - if ( ($i%8) < 7 && $this->board[$i+9]{0} != $player ) return 0; |
|
| 795 | - } |
|
| 796 | - else |
|
| 797 | - { |
|
| 798 | - if ($this->is_empty_tile($i - 8)) return 0; |
|
| 799 | - if ( ($i%8) > 0 && $this->board[$i-9]{0} != $player ) return 0; |
|
| 800 | - if ( ($i%8) < 7 && $this->board[$i-7]{0} != $player ) return 0; |
|
| 801 | - } |
|
| 802 | - break; |
|
| 803 | - case 'B': |
|
| 804 | - if ( $i-9 >= 0 && $this->board[$i-9]{0} != $player ) return 0; |
|
| 805 | - if ( $i-7 >= 0 && $this->board[$i-7]{0} != $player ) return 0; |
|
| 806 | - if ( $i+9 <= 63 && $this->board[$i+9]{0} != $player ) return 0; |
|
| 807 | - if ( $i+7 <= 63 && $this->board[$i+7]{0} != $player ) return 0; |
|
| 808 | - break; |
|
| 809 | - case 'R': |
|
| 810 | - if ( $i-8 >= 0 && $this->board[$i-8]{0} != $player ) return 0; |
|
| 811 | - if ( $i-1 >= 0 && $this->board[$i-1]{0} != $player ) return 0; |
|
| 812 | - if ( $i+8 <= 63 && $this->board[$i+8]{0} != $player ) return 0; |
|
| 813 | - if ( $i+1 <= 63 && $this->board[$i+1]{0} != $player ) return 0; |
|
| 814 | - break; |
|
| 815 | - case 'Q': |
|
| 816 | - $adj_tiles = $this->getAdjTiles( $i ); |
|
| 817 | - foreach ( $adj_tiles as $pos ) |
|
| 818 | - if ( $this->board[$pos]{0} != $player ) |
|
| 819 | - return 0; |
|
| 820 | - break; |
|
| 821 | - case 'N': |
|
| 822 | - if ( $i-17 >= 0 && $this->board[$i-17]{0} != $player ) return 0; |
|
| 823 | - if ( $i-15 >= 0 && $this->board[$i-15]{0} != $player ) return 0; |
|
| 824 | - if ( $i-6 >= 0 && $this->board[$i-6]{0} != $player ) return 0; |
|
| 825 | - if ( $i+10 <= 63 && $this->board[$i+10]{0} != $player ) return 0; |
|
| 826 | - if ( $i+17 <= 63 && $this->board[$i+17]{0} != $player ) return 0; |
|
| 827 | - if ( $i+15 <= 63 && $this->board[$i+15]{0} != $player ) return 0; |
|
| 828 | - if ( $i+6 <= 63 && $this->board[$i+6]{0} != $player ) return 0; |
|
| 829 | - if ( $i-10 >= 0 && $this->board[$i-10]{0} != $player ) return 0; |
|
| 830 | - break; |
|
| 831 | - } |
|
| 776 | + if ($this->board[$i]{0} == $player ) |
|
| 777 | + switch ($this->board[$i]{1} ) |
|
| 778 | + { |
|
| 779 | + case 'K': |
|
| 780 | + $adj_tiles = $this->getAdjTiles( $i ); |
|
| 781 | + foreach ( $adj_tiles as $pos ) |
|
| 782 | + { |
|
| 783 | + if ( $this->board[$pos]{0} == $player ) continue; |
|
| 784 | + if ( $this->tileIsUnderAttack($opp,$pos) ) continue; |
|
| 785 | + return 0; |
|
| 786 | + } |
|
| 787 | + /* DEBUG: echo "King cannot escape by itself! "; */ |
|
| 788 | + break; |
|
| 789 | + case 'P': |
|
| 790 | + if ( $player == 'w' ) |
|
| 791 | + { |
|
| 792 | + if ($this->is_empty_tile($i + 8)) return 0; |
|
| 793 | + if ( ($i%8) > 0 && $this->board[$i+7]{0} != $player ) return 0; |
|
| 794 | + if ( ($i%8) < 7 && $this->board[$i+9]{0} != $player ) return 0; |
|
| 795 | + } |
|
| 796 | + else |
|
| 797 | + { |
|
| 798 | + if ($this->is_empty_tile($i - 8)) return 0; |
|
| 799 | + if ( ($i%8) > 0 && $this->board[$i-9]{0} != $player ) return 0; |
|
| 800 | + if ( ($i%8) < 7 && $this->board[$i-7]{0} != $player ) return 0; |
|
| 801 | + } |
|
| 802 | + break; |
|
| 803 | + case 'B': |
|
| 804 | + if ( $i-9 >= 0 && $this->board[$i-9]{0} != $player ) return 0; |
|
| 805 | + if ( $i-7 >= 0 && $this->board[$i-7]{0} != $player ) return 0; |
|
| 806 | + if ( $i+9 <= 63 && $this->board[$i+9]{0} != $player ) return 0; |
|
| 807 | + if ( $i+7 <= 63 && $this->board[$i+7]{0} != $player ) return 0; |
|
| 808 | + break; |
|
| 809 | + case 'R': |
|
| 810 | + if ( $i-8 >= 0 && $this->board[$i-8]{0} != $player ) return 0; |
|
| 811 | + if ( $i-1 >= 0 && $this->board[$i-1]{0} != $player ) return 0; |
|
| 812 | + if ( $i+8 <= 63 && $this->board[$i+8]{0} != $player ) return 0; |
|
| 813 | + if ( $i+1 <= 63 && $this->board[$i+1]{0} != $player ) return 0; |
|
| 814 | + break; |
|
| 815 | + case 'Q': |
|
| 816 | + $adj_tiles = $this->getAdjTiles( $i ); |
|
| 817 | + foreach ( $adj_tiles as $pos ) |
|
| 818 | + if ( $this->board[$pos]{0} != $player ) |
|
| 819 | + return 0; |
|
| 820 | + break; |
|
| 821 | + case 'N': |
|
| 822 | + if ( $i-17 >= 0 && $this->board[$i-17]{0} != $player ) return 0; |
|
| 823 | + if ( $i-15 >= 0 && $this->board[$i-15]{0} != $player ) return 0; |
|
| 824 | + if ( $i-6 >= 0 && $this->board[$i-6]{0} != $player ) return 0; |
|
| 825 | + if ( $i+10 <= 63 && $this->board[$i+10]{0} != $player ) return 0; |
|
| 826 | + if ( $i+17 <= 63 && $this->board[$i+17]{0} != $player ) return 0; |
|
| 827 | + if ( $i+15 <= 63 && $this->board[$i+15]{0} != $player ) return 0; |
|
| 828 | + if ( $i+6 <= 63 && $this->board[$i+6]{0} != $player ) return 0; |
|
| 829 | + if ( $i-10 >= 0 && $this->board[$i-10]{0} != $player ) return 0; |
|
| 830 | + break; |
|
| 831 | + } |
|
| 832 | 832 | |
| 833 | 833 | return 1; |
| 834 | 834 | } |
@@ -890,12 +890,12 @@ discard block |
||
| 890 | 890 | |
| 891 | 891 | if ( strlen($move)>=6 ) |
| 892 | 892 | { |
| 893 | - /* full move: a pawn requires a ? in the end |
|
| 893 | + /* full move: a pawn requires a ? in the end |
|
| 894 | 894 | * to automatically choose a queen on last line */ |
| 895 | - if ( $move[0] == 'P' ) |
|
| 896 | - if ( $move[strlen($move)-1]<'A' || $move[strlen($move)-1]>'Z' ) |
|
| 897 | - $this->ac_move = "$move?"; |
|
| 898 | - return ""; |
|
| 895 | + if ( $move[0] == 'P' ) |
|
| 896 | + if ( $move[strlen($move)-1]<'A' || $move[strlen($move)-1]>'Z' ) |
|
| 897 | + $this->ac_move = "$move?"; |
|
| 898 | + return ""; |
|
| 899 | 899 | } |
| 900 | 900 | |
| 901 | 901 | /* allow last letter to be a capital one indicating |
@@ -905,186 +905,186 @@ discard block |
||
| 905 | 905 | $pawn_upg = "?"; |
| 906 | 906 | if ( $move[strlen($move)-1]>='A' && $move[strlen($move)-1]<='Z' ) |
| 907 | 907 | { |
| 908 | - $pawn_upg = $move[strlen($move)-1]; |
|
| 909 | - $move = substr( $move, 0, strlen($move)-1 ); |
|
| 908 | + $pawn_upg = $move[strlen($move)-1]; |
|
| 909 | + $move = substr( $move, 0, strlen($move)-1 ); |
|
| 910 | 910 | } |
| 911 | 911 | // remove trailing '=', if present |
| 912 | 912 | if ($move{strlen($move)-1} == '=') { |
| 913 | - $move = substr($move, 0, strlen($move)-1); |
|
| 913 | + $move = substr($move, 0, strlen($move)-1); |
|
| 914 | 914 | } |
| 915 | 915 | if ( $pawn_upg == "P" || $pawn_upg == "K" ) |
| 916 | - return _MD_CHESS_MOVE_PAWN_MAY_BECOME; // "A pawn may only become either a knight, a bishop, a rook or a queen!" |
|
| 916 | + return _MD_CHESS_MOVE_PAWN_MAY_BECOME; // "A pawn may only become either a knight, a bishop, a rook or a queen!" |
|
| 917 | 917 | |
| 918 | 918 | if ( $move[0]>='a' && $move[0]<='h' ) |
| 919 | 919 | { |
| 920 | - /* pawn move. either it's 2 or for characters as |
|
| 920 | + /* pawn move. either it's 2 or for characters as |
|
| 921 | 921 | * listed above */ |
| 922 | - if ( strlen($move) == 4 ) |
|
| 923 | - { |
|
| 924 | - if ( $move[1] != 'x' ) |
|
| 925 | - return _MD_CHESS_MOVE_USE_X; // "use x to indicate an attack" |
|
| 926 | - $dest_x = $move[2]; |
|
| 927 | - $dest_y = $move[3]; |
|
| 928 | - $src_x = $move[0]; |
|
| 929 | - if ( $player == 'w' ) |
|
| 930 | - $src_y = $dest_y-1; |
|
| 931 | - else |
|
| 932 | - $src_y = $dest_y+1; |
|
| 933 | - $this->ac_move = sprintf( "P%s%dx%s%d%s", |
|
| 934 | - $src_x,$src_y,$dest_x,$dest_y, |
|
| 935 | - $pawn_upg ); |
|
| 936 | - return ""; |
|
| 937 | - } |
|
| 938 | - else |
|
| 939 | - if (strlen($move) == 2 ) |
|
| 940 | - { |
|
| 941 | - $fig = sprintf( "%sP", $player ); |
|
| 942 | - if ( $move[1] >= '1' && $move[1] <= '8' ) |
|
| 943 | - { |
|
| 944 | - /* pawn move */ |
|
| 945 | - $pos = $this->boardCoordToIndex( $move ); |
|
| 946 | - if ( $pos == 64 ) return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move); // "coordinate $move is invalid" |
|
| 947 | - if ( $player == 'w' ) |
|
| 948 | - { |
|
| 949 | - while( $pos >= 0 && $this->board[$pos] != $fig ) $pos -= 8; |
|
| 950 | - if ( $pos < 0 ) $not_found = 1; |
|
| 951 | - } |
|
| 952 | - else |
|
| 953 | - { |
|
| 954 | - while( $pos <= 63 && $this->board[$pos] != $fig ) $pos += 8; |
|
| 955 | - if ( $pos > 63 ) $not_found = 1; |
|
| 956 | - } |
|
| 957 | - $pos = $this->boardIndexToCoord( $pos ); |
|
| 958 | - if ( (isset($not_found) && $not_found) || $pos == "" ) { |
|
| 959 | - return $this->move_msg(_MD_CHESS_MOVE_CANNOT_FIND_PAWN, $player, $move[0]); // "cannot find $player pawn in column $move[0]" |
|
| 960 | - } else { |
|
| 961 | - $this->ac_move = sprintf( "P%s-%s%s", $pos, $move, $pawn_upg ); |
|
| 962 | - return ""; |
|
| 963 | - } |
|
| 964 | - } |
|
| 965 | - else |
|
| 966 | - { |
|
| 967 | - /* notation: [a-h][a-h] for pawn attack no longer allowed |
|
| 922 | + if ( strlen($move) == 4 ) |
|
| 923 | + { |
|
| 924 | + if ( $move[1] != 'x' ) |
|
| 925 | + return _MD_CHESS_MOVE_USE_X; // "use x to indicate an attack" |
|
| 926 | + $dest_x = $move[2]; |
|
| 927 | + $dest_y = $move[3]; |
|
| 928 | + $src_x = $move[0]; |
|
| 929 | + if ( $player == 'w' ) |
|
| 930 | + $src_y = $dest_y-1; |
|
| 931 | + else |
|
| 932 | + $src_y = $dest_y+1; |
|
| 933 | + $this->ac_move = sprintf( "P%s%dx%s%d%s", |
|
| 934 | + $src_x,$src_y,$dest_x,$dest_y, |
|
| 935 | + $pawn_upg ); |
|
| 936 | + return ""; |
|
| 937 | + } |
|
| 938 | + else |
|
| 939 | + if (strlen($move) == 2 ) |
|
| 940 | + { |
|
| 941 | + $fig = sprintf( "%sP", $player ); |
|
| 942 | + if ( $move[1] >= '1' && $move[1] <= '8' ) |
|
| 943 | + { |
|
| 944 | + /* pawn move */ |
|
| 945 | + $pos = $this->boardCoordToIndex( $move ); |
|
| 946 | + if ( $pos == 64 ) return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move); // "coordinate $move is invalid" |
|
| 947 | + if ( $player == 'w' ) |
|
| 948 | + { |
|
| 949 | + while( $pos >= 0 && $this->board[$pos] != $fig ) $pos -= 8; |
|
| 950 | + if ( $pos < 0 ) $not_found = 1; |
|
| 951 | + } |
|
| 952 | + else |
|
| 953 | + { |
|
| 954 | + while( $pos <= 63 && $this->board[$pos] != $fig ) $pos += 8; |
|
| 955 | + if ( $pos > 63 ) $not_found = 1; |
|
| 956 | + } |
|
| 957 | + $pos = $this->boardIndexToCoord( $pos ); |
|
| 958 | + if ( (isset($not_found) && $not_found) || $pos == "" ) { |
|
| 959 | + return $this->move_msg(_MD_CHESS_MOVE_CANNOT_FIND_PAWN, $player, $move[0]); // "cannot find $player pawn in column $move[0]" |
|
| 960 | + } else { |
|
| 961 | + $this->ac_move = sprintf( "P%s-%s%s", $pos, $move, $pawn_upg ); |
|
| 962 | + return ""; |
|
| 963 | + } |
|
| 964 | + } |
|
| 965 | + else |
|
| 966 | + { |
|
| 967 | + /* notation: [a-h][a-h] for pawn attack no longer allowed |
|
| 968 | 968 | * except for history browser */ |
| 969 | - if ( $this->browsing_mode == 0 ) |
|
| 970 | - return _MD_CHESS_MOVE_USE_NOTATION; // "please use denotation [a-h]x[a-h][1-8] for pawn attacks (see help for more information)" |
|
| 971 | - /* pawn attack must be only one pawn in column! */ |
|
| 972 | - $pawns = 0; |
|
| 973 | - $start = $this->boardCoordToIndex( sprintf( "%s1", $move[0] ) ); |
|
| 974 | - if ( $start == 64 ) return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move[0]); // "coordinate $move[0] is invalid" |
|
| 975 | - for ( $i = 1; $i <= 8; $i++, $start+=8 ) |
|
| 976 | - if ( $this->board[$start] == $fig ) |
|
| 977 | - { |
|
| 978 | - $pawns++; |
|
| 979 | - $pawn_line = $i; |
|
| 980 | - } |
|
| 981 | - if ( $pawns == 0 ) |
|
| 982 | - return $this->move_msg(_MD_CHESS_MOVE_NO_PAWN, $move[0]); // "there is no pawn in column $move[0]" |
|
| 983 | - else if ( $pawns > 1 ) |
|
| 984 | - return $this->move_msg(_MD_CHESS_MOVE_TWO_PAWNS, $move[0]); // "there is more than one pawn in column $move[0]" |
|
| 985 | - else |
|
| 986 | - { |
|
| 987 | - if ( $player == 'w' ) |
|
| 988 | - $dest_line = $pawn_line+1; |
|
| 989 | - else |
|
| 990 | - $dest_line = $pawn_line-1; |
|
| 991 | - $this->ac_move = sprintf( "P%s%dx%s%d", |
|
| 992 | - $move[0],$pawn_line,$move[1],$dest_line ); |
|
| 993 | - return ""; |
|
| 994 | - } |
|
| 995 | - } |
|
| 996 | - } |
|
| 969 | + if ( $this->browsing_mode == 0 ) |
|
| 970 | + return _MD_CHESS_MOVE_USE_NOTATION; // "please use denotation [a-h]x[a-h][1-8] for pawn attacks (see help for more information)" |
|
| 971 | + /* pawn attack must be only one pawn in column! */ |
|
| 972 | + $pawns = 0; |
|
| 973 | + $start = $this->boardCoordToIndex( sprintf( "%s1", $move[0] ) ); |
|
| 974 | + if ( $start == 64 ) return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move[0]); // "coordinate $move[0] is invalid" |
|
| 975 | + for ( $i = 1; $i <= 8; $i++, $start+=8 ) |
|
| 976 | + if ( $this->board[$start] == $fig ) |
|
| 977 | + { |
|
| 978 | + $pawns++; |
|
| 979 | + $pawn_line = $i; |
|
| 980 | + } |
|
| 981 | + if ( $pawns == 0 ) |
|
| 982 | + return $this->move_msg(_MD_CHESS_MOVE_NO_PAWN, $move[0]); // "there is no pawn in column $move[0]" |
|
| 983 | + else if ( $pawns > 1 ) |
|
| 984 | + return $this->move_msg(_MD_CHESS_MOVE_TWO_PAWNS, $move[0]); // "there is more than one pawn in column $move[0]" |
|
| 985 | + else |
|
| 986 | + { |
|
| 987 | + if ( $player == 'w' ) |
|
| 988 | + $dest_line = $pawn_line+1; |
|
| 989 | + else |
|
| 990 | + $dest_line = $pawn_line-1; |
|
| 991 | + $this->ac_move = sprintf( "P%s%dx%s%d", |
|
| 992 | + $move[0],$pawn_line,$move[1],$dest_line ); |
|
| 993 | + return ""; |
|
| 994 | + } |
|
| 995 | + } |
|
| 996 | + } |
|
| 997 | 997 | } |
| 998 | 998 | else |
| 999 | 999 | { |
| 1000 | - /* figure move */ |
|
| 1001 | - $dest_coord = substr( $move, strlen($move)-2, 2 ); |
|
| 1002 | - $action = $move[strlen($move)-3]; |
|
| 1003 | - if ( $action != 'x' ) $action = '-'; |
|
| 1004 | - if ( $player == 'w' ) |
|
| 1005 | - $figures = $this->w_figures; |
|
| 1006 | - else |
|
| 1007 | - $figures = $this->b_figures; |
|
| 1008 | - $fig_count = 0; |
|
| 1009 | - foreach( $figures as $figure ) |
|
| 1010 | - if ( $figure[0] == $move[0] ) |
|
| 1011 | - { |
|
| 1012 | - $fig_count++; |
|
| 1013 | - if ( $fig_count == 1 ) |
|
| 1014 | - $pos1 = substr( $figure, 1, 2 ); |
|
| 1015 | - else |
|
| 1016 | - $pos2 = substr( $figure, 1, 2 ); |
|
| 1017 | - } |
|
| 1018 | - if ( $fig_count == 0 ) |
|
| 1019 | - return $this->move_msg(_MD_CHESS_MOVE_NO_FIGURE, $move[0], $this->getFullFigureName($move[0])); // sprintf("there is no figure %s = %s", $move[0], $this->getFullFigureName($move[0])) |
|
| 1020 | - else |
|
| 1021 | - if ( $fig_count == 1 ) |
|
| 1022 | - { |
|
| 1023 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1024 | - $move[0], $pos1, $action, $dest_coord ); |
|
| 1025 | - return ""; |
|
| 1026 | - } |
|
| 1027 | - else |
|
| 1028 | - { |
|
| 1029 | - /* two figures which may cause ambiguity */ |
|
| 1030 | - $dest_pos = $this->boardCoordToIndex( $dest_coord ); |
|
| 1031 | - if ( $dest_pos == 64 ) |
|
| 1032 | - return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $dest_coord); // "coordinate $dest_coord is invalid" |
|
| 1033 | - $fig1_can_reach = $this->tileIsReachable( $move[0], |
|
| 1034 | - $this->boardCoordToIndex($pos1), $dest_pos ); |
|
| 1035 | - $fig2_can_reach = $this->tileIsReachable( $move[0], |
|
| 1036 | - $this->boardCoordToIndex($pos2), $dest_pos ); |
|
| 1037 | - if ( !$fig1_can_reach && !$fig2_can_reach ) |
|
| 1038 | - return $this->move_msg(_MD_CHESS_MOVE_NEITHER_CAN_REACH, $move[0], $this->getFullFigureName($move[0]), $dest_coord); // sprintf("neither of the %s = %s can reach %s", $move[0], $this->getFullFigureName($move[0]), $dest_coord) |
|
| 1039 | - else |
|
| 1040 | - if ( $fig1_can_reach && $fig2_can_reach ) |
|
| 1041 | - { |
|
| 1042 | - /* ambiguity - check whether a hint is given */ |
|
| 1043 | - if ( ($action=='-' && strlen($move)==4) || |
|
| 1044 | - ($action=='x' && strlen($move)==5) ) |
|
| 1045 | - $hint = $move[1]; |
|
| 1046 | - if ( empty($hint) ) |
|
| 1047 | - return $this->move_msg(_MD_CHESS_MOVE_BOTH_CAN_REACH, $move[0], $this->getFullFigureName($move[0]), $dest_coord); // sprintf("both of the %s = %s can reach %s", $move[0], $this->getFullFigureName($move[0]), $dest_coord) |
|
| 1048 | - else |
|
| 1049 | - { |
|
| 1050 | - $move_fig1 = 0; |
|
| 1051 | - $move_fig2 = 0; |
|
| 1052 | - if ( $hint>='1' && $hint<='8' ) |
|
| 1053 | - { |
|
| 1054 | - if ( $pos1[1]==$hint && $pos2[1]!=$hint ) |
|
| 1055 | - $move_fig1 = 1; |
|
| 1056 | - if ( $pos2[1]==$hint && $pos1[1]!=$hint ) |
|
| 1057 | - $move_fig2 = 1; |
|
| 1058 | - } |
|
| 1059 | - else |
|
| 1060 | - { |
|
| 1061 | - if ( $pos1[0]==$hint && $pos2[0]!=$hint ) |
|
| 1062 | - $move_fig1 = 1; |
|
| 1063 | - if ( $pos2[0]==$hint && $pos1[0]!=$hint ) |
|
| 1064 | - $move_fig2 = 1; |
|
| 1065 | - } |
|
| 1066 | - if ( !$move_fig1 && !$move_fig2 ) |
|
| 1067 | - return _MD_CHESS_MOVE_AMBIGUOUS; // "ambiguity is not properly resolved" |
|
| 1068 | - if ( $move_fig1 ) |
|
| 1069 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1070 | - $move[0], $pos1, $action, $dest_coord ); |
|
| 1071 | - else |
|
| 1072 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1073 | - $move[0], $pos2, $action, $dest_coord ); |
|
| 1074 | - return; |
|
| 1075 | - } |
|
| 1076 | - } |
|
| 1077 | - else |
|
| 1078 | - { |
|
| 1079 | - if ( $fig1_can_reach ) |
|
| 1080 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1081 | - $move[0], $pos1, $action, $dest_coord ); |
|
| 1082 | - else |
|
| 1083 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1084 | - $move[0], $pos2, $action, $dest_coord ); |
|
| 1085 | - return ""; |
|
| 1086 | - } |
|
| 1087 | - } |
|
| 1000 | + /* figure move */ |
|
| 1001 | + $dest_coord = substr( $move, strlen($move)-2, 2 ); |
|
| 1002 | + $action = $move[strlen($move)-3]; |
|
| 1003 | + if ( $action != 'x' ) $action = '-'; |
|
| 1004 | + if ( $player == 'w' ) |
|
| 1005 | + $figures = $this->w_figures; |
|
| 1006 | + else |
|
| 1007 | + $figures = $this->b_figures; |
|
| 1008 | + $fig_count = 0; |
|
| 1009 | + foreach( $figures as $figure ) |
|
| 1010 | + if ( $figure[0] == $move[0] ) |
|
| 1011 | + { |
|
| 1012 | + $fig_count++; |
|
| 1013 | + if ( $fig_count == 1 ) |
|
| 1014 | + $pos1 = substr( $figure, 1, 2 ); |
|
| 1015 | + else |
|
| 1016 | + $pos2 = substr( $figure, 1, 2 ); |
|
| 1017 | + } |
|
| 1018 | + if ( $fig_count == 0 ) |
|
| 1019 | + return $this->move_msg(_MD_CHESS_MOVE_NO_FIGURE, $move[0], $this->getFullFigureName($move[0])); // sprintf("there is no figure %s = %s", $move[0], $this->getFullFigureName($move[0])) |
|
| 1020 | + else |
|
| 1021 | + if ( $fig_count == 1 ) |
|
| 1022 | + { |
|
| 1023 | + $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1024 | + $move[0], $pos1, $action, $dest_coord ); |
|
| 1025 | + return ""; |
|
| 1026 | + } |
|
| 1027 | + else |
|
| 1028 | + { |
|
| 1029 | + /* two figures which may cause ambiguity */ |
|
| 1030 | + $dest_pos = $this->boardCoordToIndex( $dest_coord ); |
|
| 1031 | + if ( $dest_pos == 64 ) |
|
| 1032 | + return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $dest_coord); // "coordinate $dest_coord is invalid" |
|
| 1033 | + $fig1_can_reach = $this->tileIsReachable( $move[0], |
|
| 1034 | + $this->boardCoordToIndex($pos1), $dest_pos ); |
|
| 1035 | + $fig2_can_reach = $this->tileIsReachable( $move[0], |
|
| 1036 | + $this->boardCoordToIndex($pos2), $dest_pos ); |
|
| 1037 | + if ( !$fig1_can_reach && !$fig2_can_reach ) |
|
| 1038 | + return $this->move_msg(_MD_CHESS_MOVE_NEITHER_CAN_REACH, $move[0], $this->getFullFigureName($move[0]), $dest_coord); // sprintf("neither of the %s = %s can reach %s", $move[0], $this->getFullFigureName($move[0]), $dest_coord) |
|
| 1039 | + else |
|
| 1040 | + if ( $fig1_can_reach && $fig2_can_reach ) |
|
| 1041 | + { |
|
| 1042 | + /* ambiguity - check whether a hint is given */ |
|
| 1043 | + if ( ($action=='-' && strlen($move)==4) || |
|
| 1044 | + ($action=='x' && strlen($move)==5) ) |
|
| 1045 | + $hint = $move[1]; |
|
| 1046 | + if ( empty($hint) ) |
|
| 1047 | + return $this->move_msg(_MD_CHESS_MOVE_BOTH_CAN_REACH, $move[0], $this->getFullFigureName($move[0]), $dest_coord); // sprintf("both of the %s = %s can reach %s", $move[0], $this->getFullFigureName($move[0]), $dest_coord) |
|
| 1048 | + else |
|
| 1049 | + { |
|
| 1050 | + $move_fig1 = 0; |
|
| 1051 | + $move_fig2 = 0; |
|
| 1052 | + if ( $hint>='1' && $hint<='8' ) |
|
| 1053 | + { |
|
| 1054 | + if ( $pos1[1]==$hint && $pos2[1]!=$hint ) |
|
| 1055 | + $move_fig1 = 1; |
|
| 1056 | + if ( $pos2[1]==$hint && $pos1[1]!=$hint ) |
|
| 1057 | + $move_fig2 = 1; |
|
| 1058 | + } |
|
| 1059 | + else |
|
| 1060 | + { |
|
| 1061 | + if ( $pos1[0]==$hint && $pos2[0]!=$hint ) |
|
| 1062 | + $move_fig1 = 1; |
|
| 1063 | + if ( $pos2[0]==$hint && $pos1[0]!=$hint ) |
|
| 1064 | + $move_fig2 = 1; |
|
| 1065 | + } |
|
| 1066 | + if ( !$move_fig1 && !$move_fig2 ) |
|
| 1067 | + return _MD_CHESS_MOVE_AMBIGUOUS; // "ambiguity is not properly resolved" |
|
| 1068 | + if ( $move_fig1 ) |
|
| 1069 | + $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1070 | + $move[0], $pos1, $action, $dest_coord ); |
|
| 1071 | + else |
|
| 1072 | + $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1073 | + $move[0], $pos2, $action, $dest_coord ); |
|
| 1074 | + return; |
|
| 1075 | + } |
|
| 1076 | + } |
|
| 1077 | + else |
|
| 1078 | + { |
|
| 1079 | + if ( $fig1_can_reach ) |
|
| 1080 | + $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1081 | + $move[0], $pos1, $action, $dest_coord ); |
|
| 1082 | + else |
|
| 1083 | + $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1084 | + $move[0], $pos2, $action, $dest_coord ); |
|
| 1085 | + return ""; |
|
| 1086 | + } |
|
| 1087 | + } |
|
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | return $error; |
@@ -1111,37 +1111,37 @@ discard block |
||
| 1111 | 1111 | /* valid pawn moves are always non-ambigious */ |
| 1112 | 1112 | if ( $move[0] == 'P' ) |
| 1113 | 1113 | { |
| 1114 | - /* skip P anycase. for attacks skip source digit |
|
| 1114 | + /* skip P anycase. for attacks skip source digit |
|
| 1115 | 1115 | and for moves skip source pos and - */ |
| 1116 | - if ( $move[3] == '-' ) |
|
| 1117 | - $new_move = substr( $move, 4 ); |
|
| 1118 | - else |
|
| 1119 | - if ( $move[3] == 'x' ) |
|
| 1120 | - $new_move = sprintf("%s%s", $move[1], substr( $move, 3 ) ); |
|
| 1116 | + if ( $move[3] == '-' ) |
|
| 1117 | + $new_move = substr( $move, 4 ); |
|
| 1118 | + else |
|
| 1119 | + if ( $move[3] == 'x' ) |
|
| 1120 | + $new_move = sprintf("%s%s", $move[1], substr( $move, 3 ) ); |
|
| 1121 | 1121 | } |
| 1122 | 1122 | else |
| 1123 | 1123 | { |
| 1124 | - /* try to remove the source position and check whether it |
|
| 1124 | + /* try to remove the source position and check whether it |
|
| 1125 | 1125 | * is a non-ambigious move. if it is add one of the components |
| 1126 | 1126 | * and check again */ |
| 1127 | - if ( $move[3] == '-' ) |
|
| 1128 | - $dest = substr( $move, 4 ); |
|
| 1129 | - else |
|
| 1130 | - if ( $move[3] == 'x' ) |
|
| 1131 | - $dest = substr( $move, 3 ); |
|
| 1132 | - $new_move = sprintf("%s%s", $move[0], $dest ); |
|
| 1133 | - if ( $this->completeMove($player,$new_move) != "" ) |
|
| 1134 | - { |
|
| 1135 | - /* add a component */ |
|
| 1136 | - $new_move = sprintf("%s%s%s", $move[0], $move[1], $dest ); |
|
| 1137 | - if ( $this->completeMove($player,$new_move) != "" ) |
|
| 1138 | - { |
|
| 1139 | - /* add other component */ |
|
| 1140 | - $new_move = sprintf("%s%s%s", $move[0], $move[2], $dest ); |
|
| 1141 | - if ( $this->completeMove($player,$new_move) != "" ) |
|
| 1142 | - $new_move = $move; /* give up */ |
|
| 1143 | - } |
|
| 1144 | - } |
|
| 1127 | + if ( $move[3] == '-' ) |
|
| 1128 | + $dest = substr( $move, 4 ); |
|
| 1129 | + else |
|
| 1130 | + if ( $move[3] == 'x' ) |
|
| 1131 | + $dest = substr( $move, 3 ); |
|
| 1132 | + $new_move = sprintf("%s%s", $move[0], $dest ); |
|
| 1133 | + if ( $this->completeMove($player,$new_move) != "" ) |
|
| 1134 | + { |
|
| 1135 | + /* add a component */ |
|
| 1136 | + $new_move = sprintf("%s%s%s", $move[0], $move[1], $dest ); |
|
| 1137 | + if ( $this->completeMove($player,$new_move) != "" ) |
|
| 1138 | + { |
|
| 1139 | + /* add other component */ |
|
| 1140 | + $new_move = sprintf("%s%s%s", $move[0], $move[2], $dest ); |
|
| 1141 | + if ( $this->completeMove($player,$new_move) != "" ) |
|
| 1142 | + $new_move = $move; /* give up */ |
|
| 1143 | + } |
|
| 1144 | + } |
|
| 1145 | 1145 | } |
| 1146 | 1146 | |
| 1147 | 1147 | $this->ac_move = $old_ac_move; |
@@ -1175,14 +1175,14 @@ discard block |
||
| 1175 | 1175 | $cur_player = $this->gamestate['fen_active_color']; /* b or w */ |
| 1176 | 1176 | |
| 1177 | 1177 | if ($cur_player != 'w' and $cur_player != 'b') { |
| 1178 | - return(array(false, "handleMove, internal error: player='$cur_player'")); |
|
| 1178 | + return(array(false, "handleMove, internal error: player='$cur_player'")); |
|
| 1179 | 1179 | } |
| 1180 | 1180 | |
| 1181 | 1181 | $cur_opp = ($cur_player == 'w') ? 'b' : 'w'; |
| 1182 | 1182 | |
| 1183 | 1183 | if ($this->gamestate['pgn_result'] != '*') |
| 1184 | 1184 | { |
| 1185 | - return(array(false, _MD_CHESS_MOVE_GAME_OVER)); |
|
| 1185 | + return(array(false, _MD_CHESS_MOVE_GAME_OVER)); |
|
| 1186 | 1186 | } |
| 1187 | 1187 | |
| 1188 | 1188 | // get castling availability flags |
@@ -1327,83 +1327,83 @@ discard block |
||
| 1327 | 1327 | |
| 1328 | 1328 | else |
| 1329 | 1329 | { |
| 1330 | - /* [PRNBQK][a-h][1-8][-:x][a-h][1-8][RNBQK] full move */ |
|
| 1330 | + /* [PRNBQK][a-h][1-8][-:x][a-h][1-8][RNBQK] full move */ |
|
| 1331 | 1331 | |
| 1332 | - /* allow short move description by autocompleting to |
|
| 1332 | + /* allow short move description by autocompleting to |
|
| 1333 | 1333 | * full description */ |
| 1334 | - $ac_error = $this->completeMove( $cur_player, trim($move) ); |
|
| 1335 | - if ( $ac_error != "" ) |
|
| 1336 | - return(array(false, $ac_error)); // "ERROR: autocomplete: $ac_error" |
|
| 1337 | - else |
|
| 1338 | - $move = $this->ac_move; |
|
| 1339 | - $this->last_move = str_replace( "?", "", $move ); |
|
| 1334 | + $ac_error = $this->completeMove( $cur_player, trim($move) ); |
|
| 1335 | + if ( $ac_error != "" ) |
|
| 1336 | + return(array(false, $ac_error)); // "ERROR: autocomplete: $ac_error" |
|
| 1337 | + else |
|
| 1338 | + $move = $this->ac_move; |
|
| 1339 | + $this->last_move = str_replace( "?", "", $move ); |
|
| 1340 | 1340 | |
| 1341 | - /* a final captial letter may only be N,B,R,Q for the |
|
| 1341 | + /* a final captial letter may only be N,B,R,Q for the |
|
| 1342 | 1342 | * appropiate chessman */ |
| 1343 | - $c = $move[strlen($move)-1]; |
|
| 1344 | - if ( $c >= 'A' && $c <= 'Z' ) |
|
| 1345 | - if ( $c != 'N' && $c != 'B' && $c != 'R' && $c != 'Q' ) |
|
| 1346 | - return(array(false, _MD_CHESS_MOVE_INVALID_PIECE)); // "ERROR: only N (knight), B (bishop), R (rook) and Q (queen) are valid chessman identifiers" |
|
| 1343 | + $c = $move[strlen($move)-1]; |
|
| 1344 | + if ( $c >= 'A' && $c <= 'Z' ) |
|
| 1345 | + if ( $c != 'N' && $c != 'B' && $c != 'R' && $c != 'Q' ) |
|
| 1346 | + return(array(false, _MD_CHESS_MOVE_INVALID_PIECE)); // "ERROR: only N (knight), B (bishop), R (rook) and Q (queen) are valid chessman identifiers" |
|
| 1347 | 1347 | |
| 1348 | - /* if it is a full move, try to shorten the history move */ |
|
| 1349 | - if ( strlen( $history_move ) >= 6 ) |
|
| 1350 | - $history_move = |
|
| 1351 | - $this->convertFullToChessNotation($cur_player,$history_move); |
|
| 1352 | - /* DEBUG: echo "Move: $move ($history_move)<BR>"; */ |
|
| 1348 | + /* if it is a full move, try to shorten the history move */ |
|
| 1349 | + if ( strlen( $history_move ) >= 6 ) |
|
| 1350 | + $history_move = |
|
| 1351 | + $this->convertFullToChessNotation($cur_player,$history_move); |
|
| 1352 | + /* DEBUG: echo "Move: $move ($history_move)<BR>"; */ |
|
| 1353 | 1353 | |
| 1354 | - /* validate figure and position */ |
|
| 1355 | - $fig_type = $move[0]; |
|
| 1356 | - $fig_name = $this->getFullFigureName( $fig_type ); |
|
| 1357 | - if ( $fig_name == "empty" ) |
|
| 1358 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_UNKNOWN_FIGURE, $fig_type))); // "ERROR: Figure $fig_type is unknown!" |
|
| 1359 | - $fig_coord = substr($move,1,2); |
|
| 1360 | - $fig_pos = $this->boardCoordToIndex( $fig_coord ); |
|
| 1361 | - if ( $fig_pos == 64 ) return(array(false, $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $fig_coord))); // "ERROR: $fig_coord is invalid!" |
|
| 1362 | - /* DEBUG echo "fig_type: $fig_type, fig_pos: $fig_pos<BR>"; */ |
|
| 1363 | - if ($this->is_empty_tile($fig_pos)) |
|
| 1364 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_TILE_EMPTY, $fig_coord))); // "ERROR: Tile $fig_coord is empty." |
|
| 1365 | - if ( $this->board[$fig_pos]{0} != $cur_player ) |
|
| 1366 | - return(array(false, _MD_CHESS_MOVE_NOT_YOUR_PIECE)); // "ERROR: Figure does not belong to you!" |
|
| 1367 | - if ( $this->board[$fig_pos]{1} != $fig_type ) |
|
| 1368 | - return(array(false, _MD_CHESS_MOVE_NOEXIST_FIGURE)); // "ERROR: Figure does not exist!" |
|
| 1354 | + /* validate figure and position */ |
|
| 1355 | + $fig_type = $move[0]; |
|
| 1356 | + $fig_name = $this->getFullFigureName( $fig_type ); |
|
| 1357 | + if ( $fig_name == "empty" ) |
|
| 1358 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_UNKNOWN_FIGURE, $fig_type))); // "ERROR: Figure $fig_type is unknown!" |
|
| 1359 | + $fig_coord = substr($move,1,2); |
|
| 1360 | + $fig_pos = $this->boardCoordToIndex( $fig_coord ); |
|
| 1361 | + if ( $fig_pos == 64 ) return(array(false, $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $fig_coord))); // "ERROR: $fig_coord is invalid!" |
|
| 1362 | + /* DEBUG echo "fig_type: $fig_type, fig_pos: $fig_pos<BR>"; */ |
|
| 1363 | + if ($this->is_empty_tile($fig_pos)) |
|
| 1364 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_TILE_EMPTY, $fig_coord))); // "ERROR: Tile $fig_coord is empty." |
|
| 1365 | + if ( $this->board[$fig_pos]{0} != $cur_player ) |
|
| 1366 | + return(array(false, _MD_CHESS_MOVE_NOT_YOUR_PIECE)); // "ERROR: Figure does not belong to you!" |
|
| 1367 | + if ( $this->board[$fig_pos]{1} != $fig_type ) |
|
| 1368 | + return(array(false, _MD_CHESS_MOVE_NOEXIST_FIGURE)); // "ERROR: Figure does not exist!" |
|
| 1369 | 1369 | |
| 1370 | - /* get target index */ |
|
| 1371 | - $dest_coord = substr($move,4,2); |
|
| 1372 | - $dest_pos = $this->boardCoordToIndex( $dest_coord ); |
|
| 1373 | - if ( $dest_pos == 64 ) |
|
| 1374 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $dest_coord))); // "ERROR: $dest_coord is invalid!" |
|
| 1375 | - if ( $dest_pos == $fig_pos ) |
|
| 1376 | - return(array(false, _MD_CHESS_MOVE_START_END_SAME)); |
|
| 1377 | - /* DEBUG echo "dest_pos: $dest_pos<BR>"; */ |
|
| 1378 | - |
|
| 1379 | - /* get action */ |
|
| 1380 | - $action = $move[3]; |
|
| 1381 | - if ( $move[3] == "-" ) |
|
| 1382 | - $action = 'M'; /* move */ |
|
| 1383 | - else if ( $move[3] == 'x' ) |
|
| 1384 | - $action = 'A'; /* attack */ |
|
| 1385 | - else |
|
| 1386 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_UNKNOWN_ACTION, $action))); // "ERROR: $action is unknown! Please use \"-\" for a move and \"x\" for an attack." |
|
| 1387 | - |
|
| 1388 | - /* if attack an enemy unit must be present on tile |
|
| 1370 | + /* get target index */ |
|
| 1371 | + $dest_coord = substr($move,4,2); |
|
| 1372 | + $dest_pos = $this->boardCoordToIndex( $dest_coord ); |
|
| 1373 | + if ( $dest_pos == 64 ) |
|
| 1374 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $dest_coord))); // "ERROR: $dest_coord is invalid!" |
|
| 1375 | + if ( $dest_pos == $fig_pos ) |
|
| 1376 | + return(array(false, _MD_CHESS_MOVE_START_END_SAME)); |
|
| 1377 | + /* DEBUG echo "dest_pos: $dest_pos<BR>"; */ |
|
| 1378 | + |
|
| 1379 | + /* get action */ |
|
| 1380 | + $action = $move[3]; |
|
| 1381 | + if ( $move[3] == "-" ) |
|
| 1382 | + $action = 'M'; /* move */ |
|
| 1383 | + else if ( $move[3] == 'x' ) |
|
| 1384 | + $action = 'A'; /* attack */ |
|
| 1385 | + else |
|
| 1386 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_UNKNOWN_ACTION, $action))); // "ERROR: $action is unknown! Please use \"-\" for a move and \"x\" for an attack." |
|
| 1387 | + |
|
| 1388 | + /* if attack an enemy unit must be present on tile |
|
| 1389 | 1389 | * and if move then tile must be empty. in both cases |
| 1390 | 1390 | * the king must not be checked after moving. */ |
| 1391 | 1391 | |
| 1392 | - /* check whether the move is along a valid path and |
|
| 1392 | + /* check whether the move is along a valid path and |
|
| 1393 | 1393 | * whether all tiles in between are empty thus the path |
| 1394 | 1394 | * is not blocked. the final destination tile is not |
| 1395 | 1395 | * checked here. */ |
| 1396 | - if ( $fig_type != 'P' ) |
|
| 1397 | - { |
|
| 1398 | - if ( !$this->tileIsReachable( $fig_type, $fig_pos, $dest_pos ) ) |
|
| 1399 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of moving range for $fig_name at $fig_coord!" |
|
| 1400 | - } |
|
| 1401 | - else { |
|
| 1402 | - if ( $action == 'M' && !$this->checkPawnMove( $fig_pos, $dest_pos ) ) |
|
| 1403 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of moving range for $fig_name at $fig_coord!" |
|
| 1404 | - if ( $action == 'A' && !$this->checkPawnAttack( $fig_pos, $dest_pos ) ) |
|
| 1405 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of attacking range for $fig_name at $fig_coord!" |
|
| 1406 | - } |
|
| 1396 | + if ( $fig_type != 'P' ) |
|
| 1397 | + { |
|
| 1398 | + if ( !$this->tileIsReachable( $fig_type, $fig_pos, $dest_pos ) ) |
|
| 1399 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of moving range for $fig_name at $fig_coord!" |
|
| 1400 | + } |
|
| 1401 | + else { |
|
| 1402 | + if ( $action == 'M' && !$this->checkPawnMove( $fig_pos, $dest_pos ) ) |
|
| 1403 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of moving range for $fig_name at $fig_coord!" |
|
| 1404 | + if ( $action == 'A' && !$this->checkPawnAttack( $fig_pos, $dest_pos ) ) |
|
| 1405 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of attacking range for $fig_name at $fig_coord!" |
|
| 1406 | + } |
|
| 1407 | 1407 | |
| 1408 | 1408 | $en_passant_capture_performed = 0; // 1 if en passant captured occurred, else 0 |
| 1409 | 1409 | /* check action */ |
@@ -1427,43 +1427,43 @@ discard block |
||
| 1427 | 1427 | return(array(false, $this->move_msg(_MD_CHESS_MOVE_ATTACK_SELF, $dest_coord))); // "ERROR: You cannot attack own unit at $dest_coord." |
| 1428 | 1428 | } |
| 1429 | 1429 | |
| 1430 | - /* backup affected tiles */ |
|
| 1431 | - $old_fig_tile = $this->board[$fig_pos]; |
|
| 1432 | - $old_dest_tile = $this->board[$dest_pos]; |
|
| 1433 | - |
|
| 1434 | - /* perform move */ |
|
| 1435 | - $this->clear_tile($fig_pos); |
|
| 1436 | - if (!$this->is_empty_tile($dest_pos)) |
|
| 1437 | - $this->piece_captured = sprintf("%s%s",$this->board[$dest_pos],$dest_pos); |
|
| 1438 | - $this->board[$dest_pos] = "$cur_player$fig_type"; |
|
| 1439 | - if ( $en_passant_capture_performed ) { |
|
| 1440 | - /* kill pawn */ |
|
| 1441 | - if ( $cur_player == 'w' ) |
|
| 1442 | - { |
|
| 1443 | - $this->clear_tile($dest_pos - 8); |
|
| 1444 | - $this->piece_captured = sprintf("bP%s",$dest_pos-8); |
|
| 1445 | - } |
|
| 1446 | - else |
|
| 1447 | - { |
|
| 1448 | - $this->clear_tile($dest_pos + 8); |
|
| 1449 | - $this->piece_captured = sprintf("wP%s",$dest_pos+8); |
|
| 1450 | - } |
|
| 1451 | - } |
|
| 1452 | - |
|
| 1453 | - /* check check :) */ |
|
| 1454 | - if ( $this->kingIsUnderAttack( $cur_player, $cur_opp ) ) |
|
| 1455 | - { |
|
| 1456 | - $this->board[$fig_pos] = $old_fig_tile; |
|
| 1457 | - $this->board[$dest_pos] = $old_dest_tile; |
|
| 1458 | - if ( $en_passant_capture_performed ) { |
|
| 1459 | - // restore pawn that was captured above, since that move is invalid |
|
| 1460 | - if ( $cur_player == 'w' ) |
|
| 1461 | - $this->board[$dest_pos-8] = "bP"; |
|
| 1462 | - else |
|
| 1463 | - $this->board[$dest_pos+8] = "wP"; |
|
| 1464 | - } |
|
| 1465 | - return(array(false, _MD_CHESS_MOVE_IN_CHECK)); // "ERROR: Move is invalid because king would be under attack then." |
|
| 1466 | - } |
|
| 1430 | + /* backup affected tiles */ |
|
| 1431 | + $old_fig_tile = $this->board[$fig_pos]; |
|
| 1432 | + $old_dest_tile = $this->board[$dest_pos]; |
|
| 1433 | + |
|
| 1434 | + /* perform move */ |
|
| 1435 | + $this->clear_tile($fig_pos); |
|
| 1436 | + if (!$this->is_empty_tile($dest_pos)) |
|
| 1437 | + $this->piece_captured = sprintf("%s%s",$this->board[$dest_pos],$dest_pos); |
|
| 1438 | + $this->board[$dest_pos] = "$cur_player$fig_type"; |
|
| 1439 | + if ( $en_passant_capture_performed ) { |
|
| 1440 | + /* kill pawn */ |
|
| 1441 | + if ( $cur_player == 'w' ) |
|
| 1442 | + { |
|
| 1443 | + $this->clear_tile($dest_pos - 8); |
|
| 1444 | + $this->piece_captured = sprintf("bP%s",$dest_pos-8); |
|
| 1445 | + } |
|
| 1446 | + else |
|
| 1447 | + { |
|
| 1448 | + $this->clear_tile($dest_pos + 8); |
|
| 1449 | + $this->piece_captured = sprintf("wP%s",$dest_pos+8); |
|
| 1450 | + } |
|
| 1451 | + } |
|
| 1452 | + |
|
| 1453 | + /* check check :) */ |
|
| 1454 | + if ( $this->kingIsUnderAttack( $cur_player, $cur_opp ) ) |
|
| 1455 | + { |
|
| 1456 | + $this->board[$fig_pos] = $old_fig_tile; |
|
| 1457 | + $this->board[$dest_pos] = $old_dest_tile; |
|
| 1458 | + if ( $en_passant_capture_performed ) { |
|
| 1459 | + // restore pawn that was captured above, since that move is invalid |
|
| 1460 | + if ( $cur_player == 'w' ) |
|
| 1461 | + $this->board[$dest_pos-8] = "bP"; |
|
| 1462 | + else |
|
| 1463 | + $this->board[$dest_pos+8] = "wP"; |
|
| 1464 | + } |
|
| 1465 | + return(array(false, _MD_CHESS_MOVE_IN_CHECK)); // "ERROR: Move is invalid because king would be under attack then." |
|
| 1466 | + } |
|
| 1467 | 1467 | |
| 1468 | 1468 | // check whether this forbids any castling |
| 1469 | 1469 | if ($fig_type == 'K') { |
@@ -1501,29 +1501,29 @@ discard block |
||
| 1501 | 1501 | $this->gamestate['fen_en_passant_target_square'] = '-'; |
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | - if ($action == 'M' ) |
|
| 1505 | - $result = $this->move_msg(_MD_CHESS_MOVE_MOVED, $fig_name, $fig_coord, $dest_coord); |
|
| 1506 | - else |
|
| 1507 | - $result = $this->move_msg(_MD_CHESS_MOVE_CAPTURED, $fig_name, $dest_coord, $fig_coord); |
|
| 1504 | + if ($action == 'M' ) |
|
| 1505 | + $result = $this->move_msg(_MD_CHESS_MOVE_MOVED, $fig_name, $fig_coord, $dest_coord); |
|
| 1506 | + else |
|
| 1507 | + $result = $this->move_msg(_MD_CHESS_MOVE_CAPTURED, $fig_name, $dest_coord, $fig_coord); |
|
| 1508 | 1508 | |
| 1509 | - /* if pawn reached last line convert into a queen */ |
|
| 1510 | - if ( $fig_type == 'P' ) |
|
| 1511 | - { |
|
| 1512 | - if ( ($cur_player=='w' && $dest_pos>= 56) || |
|
| 1513 | - ($cur_player=='b' && $dest_pos<= 7 ) ) |
|
| 1514 | - { |
|
| 1515 | - $pawn_upg = $move[strlen($move)-1]; |
|
| 1516 | - if ( $pawn_upg == '?' ) |
|
| 1517 | - { |
|
| 1518 | - $pawn_upg = 'Q'; |
|
| 1519 | - $history_move = sprintf( "%sQ", $history_move ); |
|
| 1520 | - } |
|
| 1521 | - $this->board[$dest_pos] = "$cur_player$pawn_upg"; |
|
| 1522 | - $result .= ' ... ' . $this->move_msg(_MD_CHESS_MOVE_PROMOTED, $this->getFullFigureName($pawn_upg)); |
|
| 1523 | - } |
|
| 1524 | - } |
|
| 1509 | + /* if pawn reached last line convert into a queen */ |
|
| 1510 | + if ( $fig_type == 'P' ) |
|
| 1511 | + { |
|
| 1512 | + if ( ($cur_player=='w' && $dest_pos>= 56) || |
|
| 1513 | + ($cur_player=='b' && $dest_pos<= 7 ) ) |
|
| 1514 | + { |
|
| 1515 | + $pawn_upg = $move[strlen($move)-1]; |
|
| 1516 | + if ( $pawn_upg == '?' ) |
|
| 1517 | + { |
|
| 1518 | + $pawn_upg = 'Q'; |
|
| 1519 | + $history_move = sprintf( "%sQ", $history_move ); |
|
| 1520 | + } |
|
| 1521 | + $this->board[$dest_pos] = "$cur_player$pawn_upg"; |
|
| 1522 | + $result .= ' ... ' . $this->move_msg(_MD_CHESS_MOVE_PROMOTED, $this->getFullFigureName($pawn_upg)); |
|
| 1523 | + } |
|
| 1524 | + } |
|
| 1525 | 1525 | |
| 1526 | - $move_handled = 1; |
|
| 1526 | + $move_handled = 1; |
|
| 1527 | 1527 | } |
| 1528 | 1528 | |
| 1529 | 1529 | /* if a legal move was performed test whether you |
@@ -1752,19 +1752,19 @@ discard block |
||
| 1752 | 1752 | //echo $coord," --> "; |
| 1753 | 1753 | switch ( $coord[0] ) |
| 1754 | 1754 | { |
| 1755 | - case 'a': $x = 0; break; |
|
| 1756 | - case 'b': $x = 1; break; |
|
| 1757 | - case 'c': $x = 2; break; |
|
| 1758 | - case 'd': $x = 3; break; |
|
| 1759 | - case 'e': $x = 4; break; |
|
| 1760 | - case 'f': $x = 5; break; |
|
| 1761 | - case 'g': $x = 6; break; |
|
| 1762 | - case 'h': $x = 7; break; |
|
| 1763 | - default: return 64; /* erronous coord */ |
|
| 1755 | + case 'a': $x = 0; break; |
|
| 1756 | + case 'b': $x = 1; break; |
|
| 1757 | + case 'c': $x = 2; break; |
|
| 1758 | + case 'd': $x = 3; break; |
|
| 1759 | + case 'e': $x = 4; break; |
|
| 1760 | + case 'f': $x = 5; break; |
|
| 1761 | + case 'g': $x = 6; break; |
|
| 1762 | + case 'h': $x = 7; break; |
|
| 1763 | + default: return 64; /* erronous coord */ |
|
| 1764 | 1764 | } |
| 1765 | 1765 | $y = $coord[1]-1; |
| 1766 | 1766 | if ( $y < 0 || $y > 7 ) |
| 1767 | - return 64; /* erronous coord */ |
|
| 1767 | + return 64; /* erronous coord */ |
|
| 1768 | 1768 | $index = $y * 8 + $x; |
| 1769 | 1769 | //echo "$index | "; |
| 1770 | 1770 | return $index; |
@@ -1782,7 +1782,7 @@ discard block |
||
| 1782 | 1782 | { |
| 1783 | 1783 | //echo $index," --> "; |
| 1784 | 1784 | if ( $index < 0 || $index > 63 ) |
| 1785 | - return ""; |
|
| 1785 | + return ""; |
|
| 1786 | 1786 | $y = floor($index/8)+1; |
| 1787 | 1787 | $x = chr( ($index%8)+97 ); |
| 1788 | 1788 | $coord = "$x$y"; |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | function ChessGame($param = null) |
| 168 | 168 | { |
| 169 | 169 | // for now |
| 170 | - $this->browsing_mode = 0; |
|
| 170 | + $this->browsing_mode = 0; |
|
| 171 | 171 | |
| 172 | 172 | if (is_array($param)) { |
| 173 | 173 | |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | { |
| 292 | 292 | return _MD_CHESS_FENBAD_IN_CHECK; // player to move cannot have opponent in check |
| 293 | 293 | } |
| 294 | - elseif ((strstr($this->gamestate['fen_castling_availability'], 'K') and ($this->board[ 4] != 'wK' or $this->board[ 7] != 'wR')) |
|
| 295 | - or (strstr($this->gamestate['fen_castling_availability'], 'Q') and ($this->board[ 4] != 'wK' or $this->board[ 0] != 'wR')) |
|
| 294 | + elseif ((strstr($this->gamestate['fen_castling_availability'], 'K') and ($this->board[4] != 'wK' or $this->board[7] != 'wR')) |
|
| 295 | + or (strstr($this->gamestate['fen_castling_availability'], 'Q') and ($this->board[4] != 'wK' or $this->board[0] != 'wR')) |
|
| 296 | 296 | or (strstr($this->gamestate['fen_castling_availability'], 'k') and ($this->board[60] != 'bK' or $this->board[63] != 'bR')) |
| 297 | 297 | or (strstr($this->gamestate['fen_castling_availability'], 'q') and ($this->board[60] != 'bK' or $this->board[56] != 'bR'))) |
| 298 | 298 | { |
@@ -304,12 +304,12 @@ discard block |
||
| 304 | 304 | return _MD_CHESS_FENBAD_EP_COLOR; // en passant target square wrong color |
| 305 | 305 | } |
| 306 | 306 | elseif ($this->gamestate['fen_en_passant_target_square'] != '-' and $this->gamestate['fen_en_passant_target_square']{1} == 3 |
| 307 | - and $this->board[$this->boardCoordToIndex($this->gamestate['fen_en_passant_target_square']{0} . '4')] != 'wP') |
|
| 307 | + and $this->board[$this->boardCoordToIndex($this->gamestate['fen_en_passant_target_square']{0}.'4')] != 'wP') |
|
| 308 | 308 | { |
| 309 | 309 | return _MD_CHESS_FENBAD_EP_NO_PAWN; // en passant target square for nonexistent pawn |
| 310 | 310 | } |
| 311 | 311 | elseif ($this->gamestate['fen_en_passant_target_square'] != '-' and $this->gamestate['fen_en_passant_target_square']{1} == 6 |
| 312 | - and $this->board[$this->boardCoordToIndex($this->gamestate['fen_en_passant_target_square']{0} . '5')] != 'bP') |
|
| 312 | + and $this->board[$this->boardCoordToIndex($this->gamestate['fen_en_passant_target_square']{0}.'5')] != 'bP') |
|
| 313 | 313 | { |
| 314 | 314 | return _MD_CHESS_FENBAD_EP_NO_PAWN; // en passant target square for nonexistent pawn |
| 315 | 315 | } |
@@ -397,11 +397,11 @@ discard block |
||
| 397 | 397 | $dx = $dest_pos % 8; |
| 398 | 398 | $dy = floor($dest_pos / 8); |
| 399 | 399 | |
| 400 | - switch ( $fig ) { |
|
| 400 | + switch ($fig) { |
|
| 401 | 401 | |
| 402 | 402 | /* bishop */ |
| 403 | 403 | case 'B': |
| 404 | - $change = ($dy < $fy) ? -8 : 8; |
|
| 404 | + $change = ($dy < $fy) ? -8 : 8; |
|
| 405 | 405 | $change += ($dx < $fx) ? -1 : 1; |
| 406 | 406 | break; |
| 407 | 407 | |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | /* queen */ |
| 418 | 418 | case 'Q': |
| 419 | 419 | if (abs($fx - $dx) == abs($fy - $dy)) { |
| 420 | - $change = ($dy < $fy) ? -8 : 8; |
|
| 420 | + $change = ($dy < $fy) ? -8 : 8; |
|
| 421 | 421 | $change += ($dx < $fx) ? -1 : 1; |
| 422 | 422 | } elseif ($fx == $dx) { |
| 423 | 423 | $change = ($dy < $fy) ? -8 : 8; |
@@ -448,70 +448,70 @@ discard block |
||
| 448 | 448 | */ |
| 449 | 449 | function tileIsReachable($fig, $fig_pos, $dest_pos) |
| 450 | 450 | { |
| 451 | - if ( $fig_pos==$dest_pos) return; |
|
| 451 | + if ($fig_pos == $dest_pos) return; |
|
| 452 | 452 | $result = 0; |
| 453 | - $fy = floor($fig_pos/8); $fx = $fig_pos%8; |
|
| 454 | - $dy = floor($dest_pos/8); $dx = $dest_pos%8; |
|
| 453 | + $fy = floor($fig_pos / 8); $fx = $fig_pos % 8; |
|
| 454 | + $dy = floor($dest_pos / 8); $dx = $dest_pos % 8; |
|
| 455 | 455 | /* DEBUG: echo "$fx,$fy --> $dx,$dy: "; */ |
| 456 | - switch ( $fig ) |
|
| 456 | + switch ($fig) |
|
| 457 | 457 | { |
| 458 | 458 | /* knight */ |
| 459 | 459 | case 'N': |
| 460 | - if ( abs($fx-$dx)==1 && abs($fy-$dy)==2 ) |
|
| 460 | + if (abs($fx - $dx) == 1 && abs($fy - $dy) == 2) |
|
| 461 | 461 | $result = 1; |
| 462 | - if ( abs($fy-$dy)==1 && abs($fx-$dx)==2 ) |
|
| 462 | + if (abs($fy - $dy) == 1 && abs($fx - $dx) == 2) |
|
| 463 | 463 | $result = 1; |
| 464 | 464 | break; |
| 465 | 465 | /* bishop */ |
| 466 | 466 | case 'B': |
| 467 | - if ( abs($fx-$dx) != abs($fy-$dy) ) |
|
| 467 | + if (abs($fx - $dx) != abs($fy - $dy)) |
|
| 468 | 468 | break; |
| 469 | - if ( $dy < $fy ) $change = -8; else $change = 8; |
|
| 470 | - if ( $dx < $fx ) $change -= 1; else $change += 1; |
|
| 471 | - if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 469 | + if ($dy < $fy) $change = -8; else $change = 8; |
|
| 470 | + if ($dx < $fx) $change -= 1; else $change += 1; |
|
| 471 | + if ($this->pathIsNotBlocked($fig_pos + $change, $dest_pos, $change)) |
|
| 472 | 472 | $result = 1; |
| 473 | 473 | break; |
| 474 | 474 | /* rook */ |
| 475 | 475 | case 'R': |
| 476 | - if ( $fx!=$dx && $fy!=$dy ) |
|
| 476 | + if ($fx != $dx && $fy != $dy) |
|
| 477 | 477 | break; |
| 478 | - if ( $fx==$dx ) |
|
| 478 | + if ($fx == $dx) |
|
| 479 | 479 | { |
| 480 | - if ( $dy<$fy ) $change = -8; else $change = 8; |
|
| 480 | + if ($dy < $fy) $change = -8; else $change = 8; |
|
| 481 | 481 | } |
| 482 | 482 | else { |
| 483 | - if ( $dx<$fx ) $change = -1; else $change = 1; |
|
| 483 | + if ($dx < $fx) $change = -1; else $change = 1; |
|
| 484 | 484 | } |
| 485 | - if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 485 | + if ($this->pathIsNotBlocked($fig_pos + $change, $dest_pos, $change)) |
|
| 486 | 486 | $result = 1; |
| 487 | 487 | break; |
| 488 | 488 | /* queen */ |
| 489 | 489 | case 'Q': |
| 490 | - if ( abs($fx-$dx) != abs($fy-$dy) && $fx!=$dx && $fy!=$dy ) |
|
| 490 | + if (abs($fx - $dx) != abs($fy - $dy) && $fx != $dx && $fy != $dy) |
|
| 491 | 491 | break; |
| 492 | - if ( abs($fx-$dx) == abs($fy-$dy) ) |
|
| 492 | + if (abs($fx - $dx) == abs($fy - $dy)) |
|
| 493 | 493 | { |
| 494 | - if ( $dy < $fy ) $change = -8; else $change = 8; |
|
| 495 | - if ( $dx < $fx ) $change -= 1; else $change += 1; |
|
| 494 | + if ($dy < $fy) $change = -8; else $change = 8; |
|
| 495 | + if ($dx < $fx) $change -= 1; else $change += 1; |
|
| 496 | 496 | } |
| 497 | - else if ( $fx==$dx ) { |
|
| 498 | - if ( $dy<$fy ) $change = -8; else $change = 8; |
|
| 497 | + else if ($fx == $dx) { |
|
| 498 | + if ($dy < $fy) $change = -8; else $change = 8; |
|
| 499 | 499 | } |
| 500 | 500 | else |
| 501 | 501 | { |
| 502 | - if ( $dx<$fx ) $change = -1; else $change = 1; |
|
| 502 | + if ($dx < $fx) $change = -1; else $change = 1; |
|
| 503 | 503 | } |
| 504 | - if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 504 | + if ($this->pathIsNotBlocked($fig_pos + $change, $dest_pos, $change)) |
|
| 505 | 505 | $result = 1; |
| 506 | 506 | break; |
| 507 | 507 | /* king */ |
| 508 | 508 | case 'K': |
| 509 | - if ( abs($fx-$dx) > 1 || abs($fy-$dy) > 1 ) break; |
|
| 509 | + if (abs($fx - $dx) > 1 || abs($fy - $dy) > 1) break; |
|
| 510 | 510 | $kings = 0; |
| 511 | - $adj_tiles = $this->getAdjTiles( $dest_pos ); |
|
| 512 | - foreach( $adj_tiles as $tile ) |
|
| 513 | - if ($this->board[$tile]{1} == 'K' ) $kings++; |
|
| 514 | - if ( $kings == 2 ) break; |
|
| 511 | + $adj_tiles = $this->getAdjTiles($dest_pos); |
|
| 512 | + foreach ($adj_tiles as $tile) |
|
| 513 | + if ($this->board[$tile]{1} == 'K') $kings++; |
|
| 514 | + if ($kings == 2) break; |
|
| 515 | 515 | $result = 1; |
| 516 | 516 | break; |
| 517 | 517 | } |
@@ -531,18 +531,18 @@ discard block |
||
| 531 | 531 | */ |
| 532 | 532 | function checkPawnAttack($fig_pos, $dest_pos) |
| 533 | 533 | { |
| 534 | - if ( $this->board[$fig_pos]{0} == 'w' ) |
|
| 534 | + if ($this->board[$fig_pos]{0} == 'w') |
|
| 535 | 535 | { |
| 536 | - if ( ($fig_pos % 8) > 0 && $dest_pos == $fig_pos+7 ) |
|
| 536 | + if (($fig_pos % 8) > 0 && $dest_pos == $fig_pos + 7) |
|
| 537 | 537 | return 1; |
| 538 | - if ( ($fig_pos % 8) < 7 && $dest_pos == $fig_pos+9 ) |
|
| 538 | + if (($fig_pos % 8) < 7 && $dest_pos == $fig_pos + 9) |
|
| 539 | 539 | return 1; |
| 540 | 540 | } |
| 541 | - else if ( $this->board[$fig_pos]{0} == 'b' ) |
|
| 541 | + else if ($this->board[$fig_pos]{0} == 'b') |
|
| 542 | 542 | { |
| 543 | - if ( ($fig_pos % 8) < 7 && $dest_pos == $fig_pos-7 ) |
|
| 543 | + if (($fig_pos % 8) < 7 && $dest_pos == $fig_pos - 7) |
|
| 544 | 544 | return 1; |
| 545 | - if ( ($fig_pos % 8) > 0 && $dest_pos == $fig_pos-9 ) |
|
| 545 | + if (($fig_pos % 8) > 0 && $dest_pos == $fig_pos - 9) |
|
| 546 | 546 | return 1; |
| 547 | 547 | } |
| 548 | 548 | return 0; |
@@ -566,23 +566,23 @@ discard block |
||
| 566 | 566 | { |
| 567 | 567 | $first_move = 0; |
| 568 | 568 | |
| 569 | - if ( $this->board[$fig_pos]{0} == 'w' ) |
|
| 569 | + if ($this->board[$fig_pos]{0} == 'w') |
|
| 570 | 570 | { |
| 571 | - if ( $fig_pos >= 8 && $fig_pos <= 15 ) |
|
| 571 | + if ($fig_pos >= 8 && $fig_pos <= 15) |
|
| 572 | 572 | $first_move = 1; |
| 573 | - if ( $dest_pos==$fig_pos+8 ) |
|
| 573 | + if ($dest_pos == $fig_pos + 8) |
|
| 574 | 574 | return 1; |
| 575 | - if ( $first_move && ( $dest_pos==$fig_pos+16 ) ) |
|
| 575 | + if ($first_move && ($dest_pos == $fig_pos + 16)) |
|
| 576 | 576 | if ($this->is_empty_tile($fig_pos + 8)) |
| 577 | 577 | return 1; |
| 578 | 578 | } |
| 579 | - else if ($this->board[$fig_pos]{0} == 'b' ) |
|
| 579 | + else if ($this->board[$fig_pos]{0} == 'b') |
|
| 580 | 580 | { |
| 581 | - if ( $fig_pos >= 48 && $fig_pos <= 55 ) |
|
| 581 | + if ($fig_pos >= 48 && $fig_pos <= 55) |
|
| 582 | 582 | $first_move = 1; |
| 583 | - if ( $dest_pos==$fig_pos-8 ) |
|
| 583 | + if ($dest_pos == $fig_pos - 8) |
|
| 584 | 584 | return 1; |
| 585 | - if ( $first_move && ( $dest_pos==$fig_pos-16 ) ) |
|
| 585 | + if ($first_move && ($dest_pos == $fig_pos - 16)) |
|
| 586 | 586 | if ($this->is_empty_tile($fig_pos - 8)) |
| 587 | 587 | return 1; |
| 588 | 588 | } |
@@ -601,12 +601,12 @@ discard block |
||
| 601 | 601 | function tileIsUnderAttack($opp, $dest_pos) |
| 602 | 602 | { |
| 603 | 603 | #var_dump('tileIsUnderAttack, opp', $opp, 'dest_pos', $dest_pos, 'board', $board);#*#DEBUG# |
| 604 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 605 | - if ($this->board[$i]{0} == $opp ) |
|
| 604 | + for ($i = 0; $i < 64; $i++) |
|
| 605 | + if ($this->board[$i]{0} == $opp) |
|
| 606 | 606 | { |
| 607 | - if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$dest_pos)) || |
|
| 608 | - ($this->board[$i]{1}!='P' && |
|
| 609 | - $this->tileIsReachable($this->board[$i]{1},$i,$dest_pos)) ) |
|
| 607 | + if (($this->board[$i]{1} == 'P' && $this->checkPawnAttack($i, $dest_pos)) || |
|
| 608 | + ($this->board[$i]{1} != 'P' && |
|
| 609 | + $this->tileIsReachable($this->board[$i]{1},$i, $dest_pos))) |
|
| 610 | 610 | { |
| 611 | 611 | /*DEBUG: echo "attack test: $i: ",$opp,"P<BR>"; */ |
| 612 | 612 | return 1; |
@@ -628,15 +628,15 @@ discard block |
||
| 628 | 628 | { |
| 629 | 629 | |
| 630 | 630 | #var_dump('kingIsUnderAttack, player', $player, 'opp', $opp, 'board', $board);#*#DEBUG# |
| 631 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 632 | - if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K' ) |
|
| 631 | + for ($i = 0; $i < 64; $i++) |
|
| 632 | + if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K') |
|
| 633 | 633 | { |
| 634 | 634 | $king_pos = $i; |
| 635 | 635 | break; |
| 636 | 636 | } |
| 637 | 637 | /*DEBUG: echo "$player king is at $king_pos<BR>"; */ |
| 638 | 638 | |
| 639 | - return $this->tileIsUnderAttack( $opp, $king_pos ); |
|
| 639 | + return $this->tileIsUnderAttack($opp, $king_pos); |
|
| 640 | 640 | } |
| 641 | 641 | |
| 642 | 642 | /** |
@@ -650,22 +650,22 @@ discard block |
||
| 650 | 650 | */ |
| 651 | 651 | function isCheckMate($player, $opp) |
| 652 | 652 | { |
| 653 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 654 | - if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K' ) |
|
| 653 | + for ($i = 0; $i < 64; $i++) |
|
| 654 | + if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K') |
|
| 655 | 655 | { |
| 656 | 656 | $king_pos = $i; |
| 657 | 657 | $king_x = $i % 8; |
| 658 | - $king_y = floor($i/8); |
|
| 658 | + $king_y = floor($i / 8); |
|
| 659 | 659 | break; |
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | /* test adjacent tiles while king is temporarly removed */ |
| 663 | - $adj_tiles = $this->getAdjTiles( $king_pos ); |
|
| 663 | + $adj_tiles = $this->getAdjTiles($king_pos); |
|
| 664 | 664 | $contents = $this->board[$king_pos]; $this->clear_tile($king_pos); |
| 665 | - foreach ( $adj_tiles as $dest_pos ) |
|
| 665 | + foreach ($adj_tiles as $dest_pos) |
|
| 666 | 666 | { |
| 667 | - if ($this->board[$dest_pos]{0} == $player ) continue; |
|
| 668 | - if ( $this->tileIsUnderAttack($opp,$dest_pos) ) continue; |
|
| 667 | + if ($this->board[$dest_pos]{0} == $player) continue; |
|
| 668 | + if ($this->tileIsUnderAttack($opp, $dest_pos)) continue; |
|
| 669 | 669 | $this->board[$king_pos] = $contents; |
| 670 | 670 | return 0; |
| 671 | 671 | } |
@@ -675,12 +675,12 @@ discard block |
||
| 675 | 675 | |
| 676 | 676 | /* get all figures that attack the king */ |
| 677 | 677 | $attackers = array(); $count = 0; |
| 678 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 679 | - if ( $this->board[$i]{0} == $opp ) |
|
| 678 | + for ($i = 0; $i < 64; $i++) |
|
| 679 | + if ($this->board[$i]{0} == $opp) |
|
| 680 | 680 | { |
| 681 | - if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$king_pos)) || |
|
| 682 | - ($this->board[$i]{1}!='P' && |
|
| 683 | - $this->tileIsReachable($this->board[$i]{1},$i,$king_pos)) ) |
|
| 681 | + if (($this->board[$i]{1} == 'P' && $this->checkPawnAttack($i, $king_pos)) || |
|
| 682 | + ($this->board[$i]{1} != 'P' && |
|
| 683 | + $this->tileIsReachable($this->board[$i]{1},$i, $king_pos))) |
|
| 684 | 684 | { |
| 685 | 685 | $attackers[$count++] = $i; |
| 686 | 686 | } |
@@ -691,19 +691,19 @@ discard block |
||
| 691 | 691 | echo "Attackercount: ",count($attackers), " "; */ |
| 692 | 692 | |
| 693 | 693 | /* if more than one there is no chance to escape */ |
| 694 | - if ( $count > 1 ) return 1; |
|
| 694 | + if ($count > 1) return 1; |
|
| 695 | 695 | |
| 696 | 696 | /* check whether attacker can be killed by own figure */ |
| 697 | 697 | $dest_pos = $attackers[0]; |
| 698 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 699 | - if ( $this->board[$i]{0} == $player ) |
|
| 698 | + for ($i = 0; $i < 64; $i++) |
|
| 699 | + if ($this->board[$i]{0} == $player) |
|
| 700 | 700 | { |
| 701 | - if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$dest_pos)) || |
|
| 702 | - ($this->board[$i]{1}!='P' && $this->board[$i]{1}!='K' && |
|
| 703 | - $this->tileIsReachable($this->board[$i]{1},$i,$dest_pos)) || |
|
| 704 | - ($this->board[$i]{1}=='K' && |
|
| 705 | - $this->tileIsReachable($this->board[$i]{1},$i,$dest_pos) && |
|
| 706 | - !$this->tileIsUnderAttack($opp,$dest_pos)) ) |
|
| 701 | + if (($this->board[$i]{1} == 'P' && $this->checkPawnAttack($i, $dest_pos)) || |
|
| 702 | + ($this->board[$i]{1} != 'P' && $this->board[$i]{1} != 'K' && |
|
| 703 | + $this->tileIsReachable($this->board[$i]{1},$i, $dest_pos)) || |
|
| 704 | + ($this->board[$i]{1} == 'K' && |
|
| 705 | + $this->tileIsReachable($this->board[$i]{1},$i, $dest_pos) && |
|
| 706 | + !$this->tileIsUnderAttack($opp, $dest_pos))) |
|
| 707 | 707 | { |
| 708 | 708 | /* DEBUG: echo "candidate: $i "; */ |
| 709 | 709 | $can_kill_atk = 0; |
@@ -711,11 +711,11 @@ discard block |
||
| 711 | 711 | $contents_atk = $this->board[$dest_pos]; |
| 712 | 712 | $this->board[$dest_pos] = $this->board[$i]; |
| 713 | 713 | $this->clear_tile($i); |
| 714 | - if ( !$this->tileIsUnderAttack($opp,$king_pos) ) |
|
| 714 | + if (!$this->tileIsUnderAttack($opp, $king_pos)) |
|
| 715 | 715 | $can_kill_atk = 1; |
| 716 | 716 | $this->board[$i] = $contents_def; |
| 717 | 717 | $this->board[$dest_pos] = $contents_atk; |
| 718 | - if ( $can_kill_atk ) |
|
| 718 | + if ($can_kill_atk) |
|
| 719 | 719 | { |
| 720 | 720 | /* DEBUG: echo "$i can kill attacker"; */ |
| 721 | 721 | return 0; |
@@ -727,29 +727,29 @@ discard block |
||
| 727 | 727 | |
| 728 | 728 | /* if attacking unit is a knight there |
| 729 | 729 | * is no way to block the path */ |
| 730 | - if ( $this->board[$dest_pos]{1} == 'N' ) return 1; |
|
| 730 | + if ($this->board[$dest_pos]{1} == 'N') return 1; |
|
| 731 | 731 | |
| 732 | 732 | /* if enemy is adjacent to king there is no |
| 733 | 733 | * way either */ |
| 734 | 734 | $dest_x = $dest_pos % 8; |
| 735 | - $dest_y = floor($dest_pos/8); |
|
| 736 | - if ( abs($dest_x-$king_x)<=1 && abs($dest_y-$king_y)<=1 ) |
|
| 735 | + $dest_y = floor($dest_pos / 8); |
|
| 736 | + if (abs($dest_x - $king_x) <= 1 && abs($dest_y - $king_y) <= 1) |
|
| 737 | 737 | return 1; |
| 738 | 738 | |
| 739 | 739 | /* get the list of tiles between king and attacking |
| 740 | 740 | * unit that can be blocked to stop the attack */ |
| 741 | - $change = $this->getPathChange($this->board[$dest_pos]{1},$dest_pos,$king_pos); |
|
| 741 | + $change = $this->getPathChange($this->board[$dest_pos]{1},$dest_pos, $king_pos); |
|
| 742 | 742 | /* DEBUG: echo "path change: $change "; */ |
| 743 | - $path = $this->getPath($dest_pos+$change,$king_pos,$change); |
|
| 743 | + $path = $this->getPath($dest_pos + $change, $king_pos, $change); |
|
| 744 | 744 | /* DEBUG: foreach( $path as $tile ) echo "tile: $tile "; */ |
| 745 | - foreach( $path as $pos ) |
|
| 745 | + foreach ($path as $pos) |
|
| 746 | 746 | { |
| 747 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 748 | - if ( $this->board[$i]{0} == $player ) |
|
| 747 | + for ($i = 0; $i < 64; $i++) |
|
| 748 | + if ($this->board[$i]{0} == $player) |
|
| 749 | 749 | { |
| 750 | - if ( ($this->board[$i]{1}=='P' && $this->checkPawnMove($i,$pos)) || |
|
| 751 | - ($this->board[$i]{1}!='P' && $this->board[$i]{1}!='K' && |
|
| 752 | - $this->tileIsReachable($this->board[$i]{1},$i,$pos)) ) |
|
| 750 | + if (($this->board[$i]{1} == 'P' && $this->checkPawnMove($i, $pos)) || |
|
| 751 | + ($this->board[$i]{1} != 'P' && $this->board[$i]{1} != 'K' && |
|
| 752 | + $this->tileIsReachable($this->board[$i]{1},$i, $pos))) |
|
| 753 | 753 | { |
| 754 | 754 | /* DEBUG: echo "$i can block "; */ |
| 755 | 755 | return 0; |
@@ -772,61 +772,61 @@ discard block |
||
| 772 | 772 | */ |
| 773 | 773 | function isStaleMate($player, $opp) |
| 774 | 774 | { |
| 775 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 776 | - if ($this->board[$i]{0} == $player ) |
|
| 775 | + for ($i = 0; $i < 64; $i++) |
|
| 776 | + if ($this->board[$i]{0} == $player) |
|
| 777 | 777 | switch ($this->board[$i]{1} ) |
| 778 | 778 | { |
| 779 | 779 | case 'K': |
| 780 | - $adj_tiles = $this->getAdjTiles( $i ); |
|
| 781 | - foreach ( $adj_tiles as $pos ) |
|
| 780 | + $adj_tiles = $this->getAdjTiles($i); |
|
| 781 | + foreach ($adj_tiles as $pos) |
|
| 782 | 782 | { |
| 783 | - if ( $this->board[$pos]{0} == $player ) continue; |
|
| 784 | - if ( $this->tileIsUnderAttack($opp,$pos) ) continue; |
|
| 783 | + if ($this->board[$pos]{0} == $player) continue; |
|
| 784 | + if ($this->tileIsUnderAttack($opp, $pos)) continue; |
|
| 785 | 785 | return 0; |
| 786 | 786 | } |
| 787 | 787 | /* DEBUG: echo "King cannot escape by itself! "; */ |
| 788 | 788 | break; |
| 789 | 789 | case 'P': |
| 790 | - if ( $player == 'w' ) |
|
| 790 | + if ($player == 'w') |
|
| 791 | 791 | { |
| 792 | 792 | if ($this->is_empty_tile($i + 8)) return 0; |
| 793 | - if ( ($i%8) > 0 && $this->board[$i+7]{0} != $player ) return 0; |
|
| 794 | - if ( ($i%8) < 7 && $this->board[$i+9]{0} != $player ) return 0; |
|
| 793 | + if (($i % 8) > 0 && $this->board[$i + 7]{0} != $player) return 0; |
|
| 794 | + if (($i % 8) < 7 && $this->board[$i + 9]{0} != $player) return 0; |
|
| 795 | 795 | } |
| 796 | 796 | else |
| 797 | 797 | { |
| 798 | 798 | if ($this->is_empty_tile($i - 8)) return 0; |
| 799 | - if ( ($i%8) > 0 && $this->board[$i-9]{0} != $player ) return 0; |
|
| 800 | - if ( ($i%8) < 7 && $this->board[$i-7]{0} != $player ) return 0; |
|
| 799 | + if (($i % 8) > 0 && $this->board[$i - 9]{0} != $player) return 0; |
|
| 800 | + if (($i % 8) < 7 && $this->board[$i - 7]{0} != $player) return 0; |
|
| 801 | 801 | } |
| 802 | 802 | break; |
| 803 | 803 | case 'B': |
| 804 | - if ( $i-9 >= 0 && $this->board[$i-9]{0} != $player ) return 0; |
|
| 805 | - if ( $i-7 >= 0 && $this->board[$i-7]{0} != $player ) return 0; |
|
| 806 | - if ( $i+9 <= 63 && $this->board[$i+9]{0} != $player ) return 0; |
|
| 807 | - if ( $i+7 <= 63 && $this->board[$i+7]{0} != $player ) return 0; |
|
| 804 | + if ($i - 9 >= 0 && $this->board[$i - 9]{0} != $player) return 0; |
|
| 805 | + if ($i - 7 >= 0 && $this->board[$i - 7]{0} != $player) return 0; |
|
| 806 | + if ($i + 9 <= 63 && $this->board[$i + 9]{0} != $player) return 0; |
|
| 807 | + if ($i + 7 <= 63 && $this->board[$i + 7]{0} != $player) return 0; |
|
| 808 | 808 | break; |
| 809 | 809 | case 'R': |
| 810 | - if ( $i-8 >= 0 && $this->board[$i-8]{0} != $player ) return 0; |
|
| 811 | - if ( $i-1 >= 0 && $this->board[$i-1]{0} != $player ) return 0; |
|
| 812 | - if ( $i+8 <= 63 && $this->board[$i+8]{0} != $player ) return 0; |
|
| 813 | - if ( $i+1 <= 63 && $this->board[$i+1]{0} != $player ) return 0; |
|
| 810 | + if ($i - 8 >= 0 && $this->board[$i - 8]{0} != $player) return 0; |
|
| 811 | + if ($i - 1 >= 0 && $this->board[$i - 1]{0} != $player) return 0; |
|
| 812 | + if ($i + 8 <= 63 && $this->board[$i + 8]{0} != $player) return 0; |
|
| 813 | + if ($i + 1 <= 63 && $this->board[$i + 1]{0} != $player) return 0; |
|
| 814 | 814 | break; |
| 815 | 815 | case 'Q': |
| 816 | - $adj_tiles = $this->getAdjTiles( $i ); |
|
| 817 | - foreach ( $adj_tiles as $pos ) |
|
| 818 | - if ( $this->board[$pos]{0} != $player ) |
|
| 816 | + $adj_tiles = $this->getAdjTiles($i); |
|
| 817 | + foreach ($adj_tiles as $pos) |
|
| 818 | + if ($this->board[$pos]{0} != $player) |
|
| 819 | 819 | return 0; |
| 820 | 820 | break; |
| 821 | 821 | case 'N': |
| 822 | - if ( $i-17 >= 0 && $this->board[$i-17]{0} != $player ) return 0; |
|
| 823 | - if ( $i-15 >= 0 && $this->board[$i-15]{0} != $player ) return 0; |
|
| 824 | - if ( $i-6 >= 0 && $this->board[$i-6]{0} != $player ) return 0; |
|
| 825 | - if ( $i+10 <= 63 && $this->board[$i+10]{0} != $player ) return 0; |
|
| 826 | - if ( $i+17 <= 63 && $this->board[$i+17]{0} != $player ) return 0; |
|
| 827 | - if ( $i+15 <= 63 && $this->board[$i+15]{0} != $player ) return 0; |
|
| 828 | - if ( $i+6 <= 63 && $this->board[$i+6]{0} != $player ) return 0; |
|
| 829 | - if ( $i-10 >= 0 && $this->board[$i-10]{0} != $player ) return 0; |
|
| 822 | + if ($i - 17 >= 0 && $this->board[$i - 17]{0} != $player) return 0; |
|
| 823 | + if ($i - 15 >= 0 && $this->board[$i - 15]{0} != $player) return 0; |
|
| 824 | + if ($i - 6 >= 0 && $this->board[$i - 6]{0} != $player) return 0; |
|
| 825 | + if ($i + 10 <= 63 && $this->board[$i + 10]{0} != $player) return 0; |
|
| 826 | + if ($i + 17 <= 63 && $this->board[$i + 17]{0} != $player) return 0; |
|
| 827 | + if ($i + 15 <= 63 && $this->board[$i + 15]{0} != $player) return 0; |
|
| 828 | + if ($i + 6 <= 63 && $this->board[$i + 6]{0} != $player) return 0; |
|
| 829 | + if ($i - 10 >= 0 && $this->board[$i - 10]{0} != $player) return 0; |
|
| 830 | 830 | break; |
| 831 | 831 | } |
| 832 | 832 | |
@@ -888,12 +888,12 @@ discard block |
||
| 888 | 888 | |
| 889 | 889 | $this->ac_move = $move; |
| 890 | 890 | |
| 891 | - if ( strlen($move)>=6 ) |
|
| 891 | + if (strlen($move) >= 6) |
|
| 892 | 892 | { |
| 893 | 893 | /* full move: a pawn requires a ? in the end |
| 894 | 894 | * to automatically choose a queen on last line */ |
| 895 | - if ( $move[0] == 'P' ) |
|
| 896 | - if ( $move[strlen($move)-1]<'A' || $move[strlen($move)-1]>'Z' ) |
|
| 895 | + if ($move[0] == 'P') |
|
| 896 | + if ($move[strlen($move) - 1] < 'A' || $move[strlen($move) - 1] > 'Z') |
|
| 897 | 897 | $this->ac_move = "$move?"; |
| 898 | 898 | return ""; |
| 899 | 899 | } |
@@ -903,62 +903,62 @@ discard block |
||
| 903 | 903 | * when entering the last file. we split this character |
| 904 | 904 | * to keep the autocompletion process the same. */ |
| 905 | 905 | $pawn_upg = "?"; |
| 906 | - if ( $move[strlen($move)-1]>='A' && $move[strlen($move)-1]<='Z' ) |
|
| 906 | + if ($move[strlen($move) - 1] >= 'A' && $move[strlen($move) - 1] <= 'Z') |
|
| 907 | 907 | { |
| 908 | - $pawn_upg = $move[strlen($move)-1]; |
|
| 909 | - $move = substr( $move, 0, strlen($move)-1 ); |
|
| 908 | + $pawn_upg = $move[strlen($move) - 1]; |
|
| 909 | + $move = substr($move, 0, strlen($move) - 1); |
|
| 910 | 910 | } |
| 911 | 911 | // remove trailing '=', if present |
| 912 | - if ($move{strlen($move)-1} == '=') { |
|
| 913 | - $move = substr($move, 0, strlen($move)-1); |
|
| 912 | + if ($move{strlen($move) - 1} == '=') { |
|
| 913 | + $move = substr($move, 0, strlen($move) - 1); |
|
| 914 | 914 | } |
| 915 | - if ( $pawn_upg == "P" || $pawn_upg == "K" ) |
|
| 915 | + if ($pawn_upg == "P" || $pawn_upg == "K") |
|
| 916 | 916 | return _MD_CHESS_MOVE_PAWN_MAY_BECOME; // "A pawn may only become either a knight, a bishop, a rook or a queen!" |
| 917 | 917 | |
| 918 | - if ( $move[0]>='a' && $move[0]<='h' ) |
|
| 918 | + if ($move[0] >= 'a' && $move[0] <= 'h') |
|
| 919 | 919 | { |
| 920 | 920 | /* pawn move. either it's 2 or for characters as |
| 921 | 921 | * listed above */ |
| 922 | - if ( strlen($move) == 4 ) |
|
| 922 | + if (strlen($move) == 4) |
|
| 923 | 923 | { |
| 924 | - if ( $move[1] != 'x' ) |
|
| 924 | + if ($move[1] != 'x') |
|
| 925 | 925 | return _MD_CHESS_MOVE_USE_X; // "use x to indicate an attack" |
| 926 | 926 | $dest_x = $move[2]; |
| 927 | 927 | $dest_y = $move[3]; |
| 928 | 928 | $src_x = $move[0]; |
| 929 | - if ( $player == 'w' ) |
|
| 930 | - $src_y = $dest_y-1; |
|
| 929 | + if ($player == 'w') |
|
| 930 | + $src_y = $dest_y - 1; |
|
| 931 | 931 | else |
| 932 | - $src_y = $dest_y+1; |
|
| 933 | - $this->ac_move = sprintf( "P%s%dx%s%d%s", |
|
| 934 | - $src_x,$src_y,$dest_x,$dest_y, |
|
| 935 | - $pawn_upg ); |
|
| 932 | + $src_y = $dest_y + 1; |
|
| 933 | + $this->ac_move = sprintf("P%s%dx%s%d%s", |
|
| 934 | + $src_x, $src_y, $dest_x, $dest_y, |
|
| 935 | + $pawn_upg); |
|
| 936 | 936 | return ""; |
| 937 | 937 | } |
| 938 | 938 | else |
| 939 | - if (strlen($move) == 2 ) |
|
| 939 | + if (strlen($move) == 2) |
|
| 940 | 940 | { |
| 941 | - $fig = sprintf( "%sP", $player ); |
|
| 942 | - if ( $move[1] >= '1' && $move[1] <= '8' ) |
|
| 941 | + $fig = sprintf("%sP", $player); |
|
| 942 | + if ($move[1] >= '1' && $move[1] <= '8') |
|
| 943 | 943 | { |
| 944 | 944 | /* pawn move */ |
| 945 | - $pos = $this->boardCoordToIndex( $move ); |
|
| 946 | - if ( $pos == 64 ) return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move); // "coordinate $move is invalid" |
|
| 947 | - if ( $player == 'w' ) |
|
| 945 | + $pos = $this->boardCoordToIndex($move); |
|
| 946 | + if ($pos == 64) return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move); // "coordinate $move is invalid" |
|
| 947 | + if ($player == 'w') |
|
| 948 | 948 | { |
| 949 | - while( $pos >= 0 && $this->board[$pos] != $fig ) $pos -= 8; |
|
| 950 | - if ( $pos < 0 ) $not_found = 1; |
|
| 949 | + while ($pos >= 0 && $this->board[$pos] != $fig) $pos -= 8; |
|
| 950 | + if ($pos < 0) $not_found = 1; |
|
| 951 | 951 | } |
| 952 | 952 | else |
| 953 | 953 | { |
| 954 | - while( $pos <= 63 && $this->board[$pos] != $fig ) $pos += 8; |
|
| 955 | - if ( $pos > 63 ) $not_found = 1; |
|
| 954 | + while ($pos <= 63 && $this->board[$pos] != $fig) $pos += 8; |
|
| 955 | + if ($pos > 63) $not_found = 1; |
|
| 956 | 956 | } |
| 957 | - $pos = $this->boardIndexToCoord( $pos ); |
|
| 958 | - if ( (isset($not_found) && $not_found) || $pos == "" ) { |
|
| 957 | + $pos = $this->boardIndexToCoord($pos); |
|
| 958 | + if ((isset($not_found) && $not_found) || $pos == "") { |
|
| 959 | 959 | return $this->move_msg(_MD_CHESS_MOVE_CANNOT_FIND_PAWN, $player, $move[0]); // "cannot find $player pawn in column $move[0]" |
| 960 | 960 | } else { |
| 961 | - $this->ac_move = sprintf( "P%s-%s%s", $pos, $move, $pawn_upg ); |
|
| 961 | + $this->ac_move = sprintf("P%s-%s%s", $pos, $move, $pawn_upg); |
|
| 962 | 962 | return ""; |
| 963 | 963 | } |
| 964 | 964 | } |
@@ -966,30 +966,30 @@ discard block |
||
| 966 | 966 | { |
| 967 | 967 | /* notation: [a-h][a-h] for pawn attack no longer allowed |
| 968 | 968 | * except for history browser */ |
| 969 | - if ( $this->browsing_mode == 0 ) |
|
| 969 | + if ($this->browsing_mode == 0) |
|
| 970 | 970 | return _MD_CHESS_MOVE_USE_NOTATION; // "please use denotation [a-h]x[a-h][1-8] for pawn attacks (see help for more information)" |
| 971 | 971 | /* pawn attack must be only one pawn in column! */ |
| 972 | 972 | $pawns = 0; |
| 973 | - $start = $this->boardCoordToIndex( sprintf( "%s1", $move[0] ) ); |
|
| 974 | - if ( $start == 64 ) return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move[0]); // "coordinate $move[0] is invalid" |
|
| 975 | - for ( $i = 1; $i <= 8; $i++, $start+=8 ) |
|
| 976 | - if ( $this->board[$start] == $fig ) |
|
| 973 | + $start = $this->boardCoordToIndex(sprintf("%s1", $move[0])); |
|
| 974 | + if ($start == 64) return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move[0]); // "coordinate $move[0] is invalid" |
|
| 975 | + for ($i = 1; $i <= 8; $i++, $start += 8) |
|
| 976 | + if ($this->board[$start] == $fig) |
|
| 977 | 977 | { |
| 978 | 978 | $pawns++; |
| 979 | 979 | $pawn_line = $i; |
| 980 | 980 | } |
| 981 | - if ( $pawns == 0 ) |
|
| 981 | + if ($pawns == 0) |
|
| 982 | 982 | return $this->move_msg(_MD_CHESS_MOVE_NO_PAWN, $move[0]); // "there is no pawn in column $move[0]" |
| 983 | - else if ( $pawns > 1 ) |
|
| 983 | + else if ($pawns > 1) |
|
| 984 | 984 | return $this->move_msg(_MD_CHESS_MOVE_TWO_PAWNS, $move[0]); // "there is more than one pawn in column $move[0]" |
| 985 | 985 | else |
| 986 | 986 | { |
| 987 | - if ( $player == 'w' ) |
|
| 988 | - $dest_line = $pawn_line+1; |
|
| 987 | + if ($player == 'w') |
|
| 988 | + $dest_line = $pawn_line + 1; |
|
| 989 | 989 | else |
| 990 | - $dest_line = $pawn_line-1; |
|
| 991 | - $this->ac_move = sprintf( "P%s%dx%s%d", |
|
| 992 | - $move[0],$pawn_line,$move[1],$dest_line ); |
|
| 990 | + $dest_line = $pawn_line - 1; |
|
| 991 | + $this->ac_move = sprintf("P%s%dx%s%d", |
|
| 992 | + $move[0], $pawn_line, $move[1], $dest_line); |
|
| 993 | 993 | return ""; |
| 994 | 994 | } |
| 995 | 995 | } |
@@ -998,90 +998,90 @@ discard block |
||
| 998 | 998 | else |
| 999 | 999 | { |
| 1000 | 1000 | /* figure move */ |
| 1001 | - $dest_coord = substr( $move, strlen($move)-2, 2 ); |
|
| 1002 | - $action = $move[strlen($move)-3]; |
|
| 1003 | - if ( $action != 'x' ) $action = '-'; |
|
| 1004 | - if ( $player == 'w' ) |
|
| 1001 | + $dest_coord = substr($move, strlen($move) - 2, 2); |
|
| 1002 | + $action = $move[strlen($move) - 3]; |
|
| 1003 | + if ($action != 'x') $action = '-'; |
|
| 1004 | + if ($player == 'w') |
|
| 1005 | 1005 | $figures = $this->w_figures; |
| 1006 | 1006 | else |
| 1007 | 1007 | $figures = $this->b_figures; |
| 1008 | 1008 | $fig_count = 0; |
| 1009 | - foreach( $figures as $figure ) |
|
| 1010 | - if ( $figure[0] == $move[0] ) |
|
| 1009 | + foreach ($figures as $figure) |
|
| 1010 | + if ($figure[0] == $move[0]) |
|
| 1011 | 1011 | { |
| 1012 | 1012 | $fig_count++; |
| 1013 | - if ( $fig_count == 1 ) |
|
| 1014 | - $pos1 = substr( $figure, 1, 2 ); |
|
| 1013 | + if ($fig_count == 1) |
|
| 1014 | + $pos1 = substr($figure, 1, 2); |
|
| 1015 | 1015 | else |
| 1016 | - $pos2 = substr( $figure, 1, 2 ); |
|
| 1016 | + $pos2 = substr($figure, 1, 2); |
|
| 1017 | 1017 | } |
| 1018 | - if ( $fig_count == 0 ) |
|
| 1018 | + if ($fig_count == 0) |
|
| 1019 | 1019 | return $this->move_msg(_MD_CHESS_MOVE_NO_FIGURE, $move[0], $this->getFullFigureName($move[0])); // sprintf("there is no figure %s = %s", $move[0], $this->getFullFigureName($move[0])) |
| 1020 | 1020 | else |
| 1021 | - if ( $fig_count == 1 ) |
|
| 1021 | + if ($fig_count == 1) |
|
| 1022 | 1022 | { |
| 1023 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1024 | - $move[0], $pos1, $action, $dest_coord ); |
|
| 1023 | + $this->ac_move = sprintf("%s%s%s%s", |
|
| 1024 | + $move[0], $pos1, $action, $dest_coord); |
|
| 1025 | 1025 | return ""; |
| 1026 | 1026 | } |
| 1027 | 1027 | else |
| 1028 | 1028 | { |
| 1029 | 1029 | /* two figures which may cause ambiguity */ |
| 1030 | - $dest_pos = $this->boardCoordToIndex( $dest_coord ); |
|
| 1031 | - if ( $dest_pos == 64 ) |
|
| 1030 | + $dest_pos = $this->boardCoordToIndex($dest_coord); |
|
| 1031 | + if ($dest_pos == 64) |
|
| 1032 | 1032 | return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $dest_coord); // "coordinate $dest_coord is invalid" |
| 1033 | - $fig1_can_reach = $this->tileIsReachable( $move[0], |
|
| 1034 | - $this->boardCoordToIndex($pos1), $dest_pos ); |
|
| 1035 | - $fig2_can_reach = $this->tileIsReachable( $move[0], |
|
| 1036 | - $this->boardCoordToIndex($pos2), $dest_pos ); |
|
| 1037 | - if ( !$fig1_can_reach && !$fig2_can_reach ) |
|
| 1033 | + $fig1_can_reach = $this->tileIsReachable($move[0], |
|
| 1034 | + $this->boardCoordToIndex($pos1), $dest_pos); |
|
| 1035 | + $fig2_can_reach = $this->tileIsReachable($move[0], |
|
| 1036 | + $this->boardCoordToIndex($pos2), $dest_pos); |
|
| 1037 | + if (!$fig1_can_reach && !$fig2_can_reach) |
|
| 1038 | 1038 | return $this->move_msg(_MD_CHESS_MOVE_NEITHER_CAN_REACH, $move[0], $this->getFullFigureName($move[0]), $dest_coord); // sprintf("neither of the %s = %s can reach %s", $move[0], $this->getFullFigureName($move[0]), $dest_coord) |
| 1039 | 1039 | else |
| 1040 | - if ( $fig1_can_reach && $fig2_can_reach ) |
|
| 1040 | + if ($fig1_can_reach && $fig2_can_reach) |
|
| 1041 | 1041 | { |
| 1042 | 1042 | /* ambiguity - check whether a hint is given */ |
| 1043 | - if ( ($action=='-' && strlen($move)==4) || |
|
| 1044 | - ($action=='x' && strlen($move)==5) ) |
|
| 1043 | + if (($action == '-' && strlen($move) == 4) || |
|
| 1044 | + ($action == 'x' && strlen($move) == 5)) |
|
| 1045 | 1045 | $hint = $move[1]; |
| 1046 | - if ( empty($hint) ) |
|
| 1046 | + if (empty($hint)) |
|
| 1047 | 1047 | return $this->move_msg(_MD_CHESS_MOVE_BOTH_CAN_REACH, $move[0], $this->getFullFigureName($move[0]), $dest_coord); // sprintf("both of the %s = %s can reach %s", $move[0], $this->getFullFigureName($move[0]), $dest_coord) |
| 1048 | 1048 | else |
| 1049 | 1049 | { |
| 1050 | 1050 | $move_fig1 = 0; |
| 1051 | 1051 | $move_fig2 = 0; |
| 1052 | - if ( $hint>='1' && $hint<='8' ) |
|
| 1052 | + if ($hint >= '1' && $hint <= '8') |
|
| 1053 | 1053 | { |
| 1054 | - if ( $pos1[1]==$hint && $pos2[1]!=$hint ) |
|
| 1054 | + if ($pos1[1] == $hint && $pos2[1] != $hint) |
|
| 1055 | 1055 | $move_fig1 = 1; |
| 1056 | - if ( $pos2[1]==$hint && $pos1[1]!=$hint ) |
|
| 1056 | + if ($pos2[1] == $hint && $pos1[1] != $hint) |
|
| 1057 | 1057 | $move_fig2 = 1; |
| 1058 | 1058 | } |
| 1059 | 1059 | else |
| 1060 | 1060 | { |
| 1061 | - if ( $pos1[0]==$hint && $pos2[0]!=$hint ) |
|
| 1061 | + if ($pos1[0] == $hint && $pos2[0] != $hint) |
|
| 1062 | 1062 | $move_fig1 = 1; |
| 1063 | - if ( $pos2[0]==$hint && $pos1[0]!=$hint ) |
|
| 1063 | + if ($pos2[0] == $hint && $pos1[0] != $hint) |
|
| 1064 | 1064 | $move_fig2 = 1; |
| 1065 | 1065 | } |
| 1066 | - if ( !$move_fig1 && !$move_fig2 ) |
|
| 1066 | + if (!$move_fig1 && !$move_fig2) |
|
| 1067 | 1067 | return _MD_CHESS_MOVE_AMBIGUOUS; // "ambiguity is not properly resolved" |
| 1068 | - if ( $move_fig1 ) |
|
| 1069 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1070 | - $move[0], $pos1, $action, $dest_coord ); |
|
| 1068 | + if ($move_fig1) |
|
| 1069 | + $this->ac_move = sprintf("%s%s%s%s", |
|
| 1070 | + $move[0], $pos1, $action, $dest_coord); |
|
| 1071 | 1071 | else |
| 1072 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1073 | - $move[0], $pos2, $action, $dest_coord ); |
|
| 1072 | + $this->ac_move = sprintf("%s%s%s%s", |
|
| 1073 | + $move[0], $pos2, $action, $dest_coord); |
|
| 1074 | 1074 | return; |
| 1075 | 1075 | } |
| 1076 | 1076 | } |
| 1077 | 1077 | else |
| 1078 | 1078 | { |
| 1079 | - if ( $fig1_can_reach ) |
|
| 1080 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1081 | - $move[0], $pos1, $action, $dest_coord ); |
|
| 1079 | + if ($fig1_can_reach) |
|
| 1080 | + $this->ac_move = sprintf("%s%s%s%s", |
|
| 1081 | + $move[0], $pos1, $action, $dest_coord); |
|
| 1082 | 1082 | else |
| 1083 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1084 | - $move[0], $pos2, $action, $dest_coord ); |
|
| 1083 | + $this->ac_move = sprintf("%s%s%s%s", |
|
| 1084 | + $move[0], $pos2, $action, $dest_coord); |
|
| 1085 | 1085 | return ""; |
| 1086 | 1086 | } |
| 1087 | 1087 | } |
@@ -1109,36 +1109,36 @@ discard block |
||
| 1109 | 1109 | will overwrite it */ |
| 1110 | 1110 | |
| 1111 | 1111 | /* valid pawn moves are always non-ambigious */ |
| 1112 | - if ( $move[0] == 'P' ) |
|
| 1112 | + if ($move[0] == 'P') |
|
| 1113 | 1113 | { |
| 1114 | 1114 | /* skip P anycase. for attacks skip source digit |
| 1115 | 1115 | and for moves skip source pos and - */ |
| 1116 | - if ( $move[3] == '-' ) |
|
| 1117 | - $new_move = substr( $move, 4 ); |
|
| 1116 | + if ($move[3] == '-') |
|
| 1117 | + $new_move = substr($move, 4); |
|
| 1118 | 1118 | else |
| 1119 | - if ( $move[3] == 'x' ) |
|
| 1120 | - $new_move = sprintf("%s%s", $move[1], substr( $move, 3 ) ); |
|
| 1119 | + if ($move[3] == 'x') |
|
| 1120 | + $new_move = sprintf("%s%s", $move[1], substr($move, 3)); |
|
| 1121 | 1121 | } |
| 1122 | 1122 | else |
| 1123 | 1123 | { |
| 1124 | 1124 | /* try to remove the source position and check whether it |
| 1125 | 1125 | * is a non-ambigious move. if it is add one of the components |
| 1126 | 1126 | * and check again */ |
| 1127 | - if ( $move[3] == '-' ) |
|
| 1128 | - $dest = substr( $move, 4 ); |
|
| 1127 | + if ($move[3] == '-') |
|
| 1128 | + $dest = substr($move, 4); |
|
| 1129 | 1129 | else |
| 1130 | - if ( $move[3] == 'x' ) |
|
| 1131 | - $dest = substr( $move, 3 ); |
|
| 1132 | - $new_move = sprintf("%s%s", $move[0], $dest ); |
|
| 1133 | - if ( $this->completeMove($player,$new_move) != "" ) |
|
| 1130 | + if ($move[3] == 'x') |
|
| 1131 | + $dest = substr($move, 3); |
|
| 1132 | + $new_move = sprintf("%s%s", $move[0], $dest); |
|
| 1133 | + if ($this->completeMove($player, $new_move) != "") |
|
| 1134 | 1134 | { |
| 1135 | 1135 | /* add a component */ |
| 1136 | - $new_move = sprintf("%s%s%s", $move[0], $move[1], $dest ); |
|
| 1137 | - if ( $this->completeMove($player,$new_move) != "" ) |
|
| 1136 | + $new_move = sprintf("%s%s%s", $move[0], $move[1], $dest); |
|
| 1137 | + if ($this->completeMove($player, $new_move) != "") |
|
| 1138 | 1138 | { |
| 1139 | 1139 | /* add other component */ |
| 1140 | - $new_move = sprintf("%s%s%s", $move[0], $move[2], $dest ); |
|
| 1141 | - if ( $this->completeMove($player,$new_move) != "" ) |
|
| 1140 | + $new_move = sprintf("%s%s%s", $move[0], $move[2], $dest); |
|
| 1141 | + if ($this->completeMove($player, $new_move) != "") |
|
| 1142 | 1142 | $new_move = $move; /* give up */ |
| 1143 | 1143 | } |
| 1144 | 1144 | } |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | |
| 1229 | 1229 | /* short castling */ |
| 1230 | 1230 | |
| 1231 | - if ($cur_player=="b") { |
|
| 1231 | + if ($cur_player == "b") { |
|
| 1232 | 1232 | |
| 1233 | 1233 | if (!$black_may_castle_short) { |
| 1234 | 1234 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // You cannot castle short any longer! |
@@ -1236,10 +1236,10 @@ discard block |
||
| 1236 | 1236 | if (!$this->is_empty_tile(61) or !$this->is_empty_tile(62)) { |
| 1237 | 1237 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // Cannot castle short because the way is blocked! |
| 1238 | 1238 | } |
| 1239 | - if ($this->kingIsUnderAttack( "b", "w" )) { |
|
| 1239 | + if ($this->kingIsUnderAttack("b", "w")) { |
|
| 1240 | 1240 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // You cannot escape check by castling! |
| 1241 | 1241 | } |
| 1242 | - if ( $this->tileIsUnderAttack( "w", 62 ) || $this->tileIsUnderAttack( "w", 61 ) ) { |
|
| 1242 | + if ($this->tileIsUnderAttack("w", 62) || $this->tileIsUnderAttack("w", 61)) { |
|
| 1243 | 1243 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // A tile the king passes over or into would be under attack after short castling! |
| 1244 | 1244 | } |
| 1245 | 1245 | $this->clear_tile(60); |
@@ -1257,10 +1257,10 @@ discard block |
||
| 1257 | 1257 | if (!$this->is_empty_tile(5) or !$this->is_empty_tile(6)) { |
| 1258 | 1258 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // Cannot castle short because the way is blocked! |
| 1259 | 1259 | } |
| 1260 | - if ( $this->kingIsUnderAttack( "w", "b" ) ) { |
|
| 1260 | + if ($this->kingIsUnderAttack("w", "b")) { |
|
| 1261 | 1261 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // You cannot escape check by castling! |
| 1262 | 1262 | } |
| 1263 | - if ( $this->tileIsUnderAttack( "b", 5 ) || $this->tileIsUnderAttack( "b", 6 ) ) { |
|
| 1263 | + if ($this->tileIsUnderAttack("b", 5) || $this->tileIsUnderAttack("b", 6)) { |
|
| 1264 | 1264 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // A tile the king passes over or into would be under attack after short castling! |
| 1265 | 1265 | } |
| 1266 | 1266 | $this->clear_tile(4); |
@@ -1278,7 +1278,7 @@ discard block |
||
| 1278 | 1278 | |
| 1279 | 1279 | /* long castling */ |
| 1280 | 1280 | |
| 1281 | - if ($cur_player=="b") { |
|
| 1281 | + if ($cur_player == "b") { |
|
| 1282 | 1282 | |
| 1283 | 1283 | if (!$black_may_castle_long) { |
| 1284 | 1284 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // You cannot castle long any longer! |
@@ -1286,10 +1286,10 @@ discard block |
||
| 1286 | 1286 | if (!$this->is_empty_tile(57) or !$this->is_empty_tile(58) or !$this->is_empty_tile(59)) { |
| 1287 | 1287 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // Cannot castle long because the way is blocked! |
| 1288 | 1288 | } |
| 1289 | - if ( $this->kingIsUnderAttack( "b", "w" ) ) { |
|
| 1289 | + if ($this->kingIsUnderAttack("b", "w")) { |
|
| 1290 | 1290 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // You cannot escape check by castling! |
| 1291 | 1291 | } |
| 1292 | - if ( $this->tileIsUnderAttack( "w", 58 ) || $this->tileIsUnderAttack( "w", 59 ) ) { |
|
| 1292 | + if ($this->tileIsUnderAttack("w", 58) || $this->tileIsUnderAttack("w", 59)) { |
|
| 1293 | 1293 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // A tile the king passes over or into would be under attack after short castling! |
| 1294 | 1294 | } |
| 1295 | 1295 | $this->clear_tile(56); |
@@ -1307,10 +1307,10 @@ discard block |
||
| 1307 | 1307 | if (!$this->is_empty_tile(1) or !$this->is_empty_tile(2) or !$this->is_empty_tile(3)) { |
| 1308 | 1308 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // Cannot castle long because the way is blocked! |
| 1309 | 1309 | } |
| 1310 | - if ($this->kingIsUnderAttack( "w", "b" )) { |
|
| 1310 | + if ($this->kingIsUnderAttack("w", "b")) { |
|
| 1311 | 1311 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // You cannot escape check by castling! |
| 1312 | 1312 | } |
| 1313 | - if ( $this->tileIsUnderAttack( "b", 2 ) || $this->tileIsUnderAttack( "b", 3 ) ) { |
|
| 1313 | + if ($this->tileIsUnderAttack("b", 2) || $this->tileIsUnderAttack("b", 3)) { |
|
| 1314 | 1314 | return(array(false, _MD_CHESS_MOVE_NO_CASTLE)); // A tile the king passes over or into would be under attack after short castling! |
| 1315 | 1315 | } |
| 1316 | 1316 | $this->clear_tile(0); |
@@ -1331,56 +1331,56 @@ discard block |
||
| 1331 | 1331 | |
| 1332 | 1332 | /* allow short move description by autocompleting to |
| 1333 | 1333 | * full description */ |
| 1334 | - $ac_error = $this->completeMove( $cur_player, trim($move) ); |
|
| 1335 | - if ( $ac_error != "" ) |
|
| 1334 | + $ac_error = $this->completeMove($cur_player, trim($move)); |
|
| 1335 | + if ($ac_error != "") |
|
| 1336 | 1336 | return(array(false, $ac_error)); // "ERROR: autocomplete: $ac_error" |
| 1337 | 1337 | else |
| 1338 | 1338 | $move = $this->ac_move; |
| 1339 | - $this->last_move = str_replace( "?", "", $move ); |
|
| 1339 | + $this->last_move = str_replace("?", "", $move); |
|
| 1340 | 1340 | |
| 1341 | 1341 | /* a final captial letter may only be N,B,R,Q for the |
| 1342 | 1342 | * appropiate chessman */ |
| 1343 | - $c = $move[strlen($move)-1]; |
|
| 1344 | - if ( $c >= 'A' && $c <= 'Z' ) |
|
| 1345 | - if ( $c != 'N' && $c != 'B' && $c != 'R' && $c != 'Q' ) |
|
| 1343 | + $c = $move[strlen($move) - 1]; |
|
| 1344 | + if ($c >= 'A' && $c <= 'Z') |
|
| 1345 | + if ($c != 'N' && $c != 'B' && $c != 'R' && $c != 'Q') |
|
| 1346 | 1346 | return(array(false, _MD_CHESS_MOVE_INVALID_PIECE)); // "ERROR: only N (knight), B (bishop), R (rook) and Q (queen) are valid chessman identifiers" |
| 1347 | 1347 | |
| 1348 | 1348 | /* if it is a full move, try to shorten the history move */ |
| 1349 | - if ( strlen( $history_move ) >= 6 ) |
|
| 1349 | + if (strlen($history_move) >= 6) |
|
| 1350 | 1350 | $history_move = |
| 1351 | - $this->convertFullToChessNotation($cur_player,$history_move); |
|
| 1351 | + $this->convertFullToChessNotation($cur_player, $history_move); |
|
| 1352 | 1352 | /* DEBUG: echo "Move: $move ($history_move)<BR>"; */ |
| 1353 | 1353 | |
| 1354 | 1354 | /* validate figure and position */ |
| 1355 | 1355 | $fig_type = $move[0]; |
| 1356 | - $fig_name = $this->getFullFigureName( $fig_type ); |
|
| 1357 | - if ( $fig_name == "empty" ) |
|
| 1356 | + $fig_name = $this->getFullFigureName($fig_type); |
|
| 1357 | + if ($fig_name == "empty") |
|
| 1358 | 1358 | return(array(false, $this->move_msg(_MD_CHESS_MOVE_UNKNOWN_FIGURE, $fig_type))); // "ERROR: Figure $fig_type is unknown!" |
| 1359 | - $fig_coord = substr($move,1,2); |
|
| 1360 | - $fig_pos = $this->boardCoordToIndex( $fig_coord ); |
|
| 1361 | - if ( $fig_pos == 64 ) return(array(false, $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $fig_coord))); // "ERROR: $fig_coord is invalid!" |
|
| 1359 | + $fig_coord = substr($move, 1, 2); |
|
| 1360 | + $fig_pos = $this->boardCoordToIndex($fig_coord); |
|
| 1361 | + if ($fig_pos == 64) return(array(false, $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $fig_coord))); // "ERROR: $fig_coord is invalid!" |
|
| 1362 | 1362 | /* DEBUG echo "fig_type: $fig_type, fig_pos: $fig_pos<BR>"; */ |
| 1363 | 1363 | if ($this->is_empty_tile($fig_pos)) |
| 1364 | 1364 | return(array(false, $this->move_msg(_MD_CHESS_MOVE_TILE_EMPTY, $fig_coord))); // "ERROR: Tile $fig_coord is empty." |
| 1365 | - if ( $this->board[$fig_pos]{0} != $cur_player ) |
|
| 1365 | + if ($this->board[$fig_pos]{0} != $cur_player) |
|
| 1366 | 1366 | return(array(false, _MD_CHESS_MOVE_NOT_YOUR_PIECE)); // "ERROR: Figure does not belong to you!" |
| 1367 | - if ( $this->board[$fig_pos]{1} != $fig_type ) |
|
| 1367 | + if ($this->board[$fig_pos]{1} != $fig_type) |
|
| 1368 | 1368 | return(array(false, _MD_CHESS_MOVE_NOEXIST_FIGURE)); // "ERROR: Figure does not exist!" |
| 1369 | 1369 | |
| 1370 | 1370 | /* get target index */ |
| 1371 | - $dest_coord = substr($move,4,2); |
|
| 1372 | - $dest_pos = $this->boardCoordToIndex( $dest_coord ); |
|
| 1373 | - if ( $dest_pos == 64 ) |
|
| 1371 | + $dest_coord = substr($move, 4, 2); |
|
| 1372 | + $dest_pos = $this->boardCoordToIndex($dest_coord); |
|
| 1373 | + if ($dest_pos == 64) |
|
| 1374 | 1374 | return(array(false, $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $dest_coord))); // "ERROR: $dest_coord is invalid!" |
| 1375 | - if ( $dest_pos == $fig_pos ) |
|
| 1375 | + if ($dest_pos == $fig_pos) |
|
| 1376 | 1376 | return(array(false, _MD_CHESS_MOVE_START_END_SAME)); |
| 1377 | 1377 | /* DEBUG echo "dest_pos: $dest_pos<BR>"; */ |
| 1378 | 1378 | |
| 1379 | 1379 | /* get action */ |
| 1380 | 1380 | $action = $move[3]; |
| 1381 | - if ( $move[3] == "-" ) |
|
| 1381 | + if ($move[3] == "-") |
|
| 1382 | 1382 | $action = 'M'; /* move */ |
| 1383 | - else if ( $move[3] == 'x' ) |
|
| 1383 | + else if ($move[3] == 'x') |
|
| 1384 | 1384 | $action = 'A'; /* attack */ |
| 1385 | 1385 | else |
| 1386 | 1386 | return(array(false, $this->move_msg(_MD_CHESS_MOVE_UNKNOWN_ACTION, $action))); // "ERROR: $action is unknown! Please use \"-\" for a move and \"x\" for an attack." |
@@ -1393,26 +1393,26 @@ discard block |
||
| 1393 | 1393 | * whether all tiles in between are empty thus the path |
| 1394 | 1394 | * is not blocked. the final destination tile is not |
| 1395 | 1395 | * checked here. */ |
| 1396 | - if ( $fig_type != 'P' ) |
|
| 1396 | + if ($fig_type != 'P') |
|
| 1397 | 1397 | { |
| 1398 | - if ( !$this->tileIsReachable( $fig_type, $fig_pos, $dest_pos ) ) |
|
| 1398 | + if (!$this->tileIsReachable($fig_type, $fig_pos, $dest_pos)) |
|
| 1399 | 1399 | return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of moving range for $fig_name at $fig_coord!" |
| 1400 | 1400 | } |
| 1401 | 1401 | else { |
| 1402 | - if ( $action == 'M' && !$this->checkPawnMove( $fig_pos, $dest_pos ) ) |
|
| 1402 | + if ($action == 'M' && !$this->checkPawnMove($fig_pos, $dest_pos)) |
|
| 1403 | 1403 | return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of moving range for $fig_name at $fig_coord!" |
| 1404 | - if ( $action == 'A' && !$this->checkPawnAttack( $fig_pos, $dest_pos ) ) |
|
| 1404 | + if ($action == 'A' && !$this->checkPawnAttack($fig_pos, $dest_pos)) |
|
| 1405 | 1405 | return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of attacking range for $fig_name at $fig_coord!" |
| 1406 | 1406 | } |
| 1407 | 1407 | |
| 1408 | 1408 | $en_passant_capture_performed = 0; // 1 if en passant captured occurred, else 0 |
| 1409 | 1409 | /* check action */ |
| 1410 | - if ( $action == 'M' && !$this->is_empty_tile($dest_pos)) { |
|
| 1410 | + if ($action == 'M' && !$this->is_empty_tile($dest_pos)) { |
|
| 1411 | 1411 | return(array(false, $this->move_msg(_MD_CHESS_MOVE_OCCUPIED, $dest_coord))); // "ERROR: Tile $dest_coord is occupied. You cannot move there." |
| 1412 | 1412 | } |
| 1413 | - if ( $action == 'A' && $this->is_empty_tile($dest_pos)) { |
|
| 1413 | + if ($action == 'A' && $this->is_empty_tile($dest_pos)) { |
|
| 1414 | 1414 | /* en passant of pawn? */ |
| 1415 | - if ( $fig_type == 'P' ) { |
|
| 1415 | + if ($fig_type == 'P') { |
|
| 1416 | 1416 | if ($this->boardIndexToCoord($dest_pos) == $this->gamestate['fen_en_passant_target_square']) { |
| 1417 | 1417 | $en_passant_capture_performed = 1; |
| 1418 | 1418 | } |
@@ -1423,7 +1423,7 @@ discard block |
||
| 1423 | 1423 | return(array(false, $this->move_msg(_MD_CHESS_MOVE_ATTACK_EMPTY, $dest_coord))); // "ERROR: Tile $dest_coord is empty. You cannot attack it." |
| 1424 | 1424 | } |
| 1425 | 1425 | } |
| 1426 | - if ( $action == 'A' && $this->board[$dest_pos]{0} == $cur_player ) { |
|
| 1426 | + if ($action == 'A' && $this->board[$dest_pos]{0} == $cur_player) { |
|
| 1427 | 1427 | return(array(false, $this->move_msg(_MD_CHESS_MOVE_ATTACK_SELF, $dest_coord))); // "ERROR: You cannot attack own unit at $dest_coord." |
| 1428 | 1428 | } |
| 1429 | 1429 | |
@@ -1434,33 +1434,33 @@ discard block |
||
| 1434 | 1434 | /* perform move */ |
| 1435 | 1435 | $this->clear_tile($fig_pos); |
| 1436 | 1436 | if (!$this->is_empty_tile($dest_pos)) |
| 1437 | - $this->piece_captured = sprintf("%s%s",$this->board[$dest_pos],$dest_pos); |
|
| 1437 | + $this->piece_captured = sprintf("%s%s", $this->board[$dest_pos], $dest_pos); |
|
| 1438 | 1438 | $this->board[$dest_pos] = "$cur_player$fig_type"; |
| 1439 | - if ( $en_passant_capture_performed ) { |
|
| 1439 | + if ($en_passant_capture_performed) { |
|
| 1440 | 1440 | /* kill pawn */ |
| 1441 | - if ( $cur_player == 'w' ) |
|
| 1441 | + if ($cur_player == 'w') |
|
| 1442 | 1442 | { |
| 1443 | 1443 | $this->clear_tile($dest_pos - 8); |
| 1444 | - $this->piece_captured = sprintf("bP%s",$dest_pos-8); |
|
| 1444 | + $this->piece_captured = sprintf("bP%s", $dest_pos - 8); |
|
| 1445 | 1445 | } |
| 1446 | 1446 | else |
| 1447 | 1447 | { |
| 1448 | 1448 | $this->clear_tile($dest_pos + 8); |
| 1449 | - $this->piece_captured = sprintf("wP%s",$dest_pos+8); |
|
| 1449 | + $this->piece_captured = sprintf("wP%s", $dest_pos + 8); |
|
| 1450 | 1450 | } |
| 1451 | 1451 | } |
| 1452 | 1452 | |
| 1453 | 1453 | /* check check :) */ |
| 1454 | - if ( $this->kingIsUnderAttack( $cur_player, $cur_opp ) ) |
|
| 1454 | + if ($this->kingIsUnderAttack($cur_player, $cur_opp)) |
|
| 1455 | 1455 | { |
| 1456 | 1456 | $this->board[$fig_pos] = $old_fig_tile; |
| 1457 | 1457 | $this->board[$dest_pos] = $old_dest_tile; |
| 1458 | - if ( $en_passant_capture_performed ) { |
|
| 1458 | + if ($en_passant_capture_performed) { |
|
| 1459 | 1459 | // restore pawn that was captured above, since that move is invalid |
| 1460 | - if ( $cur_player == 'w' ) |
|
| 1461 | - $this->board[$dest_pos-8] = "bP"; |
|
| 1460 | + if ($cur_player == 'w') |
|
| 1461 | + $this->board[$dest_pos - 8] = "bP"; |
|
| 1462 | 1462 | else |
| 1463 | - $this->board[$dest_pos+8] = "wP"; |
|
| 1463 | + $this->board[$dest_pos + 8] = "wP"; |
|
| 1464 | 1464 | } |
| 1465 | 1465 | return(array(false, _MD_CHESS_MOVE_IN_CHECK)); // "ERROR: Move is invalid because king would be under attack then." |
| 1466 | 1466 | } |
@@ -1495,31 +1495,31 @@ discard block |
||
| 1495 | 1495 | // if a pawn moved two tiles, this will allow 'en passant' on next move |
| 1496 | 1496 | if ($fig_type == 'P' and abs($fig_pos - $dest_pos) == 16) { |
| 1497 | 1497 | $file_chars = 'abcdefgh'; |
| 1498 | - $this->gamestate['fen_en_passant_target_square'] = $file_chars{$fig_pos % 8} . ($cur_player == 'w' ? '3' : '6'); |
|
| 1498 | + $this->gamestate['fen_en_passant_target_square'] = $file_chars{$fig_pos % 8}.($cur_player == 'w' ? '3' : '6'); |
|
| 1499 | 1499 | } else { |
| 1500 | 1500 | // clear 'en passant' |
| 1501 | 1501 | $this->gamestate['fen_en_passant_target_square'] = '-'; |
| 1502 | 1502 | } |
| 1503 | 1503 | |
| 1504 | - if ($action == 'M' ) |
|
| 1504 | + if ($action == 'M') |
|
| 1505 | 1505 | $result = $this->move_msg(_MD_CHESS_MOVE_MOVED, $fig_name, $fig_coord, $dest_coord); |
| 1506 | 1506 | else |
| 1507 | 1507 | $result = $this->move_msg(_MD_CHESS_MOVE_CAPTURED, $fig_name, $dest_coord, $fig_coord); |
| 1508 | 1508 | |
| 1509 | 1509 | /* if pawn reached last line convert into a queen */ |
| 1510 | - if ( $fig_type == 'P' ) |
|
| 1510 | + if ($fig_type == 'P') |
|
| 1511 | 1511 | { |
| 1512 | - if ( ($cur_player=='w' && $dest_pos>= 56) || |
|
| 1513 | - ($cur_player=='b' && $dest_pos<= 7 ) ) |
|
| 1512 | + if (($cur_player == 'w' && $dest_pos >= 56) || |
|
| 1513 | + ($cur_player == 'b' && $dest_pos <= 7)) |
|
| 1514 | 1514 | { |
| 1515 | - $pawn_upg = $move[strlen($move)-1]; |
|
| 1516 | - if ( $pawn_upg == '?' ) |
|
| 1515 | + $pawn_upg = $move[strlen($move) - 1]; |
|
| 1516 | + if ($pawn_upg == '?') |
|
| 1517 | 1517 | { |
| 1518 | 1518 | $pawn_upg = 'Q'; |
| 1519 | - $history_move = sprintf( "%sQ", $history_move ); |
|
| 1519 | + $history_move = sprintf("%sQ", $history_move); |
|
| 1520 | 1520 | } |
| 1521 | 1521 | $this->board[$dest_pos] = "$cur_player$pawn_upg"; |
| 1522 | - $result .= ' ... ' . $this->move_msg(_MD_CHESS_MOVE_PROMOTED, $this->getFullFigureName($pawn_upg)); |
|
| 1522 | + $result .= ' ... '.$this->move_msg(_MD_CHESS_MOVE_PROMOTED, $this->getFullFigureName($pawn_upg)); |
|
| 1523 | 1523 | } |
| 1524 | 1524 | } |
| 1525 | 1525 | |
@@ -1538,28 +1538,28 @@ discard block |
||
| 1538 | 1538 | |
| 1539 | 1539 | // handle check, checkmate and stalemate |
| 1540 | 1540 | $comment = ''; |
| 1541 | - if ($this->kingIsUnderAttack( $cur_opp, $cur_player)) { |
|
| 1541 | + if ($this->kingIsUnderAttack($cur_opp, $cur_player)) { |
|
| 1542 | 1542 | // if this is check mate finish the game, otherwise if not just add a + to the move |
| 1543 | 1543 | if ($this->isCheckMate($cur_opp, $cur_player)) { |
| 1544 | 1544 | $this->gamestate['pgn_result'] = $cur_player == 'w' ? '1-0' : '0-1'; |
| 1545 | 1545 | $history_move .= '#'; |
| 1546 | - $result .= ' ... ' . _MD_CHESS_MOVE_CHECKMATE; |
|
| 1546 | + $result .= ' ... '._MD_CHESS_MOVE_CHECKMATE; |
|
| 1547 | 1547 | } else { |
| 1548 | 1548 | $history_move .= '+'; |
| 1549 | 1549 | } |
| 1550 | 1550 | } elseif ($this->isStaleMate($cur_opp, $cur_player)) { |
| 1551 | 1551 | $this->gamestate['pgn_result'] = '1/2-1/2'; |
| 1552 | - $result .= ' ... ' . _MD_CHESS_MOVE_STALEMATE; |
|
| 1552 | + $result .= ' ... '._MD_CHESS_MOVE_STALEMATE; |
|
| 1553 | 1553 | $comment = _MD_CHESS_DRAW_STALEMATE; |
| 1554 | 1554 | } elseif ($this->insufficient_mating_material()) { |
| 1555 | 1555 | $this->gamestate['pgn_result'] = '1/2-1/2'; |
| 1556 | - $result .= ' ... ' . _MD_CHESS_MOVE_MATERIAL; |
|
| 1556 | + $result .= ' ... '._MD_CHESS_MOVE_MATERIAL; |
|
| 1557 | 1557 | $comment = _MD_CHESS_DRAW_NO_MATE; |
| 1558 | 1558 | } |
| 1559 | 1559 | |
| 1560 | 1560 | // store possible castling-availability modification |
| 1561 | - $KQkq = ($white_may_castle_short ? 'K' : '') . ($white_may_castle_long ? 'Q' : '') |
|
| 1562 | - . ($black_may_castle_short ? 'k' : '') . ($black_may_castle_long ? 'q' : ''); |
|
| 1561 | + $KQkq = ($white_may_castle_short ? 'K' : '').($white_may_castle_long ? 'Q' : '') |
|
| 1562 | + . ($black_may_castle_short ? 'k' : '').($black_may_castle_long ? 'q' : ''); |
|
| 1563 | 1563 | $this->gamestate['fen_castling_availability'] = !empty($KQkq) ? $KQkq : '-'; |
| 1564 | 1564 | |
| 1565 | 1565 | // strip old result-string from end of movetext |
@@ -1572,18 +1572,18 @@ discard block |
||
| 1572 | 1572 | if (!empty($this->gamestate['pgn_movetext'])) { |
| 1573 | 1573 | $this->gamestate['pgn_movetext'] .= ' '; |
| 1574 | 1574 | } |
| 1575 | - $this->gamestate['pgn_movetext'] .= $this->gamestate['fen_fullmove_number'] . '.'; |
|
| 1575 | + $this->gamestate['pgn_movetext'] .= $this->gamestate['fen_fullmove_number'].'.'; |
|
| 1576 | 1576 | |
| 1577 | 1577 | // if black move, no moves yet, and game is setup, output move number with special '...' terminator |
| 1578 | 1578 | } elseif (empty($this->gamestate['pgn_movetext']) and !empty($this->gamestate['pgn_fen'])) { |
| 1579 | - $this->gamestate['pgn_movetext'] .= $this->gamestate['fen_fullmove_number'] . '...'; |
|
| 1579 | + $this->gamestate['pgn_movetext'] .= $this->gamestate['fen_fullmove_number'].'...'; |
|
| 1580 | 1580 | } |
| 1581 | 1581 | |
| 1582 | 1582 | // update movetext |
| 1583 | 1583 | // comment is added only for a concluded game |
| 1584 | - $this->gamestate['pgn_movetext'] .= ' ' . $history_move . ' ' . $this->gamestate['pgn_result']; |
|
| 1584 | + $this->gamestate['pgn_movetext'] .= ' '.$history_move.' '.$this->gamestate['pgn_result']; |
|
| 1585 | 1585 | if (!empty($comment)) { |
| 1586 | - $this->gamestate['pgn_movetext'] .= ' {' . $comment . '}'; |
|
| 1586 | + $this->gamestate['pgn_movetext'] .= ' {'.$comment.'}'; |
|
| 1587 | 1587 | } |
| 1588 | 1588 | |
| 1589 | 1589 | // if black move, increment move-number |
@@ -1676,9 +1676,9 @@ discard block |
||
| 1676 | 1676 | $tile = $this->board[$i]; |
| 1677 | 1677 | $coordinates = $this->boardIndexToCoord($i); |
| 1678 | 1678 | if ($tile{0} == 'w') { |
| 1679 | - $this->w_figures[] = $tile{1} . $coordinates; |
|
| 1679 | + $this->w_figures[] = $tile{1}.$coordinates; |
|
| 1680 | 1680 | } elseif ($tile{0} == 'b') { |
| 1681 | - $this->b_figures[] = $tile{1} . $coordinates; |
|
| 1681 | + $this->b_figures[] = $tile{1}.$coordinates; |
|
| 1682 | 1682 | } |
| 1683 | 1683 | } |
| 1684 | 1684 | |
@@ -1711,7 +1711,7 @@ discard block |
||
| 1711 | 1711 | } |
| 1712 | 1712 | // Concatenate the eight row-strings with the separator '/'. |
| 1713 | 1713 | // Then replace each string of x's with the string length. |
| 1714 | - $this->gamestate['fen_piece_placement'] = preg_replace_callback('/(x+)/', create_function('$matches','return strlen($matches[1]);'), implode('/', $rows)); |
|
| 1714 | + $this->gamestate['fen_piece_placement'] = preg_replace_callback('/(x+)/', create_function('$matches', 'return strlen($matches[1]);'), implode('/', $rows)); |
|
| 1715 | 1715 | } |
| 1716 | 1716 | |
| 1717 | 1717 | /** |
@@ -1747,10 +1747,10 @@ discard block |
||
| 1747 | 1747 | * |
| 1748 | 1748 | * @access private |
| 1749 | 1749 | */ |
| 1750 | -function boardCoordToIndex( $coord ) |
|
| 1750 | +function boardCoordToIndex($coord) |
|
| 1751 | 1751 | { |
| 1752 | 1752 | //echo $coord," --> "; |
| 1753 | - switch ( $coord[0] ) |
|
| 1753 | + switch ($coord[0]) |
|
| 1754 | 1754 | { |
| 1755 | 1755 | case 'a': $x = 0; break; |
| 1756 | 1756 | case 'b': $x = 1; break; |
@@ -1762,8 +1762,8 @@ discard block |
||
| 1762 | 1762 | case 'h': $x = 7; break; |
| 1763 | 1763 | default: return 64; /* erronous coord */ |
| 1764 | 1764 | } |
| 1765 | - $y = $coord[1]-1; |
|
| 1766 | - if ( $y < 0 || $y > 7 ) |
|
| 1765 | + $y = $coord[1] - 1; |
|
| 1766 | + if ($y < 0 || $y > 7) |
|
| 1767 | 1767 | return 64; /* erronous coord */ |
| 1768 | 1768 | $index = $y * 8 + $x; |
| 1769 | 1769 | //echo "$index | "; |
@@ -1778,13 +1778,13 @@ discard block |
||
| 1778 | 1778 | * |
| 1779 | 1779 | * @access private |
| 1780 | 1780 | */ |
| 1781 | -function boardIndexToCoord( $index ) |
|
| 1781 | +function boardIndexToCoord($index) |
|
| 1782 | 1782 | { |
| 1783 | 1783 | //echo $index," --> "; |
| 1784 | - if ( $index < 0 || $index > 63 ) |
|
| 1784 | + if ($index < 0 || $index > 63) |
|
| 1785 | 1785 | return ""; |
| 1786 | - $y = floor($index/8)+1; |
|
| 1787 | - $x = chr( ($index%8)+97 ); |
|
| 1786 | + $y = floor($index / 8) + 1; |
|
| 1787 | + $x = chr(($index % 8) + 97); |
|
| 1788 | 1788 | $coord = "$x$y"; |
| 1789 | 1789 | //echo "$coord | "; |
| 1790 | 1790 | return $coord; |
@@ -1798,7 +1798,7 @@ discard block |
||
| 1798 | 1798 | * |
| 1799 | 1799 | * @access private |
| 1800 | 1800 | */ |
| 1801 | -function getFullFigureName( $short ) |
|
| 1801 | +function getFullFigureName($short) |
|
| 1802 | 1802 | { |
| 1803 | 1803 | static $names = array( |
| 1804 | 1804 | 'K' => _MD_CHESS_MOVE_KING, |
@@ -1819,20 +1819,20 @@ discard block |
||
| 1819 | 1819 | * |
| 1820 | 1820 | * @access private |
| 1821 | 1821 | */ |
| 1822 | -function getAdjTiles( $fig_pos ) |
|
| 1822 | +function getAdjTiles($fig_pos) |
|
| 1823 | 1823 | { |
| 1824 | 1824 | $adj_tiles = array(); $i = 0; |
| 1825 | 1825 | |
| 1826 | - $x = $fig_pos % 8; $y = floor( $fig_pos / 8 ); |
|
| 1826 | + $x = $fig_pos % 8; $y = floor($fig_pos / 8); |
|
| 1827 | 1827 | |
| 1828 | - if ( $x > 0 && $y > 0 ) $adj_tiles[$i++] = $fig_pos-9; |
|
| 1829 | - if ( $y > 0 ) $adj_tiles[$i++] = $fig_pos-8; |
|
| 1830 | - if ( $x < 7 && $y > 0 ) $adj_tiles[$i++] = $fig_pos-7; |
|
| 1831 | - if ( $x < 7 ) $adj_tiles[$i++] = $fig_pos+1; |
|
| 1832 | - if ( $x < 7 && $y < 7 ) $adj_tiles[$i++] = $fig_pos+9; |
|
| 1833 | - if ( $y < 7 ) $adj_tiles[$i++] = $fig_pos+8; |
|
| 1834 | - if ( $x > 0 && $y < 7 ) $adj_tiles[$i++] = $fig_pos+7; |
|
| 1835 | - if ( $x > 0 ) $adj_tiles[$i++] = $fig_pos-1; |
|
| 1828 | + if ($x > 0 && $y > 0) $adj_tiles[$i++] = $fig_pos - 9; |
|
| 1829 | + if ($y > 0) $adj_tiles[$i++] = $fig_pos - 8; |
|
| 1830 | + if ($x < 7 && $y > 0) $adj_tiles[$i++] = $fig_pos - 7; |
|
| 1831 | + if ($x < 7) $adj_tiles[$i++] = $fig_pos + 1; |
|
| 1832 | + if ($x < 7 && $y < 7) $adj_tiles[$i++] = $fig_pos + 9; |
|
| 1833 | + if ($y < 7) $adj_tiles[$i++] = $fig_pos + 8; |
|
| 1834 | + if ($x > 0 && $y < 7) $adj_tiles[$i++] = $fig_pos + 7; |
|
| 1835 | + if ($x > 0) $adj_tiles[$i++] = $fig_pos - 1; |
|
| 1836 | 1836 | |
| 1837 | 1837 | /* DEBUG: foreach( $adj_tiles as $tile ) |
| 1838 | 1838 | echo "adj: $tile "; */ |
@@ -260,8 +260,7 @@ discard block |
||
| 260 | 260 | if (!$this->fen_piece_placement_to_board()) |
| 261 | 261 | { |
| 262 | 262 | return _MD_CHESS_FENBAD_PP_INVALID; // piece_placement invalid |
| 263 | - } |
|
| 264 | - elseif ($this->gamestate['fen_active_color'] != 'w' and $this->gamestate['fen_active_color'] != 'b') |
|
| 263 | + } elseif ($this->gamestate['fen_active_color'] != 'w' and $this->gamestate['fen_active_color'] != 'b') |
|
| 265 | 264 | { |
| 266 | 265 | return _MD_CHESS_FENBAD_AC_INVALID; // active_color invalid |
| 267 | 266 | } |
@@ -269,46 +268,37 @@ discard block |
||
| 269 | 268 | elseif ($this->gamestate['fen_castling_availability'] != '-' and !preg_match('/^K?Q?k?q?$/', $this->gamestate['fen_castling_availability'])) |
| 270 | 269 | { |
| 271 | 270 | return _MD_CHESS_FENBAD_CA_INVALID; // castling_availability invalid |
| 272 | - } |
|
| 273 | - elseif ($this->gamestate['fen_en_passant_target_square'] != '-' and !preg_match('/^[a-h][36]$/', $this->gamestate['fen_en_passant_target_square'])) |
|
| 271 | + } elseif ($this->gamestate['fen_en_passant_target_square'] != '-' and !preg_match('/^[a-h][36]$/', $this->gamestate['fen_en_passant_target_square'])) |
|
| 274 | 272 | { |
| 275 | 273 | return _MD_CHESS_FENBAD_EP_INVALID; // en_passant_target_square invalid |
| 276 | - } |
|
| 277 | - elseif (!preg_match('/^\d{0,4}$/', $this->gamestate['fen_halfmove_clock'])) |
|
| 274 | + } elseif (!preg_match('/^\d{0,4}$/', $this->gamestate['fen_halfmove_clock'])) |
|
| 278 | 275 | { |
| 279 | 276 | return _MD_CHESS_FENBAD_HC_INVALID; // halfmove_clock invalid |
| 280 | - } |
|
| 281 | - elseif (!preg_match('/^\d{0,4}$/', $this->gamestate['fen_fullmove_number']) or $this->gamestate['fen_fullmove_number'] < 1) |
|
| 277 | + } elseif (!preg_match('/^\d{0,4}$/', $this->gamestate['fen_fullmove_number']) or $this->gamestate['fen_fullmove_number'] < 1) |
|
| 282 | 278 | { |
| 283 | 279 | return _MD_CHESS_FENBAD_FN_INVALID; // fullmove_number invalid |
| 284 | - } |
|
| 285 | - elseif ($this->insufficient_mating_material()) |
|
| 280 | + } elseif ($this->insufficient_mating_material()) |
|
| 286 | 281 | { |
| 287 | 282 | return _MD_CHESS_FENBAD_MATERIAL; // insufficient mating material |
| 288 | - } |
|
| 289 | - elseif (($this->gamestate['fen_active_color'] == 'w' and $this->kingIsUnderAttack('b', 'w')) |
|
| 283 | + } elseif (($this->gamestate['fen_active_color'] == 'w' and $this->kingIsUnderAttack('b', 'w')) |
|
| 290 | 284 | or ($this->gamestate['fen_active_color'] == 'b' and $this->kingIsUnderAttack('w', 'b'))) |
| 291 | 285 | { |
| 292 | 286 | return _MD_CHESS_FENBAD_IN_CHECK; // player to move cannot have opponent in check |
| 293 | - } |
|
| 294 | - elseif ((strstr($this->gamestate['fen_castling_availability'], 'K') and ($this->board[ 4] != 'wK' or $this->board[ 7] != 'wR')) |
|
| 287 | + } elseif ((strstr($this->gamestate['fen_castling_availability'], 'K') and ($this->board[ 4] != 'wK' or $this->board[ 7] != 'wR')) |
|
| 295 | 288 | or (strstr($this->gamestate['fen_castling_availability'], 'Q') and ($this->board[ 4] != 'wK' or $this->board[ 0] != 'wR')) |
| 296 | 289 | or (strstr($this->gamestate['fen_castling_availability'], 'k') and ($this->board[60] != 'bK' or $this->board[63] != 'bR')) |
| 297 | 290 | or (strstr($this->gamestate['fen_castling_availability'], 'q') and ($this->board[60] != 'bK' or $this->board[56] != 'bR'))) |
| 298 | 291 | { |
| 299 | 292 | return _MD_CHESS_FENBAD_CA_INCONSISTENT; // castling availability inconsistent with piece placement |
| 300 | - } |
|
| 301 | - elseif (($this->gamestate['fen_en_passant_target_square'] != '-' and $this->gamestate['fen_en_passant_target_square']{1} == 3 and $this->gamestate['fen_active_color'] != 'b') |
|
| 293 | + } elseif (($this->gamestate['fen_en_passant_target_square'] != '-' and $this->gamestate['fen_en_passant_target_square']{1} == 3 and $this->gamestate['fen_active_color'] != 'b') |
|
| 302 | 294 | or ($this->gamestate['fen_en_passant_target_square'] != '-' and $this->gamestate['fen_en_passant_target_square']{1} == 6 and $this->gamestate['fen_active_color'] != 'w')) |
| 303 | 295 | { |
| 304 | 296 | return _MD_CHESS_FENBAD_EP_COLOR; // en passant target square wrong color |
| 305 | - } |
|
| 306 | - elseif ($this->gamestate['fen_en_passant_target_square'] != '-' and $this->gamestate['fen_en_passant_target_square']{1} == 3 |
|
| 297 | + } elseif ($this->gamestate['fen_en_passant_target_square'] != '-' and $this->gamestate['fen_en_passant_target_square']{1} == 3 |
|
| 307 | 298 | and $this->board[$this->boardCoordToIndex($this->gamestate['fen_en_passant_target_square']{0} . '4')] != 'wP') |
| 308 | 299 | { |
| 309 | 300 | return _MD_CHESS_FENBAD_EP_NO_PAWN; // en passant target square for nonexistent pawn |
| 310 | - } |
|
| 311 | - elseif ($this->gamestate['fen_en_passant_target_square'] != '-' and $this->gamestate['fen_en_passant_target_square']{1} == 6 |
|
| 301 | + } elseif ($this->gamestate['fen_en_passant_target_square'] != '-' and $this->gamestate['fen_en_passant_target_square']{1} == 6 |
|
| 312 | 302 | and $this->board[$this->boardCoordToIndex($this->gamestate['fen_en_passant_target_square']{0} . '5')] != 'bP') |
| 313 | 303 | { |
| 314 | 304 | return _MD_CHESS_FENBAD_EP_NO_PAWN; // en passant target square for nonexistent pawn |
@@ -341,8 +331,9 @@ discard block |
||
| 341 | 331 | |
| 342 | 332 | #echo "path: $pos: '$this->board[$pos]' "; #*#DEBUG# |
| 343 | 333 | |
| 344 | - if (!$this->is_empty_tile($pos)) |
|
| 345 | - return 0; |
|
| 334 | + if (!$this->is_empty_tile($pos)) { |
|
| 335 | + return 0; |
|
| 336 | + } |
|
| 346 | 337 | } |
| 347 | 338 | |
| 348 | 339 | return 1; |
@@ -421,8 +412,7 @@ discard block |
||
| 421 | 412 | $change += ($dx < $fx) ? -1 : 1; |
| 422 | 413 | } elseif ($fx == $dx) { |
| 423 | 414 | $change = ($dy < $fy) ? -8 : 8; |
| 424 | - } |
|
| 425 | - else { |
|
| 415 | + } else { |
|
| 426 | 416 | $change = ($dx < $fx) ? -1 : 1; |
| 427 | 417 | } |
| 428 | 418 | break; |
@@ -448,7 +438,9 @@ discard block |
||
| 448 | 438 | */ |
| 449 | 439 | function tileIsReachable($fig, $fig_pos, $dest_pos) |
| 450 | 440 | { |
| 451 | - if ( $fig_pos==$dest_pos) return; |
|
| 441 | + if ( $fig_pos==$dest_pos) { |
|
| 442 | + return; |
|
| 443 | + } |
|
| 452 | 444 | $result = 0; |
| 453 | 445 | $fy = floor($fig_pos/8); $fx = $fig_pos%8; |
| 454 | 446 | $dy = floor($dest_pos/8); $dx = $dest_pos%8; |
@@ -457,61 +449,103 @@ discard block |
||
| 457 | 449 | { |
| 458 | 450 | /* knight */ |
| 459 | 451 | case 'N': |
| 460 | - if ( abs($fx-$dx)==1 && abs($fy-$dy)==2 ) |
|
| 461 | - $result = 1; |
|
| 462 | - if ( abs($fy-$dy)==1 && abs($fx-$dx)==2 ) |
|
| 463 | - $result = 1; |
|
| 452 | + if ( abs($fx-$dx)==1 && abs($fy-$dy)==2 ) { |
|
| 453 | + $result = 1; |
|
| 454 | + } |
|
| 455 | + if ( abs($fy-$dy)==1 && abs($fx-$dx)==2 ) { |
|
| 456 | + $result = 1; |
|
| 457 | + } |
|
| 464 | 458 | break; |
| 465 | 459 | /* bishop */ |
| 466 | 460 | case 'B': |
| 467 | - if ( abs($fx-$dx) != abs($fy-$dy) ) |
|
| 468 | - break; |
|
| 469 | - if ( $dy < $fy ) $change = -8; else $change = 8; |
|
| 470 | - if ( $dx < $fx ) $change -= 1; else $change += 1; |
|
| 471 | - if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 472 | - $result = 1; |
|
| 461 | + if ( abs($fx-$dx) != abs($fy-$dy) ) { |
|
| 462 | + break; |
|
| 463 | + } |
|
| 464 | + if ( $dy < $fy ) { |
|
| 465 | + $change = -8; |
|
| 466 | + } else { |
|
| 467 | + $change = 8; |
|
| 468 | + } |
|
| 469 | + if ( $dx < $fx ) { |
|
| 470 | + $change -= 1; |
|
| 471 | + } else { |
|
| 472 | + $change += 1; |
|
| 473 | + } |
|
| 474 | + if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) { |
|
| 475 | + $result = 1; |
|
| 476 | + } |
|
| 473 | 477 | break; |
| 474 | 478 | /* rook */ |
| 475 | 479 | case 'R': |
| 476 | - if ( $fx!=$dx && $fy!=$dy ) |
|
| 477 | - break; |
|
| 480 | + if ( $fx!=$dx && $fy!=$dy ) { |
|
| 481 | + break; |
|
| 482 | + } |
|
| 478 | 483 | if ( $fx==$dx ) |
| 479 | 484 | { |
| 480 | - if ( $dy<$fy ) $change = -8; else $change = 8; |
|
| 485 | + if ( $dy<$fy ) { |
|
| 486 | + $change = -8; |
|
| 487 | + } else { |
|
| 488 | + $change = 8; |
|
| 489 | + } |
|
| 490 | + } else { |
|
| 491 | + if ( $dx<$fx ) { |
|
| 492 | + $change = -1; |
|
| 493 | + } else { |
|
| 494 | + $change = 1; |
|
| 495 | + } |
|
| 481 | 496 | } |
| 482 | - else { |
|
| 483 | - if ( $dx<$fx ) $change = -1; else $change = 1; |
|
| 497 | + if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) { |
|
| 498 | + $result = 1; |
|
| 484 | 499 | } |
| 485 | - if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 486 | - $result = 1; |
|
| 487 | 500 | break; |
| 488 | 501 | /* queen */ |
| 489 | 502 | case 'Q': |
| 490 | - if ( abs($fx-$dx) != abs($fy-$dy) && $fx!=$dx && $fy!=$dy ) |
|
| 491 | - break; |
|
| 503 | + if ( abs($fx-$dx) != abs($fy-$dy) && $fx!=$dx && $fy!=$dy ) { |
|
| 504 | + break; |
|
| 505 | + } |
|
| 492 | 506 | if ( abs($fx-$dx) == abs($fy-$dy) ) |
| 493 | 507 | { |
| 494 | - if ( $dy < $fy ) $change = -8; else $change = 8; |
|
| 495 | - if ( $dx < $fx ) $change -= 1; else $change += 1; |
|
| 496 | - } |
|
| 497 | - else if ( $fx==$dx ) { |
|
| 498 | - if ( $dy<$fy ) $change = -8; else $change = 8; |
|
| 499 | - } |
|
| 500 | - else |
|
| 508 | + if ( $dy < $fy ) { |
|
| 509 | + $change = -8; |
|
| 510 | + } else { |
|
| 511 | + $change = 8; |
|
| 512 | + } |
|
| 513 | + if ( $dx < $fx ) { |
|
| 514 | + $change -= 1; |
|
| 515 | + } else { |
|
| 516 | + $change += 1; |
|
| 517 | + } |
|
| 518 | + } else if ( $fx==$dx ) { |
|
| 519 | + if ( $dy<$fy ) { |
|
| 520 | + $change = -8; |
|
| 521 | + } else { |
|
| 522 | + $change = 8; |
|
| 523 | + } |
|
| 524 | + } else |
|
| 501 | 525 | { |
| 502 | - if ( $dx<$fx ) $change = -1; else $change = 1; |
|
| 526 | + if ( $dx<$fx ) { |
|
| 527 | + $change = -1; |
|
| 528 | + } else { |
|
| 529 | + $change = 1; |
|
| 530 | + } |
|
| 531 | + } |
|
| 532 | + if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) { |
|
| 533 | + $result = 1; |
|
| 503 | 534 | } |
| 504 | - if ( $this->pathIsNotBlocked( $fig_pos+$change, $dest_pos, $change ) ) |
|
| 505 | - $result = 1; |
|
| 506 | 535 | break; |
| 507 | 536 | /* king */ |
| 508 | 537 | case 'K': |
| 509 | - if ( abs($fx-$dx) > 1 || abs($fy-$dy) > 1 ) break; |
|
| 538 | + if ( abs($fx-$dx) > 1 || abs($fy-$dy) > 1 ) { |
|
| 539 | + break; |
|
| 540 | + } |
|
| 510 | 541 | $kings = 0; |
| 511 | 542 | $adj_tiles = $this->getAdjTiles( $dest_pos ); |
| 512 | - foreach( $adj_tiles as $tile ) |
|
| 513 | - if ($this->board[$tile]{1} == 'K' ) $kings++; |
|
| 514 | - if ( $kings == 2 ) break; |
|
| 543 | + foreach( $adj_tiles as $tile ) { |
|
| 544 | + if ($this->board[$tile]{1} == 'K' ) $kings++; |
|
| 545 | + } |
|
| 546 | + if ( $kings == 2 ) { |
|
| 547 | + break; |
|
| 548 | + } |
|
| 515 | 549 | $result = 1; |
| 516 | 550 | break; |
| 517 | 551 | } |
@@ -533,17 +567,20 @@ discard block |
||
| 533 | 567 | { |
| 534 | 568 | if ( $this->board[$fig_pos]{0} == 'w' ) |
| 535 | 569 | { |
| 536 | - if ( ($fig_pos % 8) > 0 && $dest_pos == $fig_pos+7 ) |
|
| 537 | - return 1; |
|
| 538 | - if ( ($fig_pos % 8) < 7 && $dest_pos == $fig_pos+9 ) |
|
| 539 | - return 1; |
|
| 540 | - } |
|
| 541 | - else if ( $this->board[$fig_pos]{0} == 'b' ) |
|
| 570 | + if ( ($fig_pos % 8) > 0 && $dest_pos == $fig_pos+7 ) { |
|
| 571 | + return 1; |
|
| 572 | + } |
|
| 573 | + if ( ($fig_pos % 8) < 7 && $dest_pos == $fig_pos+9 ) { |
|
| 574 | + return 1; |
|
| 575 | + } |
|
| 576 | + } else if ( $this->board[$fig_pos]{0} == 'b' ) |
|
| 542 | 577 | { |
| 543 | - if ( ($fig_pos % 8) < 7 && $dest_pos == $fig_pos-7 ) |
|
| 544 | - return 1; |
|
| 545 | - if ( ($fig_pos % 8) > 0 && $dest_pos == $fig_pos-9 ) |
|
| 546 | - return 1; |
|
| 578 | + if ( ($fig_pos % 8) < 7 && $dest_pos == $fig_pos-7 ) { |
|
| 579 | + return 1; |
|
| 580 | + } |
|
| 581 | + if ( ($fig_pos % 8) > 0 && $dest_pos == $fig_pos-9 ) { |
|
| 582 | + return 1; |
|
| 583 | + } |
|
| 547 | 584 | } |
| 548 | 585 | return 0; |
| 549 | 586 | } |
@@ -568,23 +605,28 @@ discard block |
||
| 568 | 605 | |
| 569 | 606 | if ( $this->board[$fig_pos]{0} == 'w' ) |
| 570 | 607 | { |
| 571 | - if ( $fig_pos >= 8 && $fig_pos <= 15 ) |
|
| 572 | - $first_move = 1; |
|
| 573 | - if ( $dest_pos==$fig_pos+8 ) |
|
| 574 | - return 1; |
|
| 575 | - if ( $first_move && ( $dest_pos==$fig_pos+16 ) ) |
|
| 576 | - if ($this->is_empty_tile($fig_pos + 8)) |
|
| 608 | + if ( $fig_pos >= 8 && $fig_pos <= 15 ) { |
|
| 609 | + $first_move = 1; |
|
| 610 | + } |
|
| 611 | + if ( $dest_pos==$fig_pos+8 ) { |
|
| 612 | + return 1; |
|
| 613 | + } |
|
| 614 | + if ( $first_move && ( $dest_pos==$fig_pos+16 ) ) { |
|
| 615 | + if ($this->is_empty_tile($fig_pos + 8)) |
|
| 577 | 616 | return 1; |
| 578 | - } |
|
| 579 | - else if ($this->board[$fig_pos]{0} == 'b' ) |
|
| 617 | + } |
|
| 618 | + } else if ($this->board[$fig_pos]{0} == 'b' ) |
|
| 580 | 619 | { |
| 581 | - if ( $fig_pos >= 48 && $fig_pos <= 55 ) |
|
| 582 | - $first_move = 1; |
|
| 583 | - if ( $dest_pos==$fig_pos-8 ) |
|
| 584 | - return 1; |
|
| 585 | - if ( $first_move && ( $dest_pos==$fig_pos-16 ) ) |
|
| 586 | - if ($this->is_empty_tile($fig_pos - 8)) |
|
| 620 | + if ( $fig_pos >= 48 && $fig_pos <= 55 ) { |
|
| 621 | + $first_move = 1; |
|
| 622 | + } |
|
| 623 | + if ( $dest_pos==$fig_pos-8 ) { |
|
| 624 | + return 1; |
|
| 625 | + } |
|
| 626 | + if ( $first_move && ( $dest_pos==$fig_pos-16 ) ) { |
|
| 627 | + if ($this->is_empty_tile($fig_pos - 8)) |
|
| 587 | 628 | return 1; |
| 629 | + } |
|
| 588 | 630 | } |
| 589 | 631 | return 0; |
| 590 | 632 | } |
@@ -601,8 +643,8 @@ discard block |
||
| 601 | 643 | function tileIsUnderAttack($opp, $dest_pos) |
| 602 | 644 | { |
| 603 | 645 | #var_dump('tileIsUnderAttack, opp', $opp, 'dest_pos', $dest_pos, 'board', $board);#*#DEBUG# |
| 604 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 605 | - if ($this->board[$i]{0} == $opp ) |
|
| 646 | + for ( $i = 0; $i < 64; $i++ ) { |
|
| 647 | + if ($this->board[$i]{0} == $opp ) |
|
| 606 | 648 | { |
| 607 | 649 | if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$dest_pos)) || |
| 608 | 650 | ($this->board[$i]{1}!='P' && |
@@ -610,6 +652,7 @@ discard block |
||
| 610 | 652 | { |
| 611 | 653 | /*DEBUG: echo "attack test: $i: ",$opp,"P<BR>"; */ |
| 612 | 654 | return 1; |
| 655 | + } |
|
| 613 | 656 | } |
| 614 | 657 | } |
| 615 | 658 | return 0; |
@@ -628,10 +671,11 @@ discard block |
||
| 628 | 671 | { |
| 629 | 672 | |
| 630 | 673 | #var_dump('kingIsUnderAttack, player', $player, 'opp', $opp, 'board', $board);#*#DEBUG# |
| 631 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 632 | - if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K' ) |
|
| 674 | + for ( $i = 0; $i < 64; $i++ ) { |
|
| 675 | + if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K' ) |
|
| 633 | 676 | { |
| 634 | 677 | $king_pos = $i; |
| 678 | + } |
|
| 635 | 679 | break; |
| 636 | 680 | } |
| 637 | 681 | /*DEBUG: echo "$player king is at $king_pos<BR>"; */ |
@@ -650,10 +694,11 @@ discard block |
||
| 650 | 694 | */ |
| 651 | 695 | function isCheckMate($player, $opp) |
| 652 | 696 | { |
| 653 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 654 | - if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K' ) |
|
| 697 | + for ( $i = 0; $i < 64; $i++ ) { |
|
| 698 | + if ($this->board[$i]{0} == $player && $this->board[$i]{1} == 'K' ) |
|
| 655 | 699 | { |
| 656 | 700 | $king_pos = $i; |
| 701 | + } |
|
| 657 | 702 | $king_x = $i % 8; |
| 658 | 703 | $king_y = floor($i/8); |
| 659 | 704 | break; |
@@ -664,8 +709,12 @@ discard block |
||
| 664 | 709 | $contents = $this->board[$king_pos]; $this->clear_tile($king_pos); |
| 665 | 710 | foreach ( $adj_tiles as $dest_pos ) |
| 666 | 711 | { |
| 667 | - if ($this->board[$dest_pos]{0} == $player ) continue; |
|
| 668 | - if ( $this->tileIsUnderAttack($opp,$dest_pos) ) continue; |
|
| 712 | + if ($this->board[$dest_pos]{0} == $player ) { |
|
| 713 | + continue; |
|
| 714 | + } |
|
| 715 | + if ( $this->tileIsUnderAttack($opp,$dest_pos) ) { |
|
| 716 | + continue; |
|
| 717 | + } |
|
| 669 | 718 | $this->board[$king_pos] = $contents; |
| 670 | 719 | return 0; |
| 671 | 720 | } |
@@ -675,14 +724,15 @@ discard block |
||
| 675 | 724 | |
| 676 | 725 | /* get all figures that attack the king */ |
| 677 | 726 | $attackers = array(); $count = 0; |
| 678 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 679 | - if ( $this->board[$i]{0} == $opp ) |
|
| 727 | + for ( $i = 0; $i < 64; $i++ ) { |
|
| 728 | + if ( $this->board[$i]{0} == $opp ) |
|
| 680 | 729 | { |
| 681 | 730 | if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$king_pos)) || |
| 682 | 731 | ($this->board[$i]{1}!='P' && |
| 683 | 732 | $this->tileIsReachable($this->board[$i]{1},$i,$king_pos)) ) |
| 684 | 733 | { |
| 685 | 734 | $attackers[$count++] = $i; |
| 735 | + } |
|
| 686 | 736 | } |
| 687 | 737 | } |
| 688 | 738 | /* DEBUG: |
@@ -691,12 +741,14 @@ discard block |
||
| 691 | 741 | echo "Attackercount: ",count($attackers), " "; */ |
| 692 | 742 | |
| 693 | 743 | /* if more than one there is no chance to escape */ |
| 694 | - if ( $count > 1 ) return 1; |
|
| 744 | + if ( $count > 1 ) { |
|
| 745 | + return 1; |
|
| 746 | + } |
|
| 695 | 747 | |
| 696 | 748 | /* check whether attacker can be killed by own figure */ |
| 697 | 749 | $dest_pos = $attackers[0]; |
| 698 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 699 | - if ( $this->board[$i]{0} == $player ) |
|
| 750 | + for ( $i = 0; $i < 64; $i++ ) { |
|
| 751 | + if ( $this->board[$i]{0} == $player ) |
|
| 700 | 752 | { |
| 701 | 753 | if ( ($this->board[$i]{1}=='P' && $this->checkPawnAttack($i,$dest_pos)) || |
| 702 | 754 | ($this->board[$i]{1}!='P' && $this->board[$i]{1}!='K' && |
@@ -707,12 +759,14 @@ discard block |
||
| 707 | 759 | { |
| 708 | 760 | /* DEBUG: echo "candidate: $i "; */ |
| 709 | 761 | $can_kill_atk = 0; |
| 762 | + } |
|
| 710 | 763 | $contents_def = $this->board[$i]; |
| 711 | 764 | $contents_atk = $this->board[$dest_pos]; |
| 712 | 765 | $this->board[$dest_pos] = $this->board[$i]; |
| 713 | 766 | $this->clear_tile($i); |
| 714 | - if ( !$this->tileIsUnderAttack($opp,$king_pos) ) |
|
| 715 | - $can_kill_atk = 1; |
|
| 767 | + if ( !$this->tileIsUnderAttack($opp,$king_pos) ) { |
|
| 768 | + $can_kill_atk = 1; |
|
| 769 | + } |
|
| 716 | 770 | $this->board[$i] = $contents_def; |
| 717 | 771 | $this->board[$dest_pos] = $contents_atk; |
| 718 | 772 | if ( $can_kill_atk ) |
@@ -727,14 +781,17 @@ discard block |
||
| 727 | 781 | |
| 728 | 782 | /* if attacking unit is a knight there |
| 729 | 783 | * is no way to block the path */ |
| 730 | - if ( $this->board[$dest_pos]{1} == 'N' ) return 1; |
|
| 784 | + if ( $this->board[$dest_pos]{1} == 'N' ) { |
|
| 785 | + return 1; |
|
| 786 | + } |
|
| 731 | 787 | |
| 732 | 788 | /* if enemy is adjacent to king there is no |
| 733 | 789 | * way either */ |
| 734 | 790 | $dest_x = $dest_pos % 8; |
| 735 | 791 | $dest_y = floor($dest_pos/8); |
| 736 | - if ( abs($dest_x-$king_x)<=1 && abs($dest_y-$king_y)<=1 ) |
|
| 737 | - return 1; |
|
| 792 | + if ( abs($dest_x-$king_x)<=1 && abs($dest_y-$king_y)<=1 ) { |
|
| 793 | + return 1; |
|
| 794 | + } |
|
| 738 | 795 | |
| 739 | 796 | /* get the list of tiles between king and attacking |
| 740 | 797 | * unit that can be blocked to stop the attack */ |
@@ -744,8 +801,8 @@ discard block |
||
| 744 | 801 | /* DEBUG: foreach( $path as $tile ) echo "tile: $tile "; */ |
| 745 | 802 | foreach( $path as $pos ) |
| 746 | 803 | { |
| 747 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 748 | - if ( $this->board[$i]{0} == $player ) |
|
| 804 | + for ( $i = 0; $i < 64; $i++ ) { |
|
| 805 | + if ( $this->board[$i]{0} == $player ) |
|
| 749 | 806 | { |
| 750 | 807 | if ( ($this->board[$i]{1}=='P' && $this->checkPawnMove($i,$pos)) || |
| 751 | 808 | ($this->board[$i]{1}!='P' && $this->board[$i]{1}!='K' && |
@@ -753,6 +810,7 @@ discard block |
||
| 753 | 810 | { |
| 754 | 811 | /* DEBUG: echo "$i can block "; */ |
| 755 | 812 | return 0; |
| 813 | + } |
|
| 756 | 814 | } |
| 757 | 815 | } |
| 758 | 816 | } |
@@ -772,16 +830,21 @@ discard block |
||
| 772 | 830 | */ |
| 773 | 831 | function isStaleMate($player, $opp) |
| 774 | 832 | { |
| 775 | - for ( $i = 0; $i < 64; $i++ ) |
|
| 776 | - if ($this->board[$i]{0} == $player ) |
|
| 833 | + for ( $i = 0; $i < 64; $i++ ) { |
|
| 834 | + if ($this->board[$i]{0} == $player ) |
|
| 777 | 835 | switch ($this->board[$i]{1} ) |
| 778 | 836 | { |
| 779 | 837 | case 'K': |
| 780 | 838 | $adj_tiles = $this->getAdjTiles( $i ); |
| 839 | + } |
|
| 781 | 840 | foreach ( $adj_tiles as $pos ) |
| 782 | 841 | { |
| 783 | - if ( $this->board[$pos]{0} == $player ) continue; |
|
| 784 | - if ( $this->tileIsUnderAttack($opp,$pos) ) continue; |
|
| 842 | + if ( $this->board[$pos]{0} == $player ) { |
|
| 843 | + continue; |
|
| 844 | + } |
|
| 845 | + if ( $this->tileIsUnderAttack($opp,$pos) ) { |
|
| 846 | + continue; |
|
| 847 | + } |
|
| 785 | 848 | return 0; |
| 786 | 849 | } |
| 787 | 850 | /* DEBUG: echo "King cannot escape by itself! "; */ |
@@ -789,44 +852,88 @@ discard block |
||
| 789 | 852 | case 'P': |
| 790 | 853 | if ( $player == 'w' ) |
| 791 | 854 | { |
| 792 | - if ($this->is_empty_tile($i + 8)) return 0; |
|
| 793 | - if ( ($i%8) > 0 && $this->board[$i+7]{0} != $player ) return 0; |
|
| 794 | - if ( ($i%8) < 7 && $this->board[$i+9]{0} != $player ) return 0; |
|
| 795 | - } |
|
| 796 | - else |
|
| 855 | + if ($this->is_empty_tile($i + 8)) { |
|
| 856 | + return 0; |
|
| 857 | + } |
|
| 858 | + if ( ($i%8) > 0 && $this->board[$i+7]{0} != $player ) { |
|
| 859 | + return 0; |
|
| 860 | + } |
|
| 861 | + if ( ($i%8) < 7 && $this->board[$i+9]{0} != $player ) { |
|
| 862 | + return 0; |
|
| 863 | + } |
|
| 864 | + } else |
|
| 797 | 865 | { |
| 798 | - if ($this->is_empty_tile($i - 8)) return 0; |
|
| 799 | - if ( ($i%8) > 0 && $this->board[$i-9]{0} != $player ) return 0; |
|
| 800 | - if ( ($i%8) < 7 && $this->board[$i-7]{0} != $player ) return 0; |
|
| 866 | + if ($this->is_empty_tile($i - 8)) { |
|
| 867 | + return 0; |
|
| 868 | + } |
|
| 869 | + if ( ($i%8) > 0 && $this->board[$i-9]{0} != $player ) { |
|
| 870 | + return 0; |
|
| 871 | + } |
|
| 872 | + if ( ($i%8) < 7 && $this->board[$i-7]{0} != $player ) { |
|
| 873 | + return 0; |
|
| 874 | + } |
|
| 801 | 875 | } |
| 802 | 876 | break; |
| 803 | 877 | case 'B': |
| 804 | - if ( $i-9 >= 0 && $this->board[$i-9]{0} != $player ) return 0; |
|
| 805 | - if ( $i-7 >= 0 && $this->board[$i-7]{0} != $player ) return 0; |
|
| 806 | - if ( $i+9 <= 63 && $this->board[$i+9]{0} != $player ) return 0; |
|
| 807 | - if ( $i+7 <= 63 && $this->board[$i+7]{0} != $player ) return 0; |
|
| 878 | + if ( $i-9 >= 0 && $this->board[$i-9]{0} != $player ) { |
|
| 879 | + return 0; |
|
| 880 | + } |
|
| 881 | + if ( $i-7 >= 0 && $this->board[$i-7]{0} != $player ) { |
|
| 882 | + return 0; |
|
| 883 | + } |
|
| 884 | + if ( $i+9 <= 63 && $this->board[$i+9]{0} != $player ) { |
|
| 885 | + return 0; |
|
| 886 | + } |
|
| 887 | + if ( $i+7 <= 63 && $this->board[$i+7]{0} != $player ) { |
|
| 888 | + return 0; |
|
| 889 | + } |
|
| 808 | 890 | break; |
| 809 | 891 | case 'R': |
| 810 | - if ( $i-8 >= 0 && $this->board[$i-8]{0} != $player ) return 0; |
|
| 811 | - if ( $i-1 >= 0 && $this->board[$i-1]{0} != $player ) return 0; |
|
| 812 | - if ( $i+8 <= 63 && $this->board[$i+8]{0} != $player ) return 0; |
|
| 813 | - if ( $i+1 <= 63 && $this->board[$i+1]{0} != $player ) return 0; |
|
| 892 | + if ( $i-8 >= 0 && $this->board[$i-8]{0} != $player ) { |
|
| 893 | + return 0; |
|
| 894 | + } |
|
| 895 | + if ( $i-1 >= 0 && $this->board[$i-1]{0} != $player ) { |
|
| 896 | + return 0; |
|
| 897 | + } |
|
| 898 | + if ( $i+8 <= 63 && $this->board[$i+8]{0} != $player ) { |
|
| 899 | + return 0; |
|
| 900 | + } |
|
| 901 | + if ( $i+1 <= 63 && $this->board[$i+1]{0} != $player ) { |
|
| 902 | + return 0; |
|
| 903 | + } |
|
| 814 | 904 | break; |
| 815 | 905 | case 'Q': |
| 816 | 906 | $adj_tiles = $this->getAdjTiles( $i ); |
| 817 | - foreach ( $adj_tiles as $pos ) |
|
| 818 | - if ( $this->board[$pos]{0} != $player ) |
|
| 907 | + foreach ( $adj_tiles as $pos ) { |
|
| 908 | + if ( $this->board[$pos]{0} != $player ) |
|
| 819 | 909 | return 0; |
| 910 | + } |
|
| 820 | 911 | break; |
| 821 | 912 | case 'N': |
| 822 | - if ( $i-17 >= 0 && $this->board[$i-17]{0} != $player ) return 0; |
|
| 823 | - if ( $i-15 >= 0 && $this->board[$i-15]{0} != $player ) return 0; |
|
| 824 | - if ( $i-6 >= 0 && $this->board[$i-6]{0} != $player ) return 0; |
|
| 825 | - if ( $i+10 <= 63 && $this->board[$i+10]{0} != $player ) return 0; |
|
| 826 | - if ( $i+17 <= 63 && $this->board[$i+17]{0} != $player ) return 0; |
|
| 827 | - if ( $i+15 <= 63 && $this->board[$i+15]{0} != $player ) return 0; |
|
| 828 | - if ( $i+6 <= 63 && $this->board[$i+6]{0} != $player ) return 0; |
|
| 829 | - if ( $i-10 >= 0 && $this->board[$i-10]{0} != $player ) return 0; |
|
| 913 | + if ( $i-17 >= 0 && $this->board[$i-17]{0} != $player ) { |
|
| 914 | + return 0; |
|
| 915 | + } |
|
| 916 | + if ( $i-15 >= 0 && $this->board[$i-15]{0} != $player ) { |
|
| 917 | + return 0; |
|
| 918 | + } |
|
| 919 | + if ( $i-6 >= 0 && $this->board[$i-6]{0} != $player ) { |
|
| 920 | + return 0; |
|
| 921 | + } |
|
| 922 | + if ( $i+10 <= 63 && $this->board[$i+10]{0} != $player ) { |
|
| 923 | + return 0; |
|
| 924 | + } |
|
| 925 | + if ( $i+17 <= 63 && $this->board[$i+17]{0} != $player ) { |
|
| 926 | + return 0; |
|
| 927 | + } |
|
| 928 | + if ( $i+15 <= 63 && $this->board[$i+15]{0} != $player ) { |
|
| 929 | + return 0; |
|
| 930 | + } |
|
| 931 | + if ( $i+6 <= 63 && $this->board[$i+6]{0} != $player ) { |
|
| 932 | + return 0; |
|
| 933 | + } |
|
| 934 | + if ( $i-10 >= 0 && $this->board[$i-10]{0} != $player ) { |
|
| 935 | + return 0; |
|
| 936 | + } |
|
| 830 | 937 | break; |
| 831 | 938 | } |
| 832 | 939 | |
@@ -892,9 +999,10 @@ discard block |
||
| 892 | 999 | { |
| 893 | 1000 | /* full move: a pawn requires a ? in the end |
| 894 | 1001 | * to automatically choose a queen on last line */ |
| 895 | - if ( $move[0] == 'P' ) |
|
| 896 | - if ( $move[strlen($move)-1]<'A' || $move[strlen($move)-1]>'Z' ) |
|
| 1002 | + if ( $move[0] == 'P' ) { |
|
| 1003 | + if ( $move[strlen($move)-1]<'A' || $move[strlen($move)-1]>'Z' ) |
|
| 897 | 1004 | $this->ac_move = "$move?"; |
| 1005 | + } |
|
| 898 | 1006 | return ""; |
| 899 | 1007 | } |
| 900 | 1008 | |
@@ -912,8 +1020,10 @@ discard block |
||
| 912 | 1020 | if ($move{strlen($move)-1} == '=') { |
| 913 | 1021 | $move = substr($move, 0, strlen($move)-1); |
| 914 | 1022 | } |
| 915 | - if ( $pawn_upg == "P" || $pawn_upg == "K" ) |
|
| 916 | - return _MD_CHESS_MOVE_PAWN_MAY_BECOME; // "A pawn may only become either a knight, a bishop, a rook or a queen!" |
|
| 1023 | + if ( $pawn_upg == "P" || $pawn_upg == "K" ) { |
|
| 1024 | + return _MD_CHESS_MOVE_PAWN_MAY_BECOME; |
|
| 1025 | + } |
|
| 1026 | + // "A pawn may only become either a knight, a bishop, a rook or a queen!" |
|
| 917 | 1027 | |
| 918 | 1028 | if ( $move[0]>='a' && $move[0]<='h' ) |
| 919 | 1029 | { |
@@ -921,21 +1031,23 @@ discard block |
||
| 921 | 1031 | * listed above */ |
| 922 | 1032 | if ( strlen($move) == 4 ) |
| 923 | 1033 | { |
| 924 | - if ( $move[1] != 'x' ) |
|
| 925 | - return _MD_CHESS_MOVE_USE_X; // "use x to indicate an attack" |
|
| 1034 | + if ( $move[1] != 'x' ) { |
|
| 1035 | + return _MD_CHESS_MOVE_USE_X; |
|
| 1036 | + } |
|
| 1037 | + // "use x to indicate an attack" |
|
| 926 | 1038 | $dest_x = $move[2]; |
| 927 | 1039 | $dest_y = $move[3]; |
| 928 | 1040 | $src_x = $move[0]; |
| 929 | - if ( $player == 'w' ) |
|
| 930 | - $src_y = $dest_y-1; |
|
| 931 | - else |
|
| 932 | - $src_y = $dest_y+1; |
|
| 1041 | + if ( $player == 'w' ) { |
|
| 1042 | + $src_y = $dest_y-1; |
|
| 1043 | + } else { |
|
| 1044 | + $src_y = $dest_y+1; |
|
| 1045 | + } |
|
| 933 | 1046 | $this->ac_move = sprintf( "P%s%dx%s%d%s", |
| 934 | 1047 | $src_x,$src_y,$dest_x,$dest_y, |
| 935 | 1048 | $pawn_upg ); |
| 936 | 1049 | return ""; |
| 937 | - } |
|
| 938 | - else |
|
| 1050 | + } else |
|
| 939 | 1051 | if (strlen($move) == 2 ) |
| 940 | 1052 | { |
| 941 | 1053 | $fig = sprintf( "%sP", $player ); |
@@ -943,16 +1055,26 @@ discard block |
||
| 943 | 1055 | { |
| 944 | 1056 | /* pawn move */ |
| 945 | 1057 | $pos = $this->boardCoordToIndex( $move ); |
| 946 | - if ( $pos == 64 ) return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move); // "coordinate $move is invalid" |
|
| 1058 | + if ( $pos == 64 ) { |
|
| 1059 | + return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move); |
|
| 1060 | + } |
|
| 1061 | + // "coordinate $move is invalid" |
|
| 947 | 1062 | if ( $player == 'w' ) |
| 948 | 1063 | { |
| 949 | - while( $pos >= 0 && $this->board[$pos] != $fig ) $pos -= 8; |
|
| 950 | - if ( $pos < 0 ) $not_found = 1; |
|
| 951 | - } |
|
| 952 | - else |
|
| 1064 | + while( $pos >= 0 && $this->board[$pos] != $fig ) { |
|
| 1065 | + $pos -= 8; |
|
| 1066 | + } |
|
| 1067 | + if ( $pos < 0 ) { |
|
| 1068 | + $not_found = 1; |
|
| 1069 | + } |
|
| 1070 | + } else |
|
| 953 | 1071 | { |
| 954 | - while( $pos <= 63 && $this->board[$pos] != $fig ) $pos += 8; |
|
| 955 | - if ( $pos > 63 ) $not_found = 1; |
|
| 1072 | + while( $pos <= 63 && $this->board[$pos] != $fig ) { |
|
| 1073 | + $pos += 8; |
|
| 1074 | + } |
|
| 1075 | + if ( $pos > 63 ) { |
|
| 1076 | + $not_found = 1; |
|
| 1077 | + } |
|
| 956 | 1078 | } |
| 957 | 1079 | $pos = $this->boardIndexToCoord( $pos ); |
| 958 | 1080 | if ( (isset($not_found) && $not_found) || $pos == "" ) { |
@@ -961,127 +1083,155 @@ discard block |
||
| 961 | 1083 | $this->ac_move = sprintf( "P%s-%s%s", $pos, $move, $pawn_upg ); |
| 962 | 1084 | return ""; |
| 963 | 1085 | } |
| 964 | - } |
|
| 965 | - else |
|
| 1086 | + } else |
|
| 966 | 1087 | { |
| 967 | 1088 | /* notation: [a-h][a-h] for pawn attack no longer allowed |
| 968 | 1089 | * except for history browser */ |
| 969 | - if ( $this->browsing_mode == 0 ) |
|
| 970 | - return _MD_CHESS_MOVE_USE_NOTATION; // "please use denotation [a-h]x[a-h][1-8] for pawn attacks (see help for more information)" |
|
| 1090 | + if ( $this->browsing_mode == 0 ) { |
|
| 1091 | + return _MD_CHESS_MOVE_USE_NOTATION; |
|
| 1092 | + } |
|
| 1093 | + // "please use denotation [a-h]x[a-h][1-8] for pawn attacks (see help for more information)" |
|
| 971 | 1094 | /* pawn attack must be only one pawn in column! */ |
| 972 | 1095 | $pawns = 0; |
| 973 | 1096 | $start = $this->boardCoordToIndex( sprintf( "%s1", $move[0] ) ); |
| 974 | - if ( $start == 64 ) return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move[0]); // "coordinate $move[0] is invalid" |
|
| 975 | - for ( $i = 1; $i <= 8; $i++, $start+=8 ) |
|
| 976 | - if ( $this->board[$start] == $fig ) |
|
| 1097 | + if ( $start == 64 ) { |
|
| 1098 | + return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $move[0]); |
|
| 1099 | + } |
|
| 1100 | + // "coordinate $move[0] is invalid" |
|
| 1101 | + for ( $i = 1; $i <= 8; $i++, $start+=8 ) { |
|
| 1102 | + if ( $this->board[$start] == $fig ) |
|
| 977 | 1103 | { |
| 978 | 1104 | $pawns++; |
| 1105 | + } |
|
| 979 | 1106 | $pawn_line = $i; |
| 980 | 1107 | } |
| 981 | - if ( $pawns == 0 ) |
|
| 982 | - return $this->move_msg(_MD_CHESS_MOVE_NO_PAWN, $move[0]); // "there is no pawn in column $move[0]" |
|
| 983 | - else if ( $pawns > 1 ) |
|
| 984 | - return $this->move_msg(_MD_CHESS_MOVE_TWO_PAWNS, $move[0]); // "there is more than one pawn in column $move[0]" |
|
| 1108 | + if ( $pawns == 0 ) { |
|
| 1109 | + return $this->move_msg(_MD_CHESS_MOVE_NO_PAWN, $move[0]); |
|
| 1110 | + } |
|
| 1111 | + // "there is no pawn in column $move[0]" |
|
| 1112 | + else if ( $pawns > 1 ) { |
|
| 1113 | + return $this->move_msg(_MD_CHESS_MOVE_TWO_PAWNS, $move[0]); |
|
| 1114 | + } |
|
| 1115 | + // "there is more than one pawn in column $move[0]" |
|
| 985 | 1116 | else |
| 986 | 1117 | { |
| 987 | - if ( $player == 'w' ) |
|
| 988 | - $dest_line = $pawn_line+1; |
|
| 989 | - else |
|
| 990 | - $dest_line = $pawn_line-1; |
|
| 1118 | + if ( $player == 'w' ) { |
|
| 1119 | + $dest_line = $pawn_line+1; |
|
| 1120 | + } else { |
|
| 1121 | + $dest_line = $pawn_line-1; |
|
| 1122 | + } |
|
| 991 | 1123 | $this->ac_move = sprintf( "P%s%dx%s%d", |
| 992 | 1124 | $move[0],$pawn_line,$move[1],$dest_line ); |
| 993 | 1125 | return ""; |
| 994 | 1126 | } |
| 995 | 1127 | } |
| 996 | 1128 | } |
| 997 | - } |
|
| 998 | - else |
|
| 1129 | + } else |
|
| 999 | 1130 | { |
| 1000 | 1131 | /* figure move */ |
| 1001 | 1132 | $dest_coord = substr( $move, strlen($move)-2, 2 ); |
| 1002 | 1133 | $action = $move[strlen($move)-3]; |
| 1003 | - if ( $action != 'x' ) $action = '-'; |
|
| 1004 | - if ( $player == 'w' ) |
|
| 1005 | - $figures = $this->w_figures; |
|
| 1006 | - else |
|
| 1007 | - $figures = $this->b_figures; |
|
| 1134 | + if ( $action != 'x' ) { |
|
| 1135 | + $action = '-'; |
|
| 1136 | + } |
|
| 1137 | + if ( $player == 'w' ) { |
|
| 1138 | + $figures = $this->w_figures; |
|
| 1139 | + } else { |
|
| 1140 | + $figures = $this->b_figures; |
|
| 1141 | + } |
|
| 1008 | 1142 | $fig_count = 0; |
| 1009 | - foreach( $figures as $figure ) |
|
| 1010 | - if ( $figure[0] == $move[0] ) |
|
| 1143 | + foreach( $figures as $figure ) { |
|
| 1144 | + if ( $figure[0] == $move[0] ) |
|
| 1011 | 1145 | { |
| 1012 | 1146 | $fig_count++; |
| 1013 | - if ( $fig_count == 1 ) |
|
| 1014 | - $pos1 = substr( $figure, 1, 2 ); |
|
| 1015 | - else |
|
| 1016 | - $pos2 = substr( $figure, 1, 2 ); |
|
| 1147 | + } |
|
| 1148 | + if ( $fig_count == 1 ) { |
|
| 1149 | + $pos1 = substr( $figure, 1, 2 ); |
|
| 1150 | + } else { |
|
| 1151 | + $pos2 = substr( $figure, 1, 2 ); |
|
| 1152 | + } |
|
| 1017 | 1153 | } |
| 1018 | - if ( $fig_count == 0 ) |
|
| 1019 | - return $this->move_msg(_MD_CHESS_MOVE_NO_FIGURE, $move[0], $this->getFullFigureName($move[0])); // sprintf("there is no figure %s = %s", $move[0], $this->getFullFigureName($move[0])) |
|
| 1154 | + if ( $fig_count == 0 ) { |
|
| 1155 | + return $this->move_msg(_MD_CHESS_MOVE_NO_FIGURE, $move[0], $this->getFullFigureName($move[0])); |
|
| 1156 | + } |
|
| 1157 | + // sprintf("there is no figure %s = %s", $move[0], $this->getFullFigureName($move[0])) |
|
| 1020 | 1158 | else |
| 1021 | 1159 | if ( $fig_count == 1 ) |
| 1022 | 1160 | { |
| 1023 | 1161 | $this->ac_move = sprintf( "%s%s%s%s", |
| 1024 | 1162 | $move[0], $pos1, $action, $dest_coord ); |
| 1025 | 1163 | return ""; |
| 1026 | - } |
|
| 1027 | - else |
|
| 1164 | + } else |
|
| 1028 | 1165 | { |
| 1029 | 1166 | /* two figures which may cause ambiguity */ |
| 1030 | 1167 | $dest_pos = $this->boardCoordToIndex( $dest_coord ); |
| 1031 | - if ( $dest_pos == 64 ) |
|
| 1032 | - return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $dest_coord); // "coordinate $dest_coord is invalid" |
|
| 1168 | + if ( $dest_pos == 64 ) { |
|
| 1169 | + return $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $dest_coord); |
|
| 1170 | + } |
|
| 1171 | + // "coordinate $dest_coord is invalid" |
|
| 1033 | 1172 | $fig1_can_reach = $this->tileIsReachable( $move[0], |
| 1034 | 1173 | $this->boardCoordToIndex($pos1), $dest_pos ); |
| 1035 | 1174 | $fig2_can_reach = $this->tileIsReachable( $move[0], |
| 1036 | 1175 | $this->boardCoordToIndex($pos2), $dest_pos ); |
| 1037 | - if ( !$fig1_can_reach && !$fig2_can_reach ) |
|
| 1038 | - return $this->move_msg(_MD_CHESS_MOVE_NEITHER_CAN_REACH, $move[0], $this->getFullFigureName($move[0]), $dest_coord); // sprintf("neither of the %s = %s can reach %s", $move[0], $this->getFullFigureName($move[0]), $dest_coord) |
|
| 1176 | + if ( !$fig1_can_reach && !$fig2_can_reach ) { |
|
| 1177 | + return $this->move_msg(_MD_CHESS_MOVE_NEITHER_CAN_REACH, $move[0], $this->getFullFigureName($move[0]), $dest_coord); |
|
| 1178 | + } |
|
| 1179 | + // sprintf("neither of the %s = %s can reach %s", $move[0], $this->getFullFigureName($move[0]), $dest_coord) |
|
| 1039 | 1180 | else |
| 1040 | 1181 | if ( $fig1_can_reach && $fig2_can_reach ) |
| 1041 | 1182 | { |
| 1042 | 1183 | /* ambiguity - check whether a hint is given */ |
| 1043 | 1184 | if ( ($action=='-' && strlen($move)==4) || |
| 1044 | - ($action=='x' && strlen($move)==5) ) |
|
| 1045 | - $hint = $move[1]; |
|
| 1046 | - if ( empty($hint) ) |
|
| 1047 | - return $this->move_msg(_MD_CHESS_MOVE_BOTH_CAN_REACH, $move[0], $this->getFullFigureName($move[0]), $dest_coord); // sprintf("both of the %s = %s can reach %s", $move[0], $this->getFullFigureName($move[0]), $dest_coord) |
|
| 1185 | + ($action=='x' && strlen($move)==5) ) { |
|
| 1186 | + $hint = $move[1]; |
|
| 1187 | + } |
|
| 1188 | + if ( empty($hint) ) { |
|
| 1189 | + return $this->move_msg(_MD_CHESS_MOVE_BOTH_CAN_REACH, $move[0], $this->getFullFigureName($move[0]), $dest_coord); |
|
| 1190 | + } |
|
| 1191 | + // sprintf("both of the %s = %s can reach %s", $move[0], $this->getFullFigureName($move[0]), $dest_coord) |
|
| 1048 | 1192 | else |
| 1049 | 1193 | { |
| 1050 | 1194 | $move_fig1 = 0; |
| 1051 | 1195 | $move_fig2 = 0; |
| 1052 | 1196 | if ( $hint>='1' && $hint<='8' ) |
| 1053 | 1197 | { |
| 1054 | - if ( $pos1[1]==$hint && $pos2[1]!=$hint ) |
|
| 1055 | - $move_fig1 = 1; |
|
| 1056 | - if ( $pos2[1]==$hint && $pos1[1]!=$hint ) |
|
| 1057 | - $move_fig2 = 1; |
|
| 1058 | - } |
|
| 1059 | - else |
|
| 1198 | + if ( $pos1[1]==$hint && $pos2[1]!=$hint ) { |
|
| 1199 | + $move_fig1 = 1; |
|
| 1200 | + } |
|
| 1201 | + if ( $pos2[1]==$hint && $pos1[1]!=$hint ) { |
|
| 1202 | + $move_fig2 = 1; |
|
| 1203 | + } |
|
| 1204 | + } else |
|
| 1060 | 1205 | { |
| 1061 | - if ( $pos1[0]==$hint && $pos2[0]!=$hint ) |
|
| 1062 | - $move_fig1 = 1; |
|
| 1063 | - if ( $pos2[0]==$hint && $pos1[0]!=$hint ) |
|
| 1064 | - $move_fig2 = 1; |
|
| 1206 | + if ( $pos1[0]==$hint && $pos2[0]!=$hint ) { |
|
| 1207 | + $move_fig1 = 1; |
|
| 1208 | + } |
|
| 1209 | + if ( $pos2[0]==$hint && $pos1[0]!=$hint ) { |
|
| 1210 | + $move_fig2 = 1; |
|
| 1211 | + } |
|
| 1065 | 1212 | } |
| 1066 | - if ( !$move_fig1 && !$move_fig2 ) |
|
| 1067 | - return _MD_CHESS_MOVE_AMBIGUOUS; // "ambiguity is not properly resolved" |
|
| 1068 | - if ( $move_fig1 ) |
|
| 1069 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1213 | + if ( !$move_fig1 && !$move_fig2 ) { |
|
| 1214 | + return _MD_CHESS_MOVE_AMBIGUOUS; |
|
| 1215 | + } |
|
| 1216 | + // "ambiguity is not properly resolved" |
|
| 1217 | + if ( $move_fig1 ) { |
|
| 1218 | + $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1070 | 1219 | $move[0], $pos1, $action, $dest_coord ); |
| 1071 | - else |
|
| 1072 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1220 | + } else { |
|
| 1221 | + $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1073 | 1222 | $move[0], $pos2, $action, $dest_coord ); |
| 1223 | + } |
|
| 1074 | 1224 | return; |
| 1075 | 1225 | } |
| 1076 | - } |
|
| 1077 | - else |
|
| 1226 | + } else |
|
| 1078 | 1227 | { |
| 1079 | - if ( $fig1_can_reach ) |
|
| 1080 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1081 | - $move[0], $pos1, $action, $dest_coord ); |
|
| 1082 | - else |
|
| 1083 | - $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1084 | - $move[0], $pos2, $action, $dest_coord ); |
|
| 1228 | + if ( $fig1_can_reach ) { |
|
| 1229 | + $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1230 | + $move[0], $pos1, $action, $dest_coord ); |
|
| 1231 | + } else { |
|
| 1232 | + $this->ac_move = sprintf( "%s%s%s%s", |
|
| 1233 | + $move[0], $pos2, $action, $dest_coord ); |
|
| 1234 | + } |
|
| 1085 | 1235 | return ""; |
| 1086 | 1236 | } |
| 1087 | 1237 | } |
@@ -1113,22 +1263,23 @@ discard block |
||
| 1113 | 1263 | { |
| 1114 | 1264 | /* skip P anycase. for attacks skip source digit |
| 1115 | 1265 | and for moves skip source pos and - */ |
| 1116 | - if ( $move[3] == '-' ) |
|
| 1117 | - $new_move = substr( $move, 4 ); |
|
| 1118 | - else |
|
| 1119 | - if ( $move[3] == 'x' ) |
|
| 1120 | - $new_move = sprintf("%s%s", $move[1], substr( $move, 3 ) ); |
|
| 1121 | - } |
|
| 1122 | - else |
|
| 1266 | + if ( $move[3] == '-' ) { |
|
| 1267 | + $new_move = substr( $move, 4 ); |
|
| 1268 | + } else |
|
| 1269 | + if ( $move[3] == 'x' ) { |
|
| 1270 | + $new_move = sprintf("%s%s", $move[1], substr( $move, 3 ) ); |
|
| 1271 | + } |
|
| 1272 | + } else |
|
| 1123 | 1273 | { |
| 1124 | 1274 | /* try to remove the source position and check whether it |
| 1125 | 1275 | * is a non-ambigious move. if it is add one of the components |
| 1126 | 1276 | * and check again */ |
| 1127 | - if ( $move[3] == '-' ) |
|
| 1128 | - $dest = substr( $move, 4 ); |
|
| 1129 | - else |
|
| 1130 | - if ( $move[3] == 'x' ) |
|
| 1131 | - $dest = substr( $move, 3 ); |
|
| 1277 | + if ( $move[3] == '-' ) { |
|
| 1278 | + $dest = substr( $move, 4 ); |
|
| 1279 | + } else |
|
| 1280 | + if ( $move[3] == 'x' ) { |
|
| 1281 | + $dest = substr( $move, 3 ); |
|
| 1282 | + } |
|
| 1132 | 1283 | $new_move = sprintf("%s%s", $move[0], $dest ); |
| 1133 | 1284 | if ( $this->completeMove($player,$new_move) != "" ) |
| 1134 | 1285 | { |
@@ -1138,8 +1289,10 @@ discard block |
||
| 1138 | 1289 | { |
| 1139 | 1290 | /* add other component */ |
| 1140 | 1291 | $new_move = sprintf("%s%s%s", $move[0], $move[2], $dest ); |
| 1141 | - if ( $this->completeMove($player,$new_move) != "" ) |
|
| 1142 | - $new_move = $move; /* give up */ |
|
| 1292 | + if ( $this->completeMove($player,$new_move) != "" ) { |
|
| 1293 | + $new_move = $move; |
|
| 1294 | + } |
|
| 1295 | + /* give up */ |
|
| 1143 | 1296 | } |
| 1144 | 1297 | } |
| 1145 | 1298 | } |
@@ -1323,67 +1476,91 @@ discard block |
||
| 1323 | 1476 | $result = _MD_CHESS_MOVE_CASTLED_LONG; |
| 1324 | 1477 | $move_handled = 1; |
| 1325 | 1478 | $this->last_move = "O-O-O"; |
| 1326 | - } |
|
| 1327 | - |
|
| 1328 | - else |
|
| 1479 | + } else |
|
| 1329 | 1480 | { |
| 1330 | 1481 | /* [PRNBQK][a-h][1-8][-:x][a-h][1-8][RNBQK] full move */ |
| 1331 | 1482 | |
| 1332 | 1483 | /* allow short move description by autocompleting to |
| 1333 | 1484 | * full description */ |
| 1334 | 1485 | $ac_error = $this->completeMove( $cur_player, trim($move) ); |
| 1335 | - if ( $ac_error != "" ) |
|
| 1336 | - return(array(false, $ac_error)); // "ERROR: autocomplete: $ac_error" |
|
| 1337 | - else |
|
| 1338 | - $move = $this->ac_move; |
|
| 1486 | + if ( $ac_error != "" ) { |
|
| 1487 | + return(array(false, $ac_error)); |
|
| 1488 | + } |
|
| 1489 | + // "ERROR: autocomplete: $ac_error" |
|
| 1490 | + else { |
|
| 1491 | + $move = $this->ac_move; |
|
| 1492 | + } |
|
| 1339 | 1493 | $this->last_move = str_replace( "?", "", $move ); |
| 1340 | 1494 | |
| 1341 | 1495 | /* a final captial letter may only be N,B,R,Q for the |
| 1342 | 1496 | * appropiate chessman */ |
| 1343 | 1497 | $c = $move[strlen($move)-1]; |
| 1344 | - if ( $c >= 'A' && $c <= 'Z' ) |
|
| 1345 | - if ( $c != 'N' && $c != 'B' && $c != 'R' && $c != 'Q' ) |
|
| 1346 | - return(array(false, _MD_CHESS_MOVE_INVALID_PIECE)); // "ERROR: only N (knight), B (bishop), R (rook) and Q (queen) are valid chessman identifiers" |
|
| 1498 | + if ( $c >= 'A' && $c <= 'Z' ) { |
|
| 1499 | + if ( $c != 'N' && $c != 'B' && $c != 'R' && $c != 'Q' ) |
|
| 1500 | + return(array(false, _MD_CHESS_MOVE_INVALID_PIECE)); |
|
| 1501 | + } |
|
| 1502 | + // "ERROR: only N (knight), B (bishop), R (rook) and Q (queen) are valid chessman identifiers" |
|
| 1347 | 1503 | |
| 1348 | 1504 | /* if it is a full move, try to shorten the history move */ |
| 1349 | - if ( strlen( $history_move ) >= 6 ) |
|
| 1350 | - $history_move = |
|
| 1505 | + if ( strlen( $history_move ) >= 6 ) { |
|
| 1506 | + $history_move = |
|
| 1351 | 1507 | $this->convertFullToChessNotation($cur_player,$history_move); |
| 1508 | + } |
|
| 1352 | 1509 | /* DEBUG: echo "Move: $move ($history_move)<BR>"; */ |
| 1353 | 1510 | |
| 1354 | 1511 | /* validate figure and position */ |
| 1355 | 1512 | $fig_type = $move[0]; |
| 1356 | 1513 | $fig_name = $this->getFullFigureName( $fig_type ); |
| 1357 | - if ( $fig_name == "empty" ) |
|
| 1358 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_UNKNOWN_FIGURE, $fig_type))); // "ERROR: Figure $fig_type is unknown!" |
|
| 1514 | + if ( $fig_name == "empty" ) { |
|
| 1515 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_UNKNOWN_FIGURE, $fig_type))); |
|
| 1516 | + } |
|
| 1517 | + // "ERROR: Figure $fig_type is unknown!" |
|
| 1359 | 1518 | $fig_coord = substr($move,1,2); |
| 1360 | 1519 | $fig_pos = $this->boardCoordToIndex( $fig_coord ); |
| 1361 | - if ( $fig_pos == 64 ) return(array(false, $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $fig_coord))); // "ERROR: $fig_coord is invalid!" |
|
| 1520 | + if ( $fig_pos == 64 ) { |
|
| 1521 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $fig_coord))); |
|
| 1522 | + } |
|
| 1523 | + // "ERROR: $fig_coord is invalid!" |
|
| 1362 | 1524 | /* DEBUG echo "fig_type: $fig_type, fig_pos: $fig_pos<BR>"; */ |
| 1363 | - if ($this->is_empty_tile($fig_pos)) |
|
| 1364 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_TILE_EMPTY, $fig_coord))); // "ERROR: Tile $fig_coord is empty." |
|
| 1365 | - if ( $this->board[$fig_pos]{0} != $cur_player ) |
|
| 1366 | - return(array(false, _MD_CHESS_MOVE_NOT_YOUR_PIECE)); // "ERROR: Figure does not belong to you!" |
|
| 1367 | - if ( $this->board[$fig_pos]{1} != $fig_type ) |
|
| 1368 | - return(array(false, _MD_CHESS_MOVE_NOEXIST_FIGURE)); // "ERROR: Figure does not exist!" |
|
| 1525 | + if ($this->is_empty_tile($fig_pos)) { |
|
| 1526 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_TILE_EMPTY, $fig_coord))); |
|
| 1527 | + } |
|
| 1528 | + // "ERROR: Tile $fig_coord is empty." |
|
| 1529 | + if ( $this->board[$fig_pos]{0} != $cur_player ) { |
|
| 1530 | + return(array(false, _MD_CHESS_MOVE_NOT_YOUR_PIECE)); |
|
| 1531 | + } |
|
| 1532 | + // "ERROR: Figure does not belong to you!" |
|
| 1533 | + if ( $this->board[$fig_pos]{1} != $fig_type ) { |
|
| 1534 | + return(array(false, _MD_CHESS_MOVE_NOEXIST_FIGURE)); |
|
| 1535 | + } |
|
| 1536 | + // "ERROR: Figure does not exist!" |
|
| 1369 | 1537 | |
| 1370 | 1538 | /* get target index */ |
| 1371 | 1539 | $dest_coord = substr($move,4,2); |
| 1372 | 1540 | $dest_pos = $this->boardCoordToIndex( $dest_coord ); |
| 1373 | - if ( $dest_pos == 64 ) |
|
| 1374 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $dest_coord))); // "ERROR: $dest_coord is invalid!" |
|
| 1375 | - if ( $dest_pos == $fig_pos ) |
|
| 1376 | - return(array(false, _MD_CHESS_MOVE_START_END_SAME)); |
|
| 1541 | + if ( $dest_pos == 64 ) { |
|
| 1542 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_COORD_INVALID, $dest_coord))); |
|
| 1543 | + } |
|
| 1544 | + // "ERROR: $dest_coord is invalid!" |
|
| 1545 | + if ( $dest_pos == $fig_pos ) { |
|
| 1546 | + return(array(false, _MD_CHESS_MOVE_START_END_SAME)); |
|
| 1547 | + } |
|
| 1377 | 1548 | /* DEBUG echo "dest_pos: $dest_pos<BR>"; */ |
| 1378 | 1549 | |
| 1379 | 1550 | /* get action */ |
| 1380 | 1551 | $action = $move[3]; |
| 1381 | - if ( $move[3] == "-" ) |
|
| 1382 | - $action = 'M'; /* move */ |
|
| 1383 | - else if ( $move[3] == 'x' ) |
|
| 1384 | - $action = 'A'; /* attack */ |
|
| 1385 | - else |
|
| 1386 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_UNKNOWN_ACTION, $action))); // "ERROR: $action is unknown! Please use \"-\" for a move and \"x\" for an attack." |
|
| 1552 | + if ( $move[3] == "-" ) { |
|
| 1553 | + $action = 'M'; |
|
| 1554 | + } |
|
| 1555 | + /* move */ |
|
| 1556 | + else if ( $move[3] == 'x' ) { |
|
| 1557 | + $action = 'A'; |
|
| 1558 | + } |
|
| 1559 | + /* attack */ |
|
| 1560 | + else { |
|
| 1561 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_UNKNOWN_ACTION, $action))); |
|
| 1562 | + } |
|
| 1563 | + // "ERROR: $action is unknown! Please use \"-\" for a move and \"x\" for an attack." |
|
| 1387 | 1564 | |
| 1388 | 1565 | /* if attack an enemy unit must be present on tile |
| 1389 | 1566 | * and if move then tile must be empty. in both cases |
@@ -1395,14 +1572,19 @@ discard block |
||
| 1395 | 1572 | * checked here. */ |
| 1396 | 1573 | if ( $fig_type != 'P' ) |
| 1397 | 1574 | { |
| 1398 | - if ( !$this->tileIsReachable( $fig_type, $fig_pos, $dest_pos ) ) |
|
| 1399 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of moving range for $fig_name at $fig_coord!" |
|
| 1400 | - } |
|
| 1401 | - else { |
|
| 1402 | - if ( $action == 'M' && !$this->checkPawnMove( $fig_pos, $dest_pos ) ) |
|
| 1403 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of moving range for $fig_name at $fig_coord!" |
|
| 1404 | - if ( $action == 'A' && !$this->checkPawnAttack( $fig_pos, $dest_pos ) ) |
|
| 1405 | - return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); // "ERROR: Tile $dest_coord is out of attacking range for $fig_name at $fig_coord!" |
|
| 1575 | + if ( !$this->tileIsReachable( $fig_type, $fig_pos, $dest_pos ) ) { |
|
| 1576 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); |
|
| 1577 | + } |
|
| 1578 | + // "ERROR: Tile $dest_coord is out of moving range for $fig_name at $fig_coord!" |
|
| 1579 | + } else { |
|
| 1580 | + if ( $action == 'M' && !$this->checkPawnMove( $fig_pos, $dest_pos ) ) { |
|
| 1581 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); |
|
| 1582 | + } |
|
| 1583 | + // "ERROR: Tile $dest_coord is out of moving range for $fig_name at $fig_coord!" |
|
| 1584 | + if ( $action == 'A' && !$this->checkPawnAttack( $fig_pos, $dest_pos ) ) { |
|
| 1585 | + return(array(false, $this->move_msg(_MD_CHESS_MOVE_OUT_OF_RANGE, $dest_coord, $fig_name, $fig_coord))); |
|
| 1586 | + } |
|
| 1587 | + // "ERROR: Tile $dest_coord is out of attacking range for $fig_name at $fig_coord!" |
|
| 1406 | 1588 | } |
| 1407 | 1589 | |
| 1408 | 1590 | $en_passant_capture_performed = 0; // 1 if en passant captured occurred, else 0 |
@@ -1433,8 +1615,9 @@ discard block |
||
| 1433 | 1615 | |
| 1434 | 1616 | /* perform move */ |
| 1435 | 1617 | $this->clear_tile($fig_pos); |
| 1436 | - if (!$this->is_empty_tile($dest_pos)) |
|
| 1437 | - $this->piece_captured = sprintf("%s%s",$this->board[$dest_pos],$dest_pos); |
|
| 1618 | + if (!$this->is_empty_tile($dest_pos)) { |
|
| 1619 | + $this->piece_captured = sprintf("%s%s",$this->board[$dest_pos],$dest_pos); |
|
| 1620 | + } |
|
| 1438 | 1621 | $this->board[$dest_pos] = "$cur_player$fig_type"; |
| 1439 | 1622 | if ( $en_passant_capture_performed ) { |
| 1440 | 1623 | /* kill pawn */ |
@@ -1442,8 +1625,7 @@ discard block |
||
| 1442 | 1625 | { |
| 1443 | 1626 | $this->clear_tile($dest_pos - 8); |
| 1444 | 1627 | $this->piece_captured = sprintf("bP%s",$dest_pos-8); |
| 1445 | - } |
|
| 1446 | - else |
|
| 1628 | + } else |
|
| 1447 | 1629 | { |
| 1448 | 1630 | $this->clear_tile($dest_pos + 8); |
| 1449 | 1631 | $this->piece_captured = sprintf("wP%s",$dest_pos+8); |
@@ -1457,10 +1639,11 @@ discard block |
||
| 1457 | 1639 | $this->board[$dest_pos] = $old_dest_tile; |
| 1458 | 1640 | if ( $en_passant_capture_performed ) { |
| 1459 | 1641 | // restore pawn that was captured above, since that move is invalid |
| 1460 | - if ( $cur_player == 'w' ) |
|
| 1461 | - $this->board[$dest_pos-8] = "bP"; |
|
| 1462 | - else |
|
| 1463 | - $this->board[$dest_pos+8] = "wP"; |
|
| 1642 | + if ( $cur_player == 'w' ) { |
|
| 1643 | + $this->board[$dest_pos-8] = "bP"; |
|
| 1644 | + } else { |
|
| 1645 | + $this->board[$dest_pos+8] = "wP"; |
|
| 1646 | + } |
|
| 1464 | 1647 | } |
| 1465 | 1648 | return(array(false, _MD_CHESS_MOVE_IN_CHECK)); // "ERROR: Move is invalid because king would be under attack then." |
| 1466 | 1649 | } |
@@ -1501,10 +1684,11 @@ discard block |
||
| 1501 | 1684 | $this->gamestate['fen_en_passant_target_square'] = '-'; |
| 1502 | 1685 | } |
| 1503 | 1686 | |
| 1504 | - if ($action == 'M' ) |
|
| 1505 | - $result = $this->move_msg(_MD_CHESS_MOVE_MOVED, $fig_name, $fig_coord, $dest_coord); |
|
| 1506 | - else |
|
| 1507 | - $result = $this->move_msg(_MD_CHESS_MOVE_CAPTURED, $fig_name, $dest_coord, $fig_coord); |
|
| 1687 | + if ($action == 'M' ) { |
|
| 1688 | + $result = $this->move_msg(_MD_CHESS_MOVE_MOVED, $fig_name, $fig_coord, $dest_coord); |
|
| 1689 | + } else { |
|
| 1690 | + $result = $this->move_msg(_MD_CHESS_MOVE_CAPTURED, $fig_name, $dest_coord, $fig_coord); |
|
| 1691 | + } |
|
| 1508 | 1692 | |
| 1509 | 1693 | /* if pawn reached last line convert into a queen */ |
| 1510 | 1694 | if ( $fig_type == 'P' ) |
@@ -1763,8 +1947,10 @@ discard block |
||
| 1763 | 1947 | default: return 64; /* erronous coord */ |
| 1764 | 1948 | } |
| 1765 | 1949 | $y = $coord[1]-1; |
| 1766 | - if ( $y < 0 || $y > 7 ) |
|
| 1767 | - return 64; /* erronous coord */ |
|
| 1950 | + if ( $y < 0 || $y > 7 ) { |
|
| 1951 | + return 64; |
|
| 1952 | + } |
|
| 1953 | + /* erronous coord */ |
|
| 1768 | 1954 | $index = $y * 8 + $x; |
| 1769 | 1955 | //echo "$index | "; |
| 1770 | 1956 | return $index; |
@@ -1781,8 +1967,9 @@ discard block |
||
| 1781 | 1967 | function boardIndexToCoord( $index ) |
| 1782 | 1968 | { |
| 1783 | 1969 | //echo $index," --> "; |
| 1784 | - if ( $index < 0 || $index > 63 ) |
|
| 1785 | - return ""; |
|
| 1970 | + if ( $index < 0 || $index > 63 ) { |
|
| 1971 | + return ""; |
|
| 1972 | + } |
|
| 1786 | 1973 | $y = floor($index/8)+1; |
| 1787 | 1974 | $x = chr( ($index%8)+97 ); |
| 1788 | 1975 | $coord = "$x$y"; |
@@ -1825,14 +2012,30 @@ discard block |
||
| 1825 | 2012 | |
| 1826 | 2013 | $x = $fig_pos % 8; $y = floor( $fig_pos / 8 ); |
| 1827 | 2014 | |
| 1828 | - if ( $x > 0 && $y > 0 ) $adj_tiles[$i++] = $fig_pos-9; |
|
| 1829 | - if ( $y > 0 ) $adj_tiles[$i++] = $fig_pos-8; |
|
| 1830 | - if ( $x < 7 && $y > 0 ) $adj_tiles[$i++] = $fig_pos-7; |
|
| 1831 | - if ( $x < 7 ) $adj_tiles[$i++] = $fig_pos+1; |
|
| 1832 | - if ( $x < 7 && $y < 7 ) $adj_tiles[$i++] = $fig_pos+9; |
|
| 1833 | - if ( $y < 7 ) $adj_tiles[$i++] = $fig_pos+8; |
|
| 1834 | - if ( $x > 0 && $y < 7 ) $adj_tiles[$i++] = $fig_pos+7; |
|
| 1835 | - if ( $x > 0 ) $adj_tiles[$i++] = $fig_pos-1; |
|
| 2015 | + if ( $x > 0 && $y > 0 ) { |
|
| 2016 | + $adj_tiles[$i++] = $fig_pos-9; |
|
| 2017 | + } |
|
| 2018 | + if ( $y > 0 ) { |
|
| 2019 | + $adj_tiles[$i++] = $fig_pos-8; |
|
| 2020 | + } |
|
| 2021 | + if ( $x < 7 && $y > 0 ) { |
|
| 2022 | + $adj_tiles[$i++] = $fig_pos-7; |
|
| 2023 | + } |
|
| 2024 | + if ( $x < 7 ) { |
|
| 2025 | + $adj_tiles[$i++] = $fig_pos+1; |
|
| 2026 | + } |
|
| 2027 | + if ( $x < 7 && $y < 7 ) { |
|
| 2028 | + $adj_tiles[$i++] = $fig_pos+9; |
|
| 2029 | + } |
|
| 2030 | + if ( $y < 7 ) { |
|
| 2031 | + $adj_tiles[$i++] = $fig_pos+8; |
|
| 2032 | + } |
|
| 2033 | + if ( $x > 0 && $y < 7 ) { |
|
| 2034 | + $adj_tiles[$i++] = $fig_pos+7; |
|
| 2035 | + } |
|
| 2036 | + if ( $x > 0 ) { |
|
| 2037 | + $adj_tiles[$i++] = $fig_pos-1; |
|
| 2038 | + } |
|
| 1836 | 2039 | |
| 1837 | 2040 | /* DEBUG: foreach( $adj_tiles as $tile ) |
| 1838 | 2041 | echo "adj: $tile "; */ |