401
404
>Порівняти</guibutton
402
405
> для порівняння цього набору з вашим власними наборами правил. </para
404
>You can start the &kajongg; game server in two different ways: <itemizedlist
407
>Якщо ви не хочете користуватися <ulink url="http://www.kde.org/applications/games/kajongg/"
409
> або будь-яким іншим сервером гри, ви можете запустити власний сервер гри &kajongg; у один з таких двох способів: <itemizedlist
407
412
>встановити з’єднання з сервером "localhost". Цим сервером буде ваш власний комп’ютер. Якщо ви виберете цей варіант, а ігровий сервер ще не буде запущено, програма запустить його у автоматичному режимі. Після завершення гри програма так само автоматично завершить роботу сервера. </para
411
>manually start a server on any computer you want. All you need to do is go to a command line and start the program "kajonggserver". Entering "kajonggserver --help" will show you all available options like changing the default port 8149. This server will run until you kill it. </para
416
>запустити сервер на будь-якому іншому комп’ютері вручну. Для цього вам достатньо наказати виконати програму <literal
417
>kajonggserver</literal
418
> за допомогою командного рядка. Якщо ви скористаєтеся командою <literal
419
>kajonggserver --help</literal
420
>, програма покаже вам всі можливі параметри, зокрема подасть довідку щодо зміни типового порту. Запущений таким чином сервер працюватиме, доки ви не перервете його роботу. </para
416
>In both cases you need to tell the other players how they can reach your game server. They need the &URL; or simply an IP address and the port your server is listening on. This might be something like "mypc.dyndns.org:8149" where 8149 is the port. Of course you need to configure your firewall such that the remote player can reach that port. The communication will be encrypted. </para
418
>If you encounter possible bugs, you might want to use the option "--showtraffic". This will show you, on the console where the game server has been started, what messages are flowing between the game server and the clients. </para>
425
>У обох випадках вам слід повідомити іншим гравцям про те, яким чином можна з’єднатися з вашим ігровим сервером. Вам потрібно буде назвати адресу URL або просто IP-адресу, а також порт, на якому сервер очікуватиме на з’єднання. Це може бути щось на зразок <literal
426
>mypc.dyndns.org:8409</literal
429
> — це номер порту. Звичайно ж, вам слід налаштувати брандмауер вашого комп’ютера таким чином, щоб віддалений гравець зміг встановити з’єднання з відповідним портом. Весь обмін даними буде зашифровано. </para
431
>Сервер визначає типовий порт на основі даних щодо версії. Якщо, наприклад, ви користуєтеся &kajongg; версії 4.9.5, буде використано порт 8409: 8000 плюс перша цифра версії помножена н на 100 плюс середня цифра версії. Якщо користувачем не буде вказано порту для встановлення з’єднання з сервером, клієнтська програма обчислить номер порту у такий самий спосіб. Отже, якщо комп’ютер працює з декількома ігровими серверами, програма використовуватиме сумісний з нею сервер автоматично. Щоб там не сталося, але сервер гри і клієнтська частина автоматично забезпечать сумісність між собою і попередять користувача, якщо таку сумісність встановити не вдасться. </para
433
>Якщо ви натрапите на можливі вади у програмі, ви можете скористатися параметром <literal
434
>--debug=traffic</literal
435
>. За його допомогою ви зможете побачити у консолі, з якої запущено ігровий сервер, повідомлення, якими обмінювалися сервер гри та клієнти. </para>
419
436
<sect2 id="playing-caveats">
421
438
>Застереження</title>
965
>It is possible to record sound files for your announcements which will be heard by the other players. There is some manual work needed: </para>
969
>First you need to find out where to store your voice files. This folder normally is ~/.kde/share/apps/kajongg. So if your login name is joe, this might be /home/joe/.kde/share/apps/kajongg. In there you will also find the database kajongg.db. </para
973
>In the folder you just located, generate a new subfolder with the name <filename class="directory"
979
>In the folder <filename class="directory"
981
> generate another subfolder with your player name. This is the name you use when connecting to a game server. You may also want to define voices for the players <filename
991
>In that subfolder, you can place the sound files. They have to be encoded with the <ulink url="http://xiph.org/vorbis/"
1033
>Грати набагато цікавіше, якщо ви чуєте, як гравці оголошують про ходи або викидання плиток. Крім того, так грати простіше, оскільки ви можете зосередитися на власних плитках, вам не потрібно відволікатися на розглядання плиток, які було викинуто іншими гравцями. </para>
1035
>У &kajongg; передбачено звукові файли для різних гравців. Набори цих звукових файлів (голоси) призначатимуться гравцям автоматично. Для кожної мови має бути записано чотири голоси, два чоловічі і два жіночі. &kajongg; намагається використовувати голоси тієї мови, якою показано інтерфейс &kajongg;. Якщо голосів відповідною мовою виявлено не буде, &kajongg; повернеться до використання голосів інших мов. Буде використано ті мови, які було визначено як резервні для &kajongg; (див. <menuchoice
1039
>Перемкнути мову програми</guimenuitem
1041
>). Якщо голосових файлів вашою мовою ще не створено, вам варто записати ці голосові файли і надіслати їх розробникам &kajongg;. </para>
1045
>Нижче описано процедуру створення голосових файлів. Для кожного голосу слід створити окрему теку. У файловій системі має бути дві групи голосів з різними розташуваннями. <itemizedlist
1048
>Стандартні голоси для кожної мови. Ці голоси зберігаються у теці з назвою <filename class="directory"
1049
>/usr/share/kde4/apps/kajongg/voices/МОВА</filename
1050
>, де МОВА — код вашої мови. Теки голосів, розташовані безпосередньо у <filename class="directory"
1051
>.../kajongg/voices/</filename
1052
> є теками голосів американською англійською. Стандартні голоси призначаються гравцям випадковим чином. Такі голоси мають назви <literal
1053
>"male1 male2 female1 female2"</literal
1054
>, але вказані імена насправді нічого не значать, оскільки ви ніколи не бачитимете ці імена у грі. Крім того, немає сенсу визначати понад чотири стандартні голоси на одну мову. </para
1058
>Голоси, визначені користувачем, можна створювати для кожного з користувачів програми. Якщо у &kajongg; визначено використання такого голосу, відповідні голосові дані буде передано іншим гравцям за допомогою інтернету. Такі голоси зберігаються у теці з назвою, подібною до <filename class="directory"
1059
>~/.kde/share/apps/kajongg/voices/</filename
1060
>. Отже, якщо вашим користувачем у системі є користувач ivan, відповідна тека матиме назву <filename class="directory"
1061
>/home/ivan/.kde/share/apps/kajongg/voices/ivan/</filename
1062
>. Теки <filename class="directory"
1064
> у вашій системі може не існувати. Якщо ви не знайдете такої теки, створіть її. </para
1071
>Тепер, коли ви знаєте, куди слід зберегти ваші нові голосові файли, час створити для них новий каталог. </para
1075
>У відповідній підтеці ви можете зберегти файли звукових даних. Звукові дані має бути збережено у кодуванні <ulink url="http://xiph.org/vorbis/"
992
1076
>Ogg Vorbis</ulink
993
> audio compressor, the file names need to have the extension <filename class="extension"
1077
>, назви файлів мають завершуватися суфіксами <filename class="extension"
999
>A single file has a name like <filename
1079
>. Зразок назви файла: <filename
1000
1080
>s3.ogg</filename
1001
> - this is Stone 3. You should define such files for all tiles and for all claims and announcements. </para
1081
> — файл для Каменя 3. Вам слід створити такі файли для всіх плиток і для всіх оголошень. Якщо файла не вистачатиме, нічого страшного не трапиться, — ви просто не почуєте відповідного звуку. Використання резервних файлів з інших мов можливе лише для цілих голосів, — окремі звукові файли не використовуватимуться. </para
1085
>Після визначення всіх файлів звукових даних для стандартного голосу, будь ласка, переконайтеся, що процес &kajongg; має доступ на запис до нового каталогу голосів. Запустіть &kajongg; і виконайте перевірку голосу. Якщо все гаразд, ви можете прибрати доступ на запис (так і слід зробити для стандартних голосів). &kajongg; автоматично створить файл з назвою <filename
1087
>, у якому міститиметься контрольна сума файлів звукових даних. Під час кожної зміни, додавання або вилучення файла звукових даних &kajongg; намагатиметься оновити дані цієї контрольної суми. </para
1003
1089
></itemizedlist>
1005
>Please make the length of the sound short but speak clearly - this game can be played very fast when you get used to it. It is easier if you first write down a list with everything that should be spoken. Do not read it as a sequence of items, try to pronounce each item as if it were the only one and as you would when playing. Reading this needs a little practicing.</para>
1091
>Будь ласка, намагайтеся говорити швидко, але чітко, — у гру можна грати дуже швидко, якщо трохи до неї призвичаїтися. Вам буде легше, якщо ви спочатку створите список всіх фраз, які слід вимовити. Не читайте список як суцільний текст, намагайтеся вимовити кожен пункт окремо, так, як ви вимовляли б його під час гри. Залишайте між словами паузи. Подібний спосіб читання потребує певної вправності.</para>
1007
1093
>Ось лише один зі способів створення файлів звукових даних: </para
1179
1265
>На початку нової гри ви зможете обрати набір правил, за якими вона вестиметься. Можна використовувати будь-який набір правил з визначених у редакторі наборів правил. Набір правил зберігається разом з грою, отже ви завжди зможете змінити набори правил, але внесені вами зміни стосуватимуться лише наступних ігор. </para>
1182
>Rule, Score and Unit</title
1184
>Simply double click on whatever you want to change.</para>
1190
>The definition for a rule can be rather complex. There is a separate chapter <link linkend="rule"
1191
>Defining a Rule</link
1192
> for this. You will normally not have to change a definition. This essentially defines to what hands the rule applies.</para>
1268
>Правило, очки, подвоєння, обмеження</title
1270
>Просто наведіть вказівник на пункт, який ви бажаєте змінити, і двічі клацніть лівою кнопкою миші. Якщо всі значення буде прибрано, правило не впливатиме на гру. Окремі правила не можна вилучати.</para>
1196
1274
>Копіювання і вилучення</title
1198
>You can copy entire rulesets or single rules within a ruleset. Since predefined rulesets are immutable, single rules can only be copied within customized rulesets. </para
1276
>Ви можете копіювати і вилучати цілі набори правил. </para
1200
>You can remove entire customized rulesets or single rules within them. Again this can even be done if existing games use this ruleset since every game has its own ruleset copy. You can view rulesets for old games: <link linkend="game-menu-scoreGame"
1202
> the old game and <link linkend="view-menu"
1203
>show its score table</link
1278
>Знову ж таки, ви можете робити це, навіть якщо існують ігри, які використовують змінений набір правил, оскільки у кожній з ігор міститься власна копію правил, за якими вона ведеться. Ви можете переглянути набори правил для попередніх ігор: <link linkend="game-menu-scoreGame"
1280
> попередню гру і накажіть програмі <link linkend="view-menu"
1281
>показати таблицю з її рахунком</link
1382
>Defining a Rule</title>
1384
>The scoring engine and many other aspects of &kajongg; can be customized with the ruleset editor. A rule consists of a name, a score (including its unit) and a <link linkend="ruledefinition"
1387
<sect1 id="rulegroups">
1389
>Rule Groups</title>
1391
>There are several groups of rules:</para>
1398
>Meld rules are applied to single melds independent of the rest of the hand. </para
1406
>Hand rules are applied to the entire hand, for all players. </para
1411
>Mah Jong Rules</term>
1414
>Mah Jong rules specify how a winnable hand has to look like. This is normally four melds with 3 or 4 tiles each and a pair. But special hands may look differently, for example the 13 Orphans in Classical Chinese. </para
1419
>Winner Rules</term>
1422
>Winner rules are applied to the entire hand but only for the winner. This includes most special hands. Those rules do not have to enforce the correct number of tiles. </para
1430
>Here you can find several special parameters like points for a limit hand. </para
1438
>Penalties are applied manually by the user. </para
1442
<sect2 id="executionorder"
1444
>Order of Execution</title>
1449
>build a list of applicable rules from meld rules and hand rules</para
1453
>using the Mah Jong rules find out if the declared winner hand is really a winner hand.</para
1457
>for the winner append applicable winner rules</para
1461
>if some of the found rules have the action '&absolute;', only keep those. It is yet undefined what happens if more than one is found.</para
1465
>if some of the rules define limits, throw away all others</para
1469
>apply the found rules in that order</para
1475
<sect1 id="ruledefinition">
1477
>The Definition</title>
1479
>The definition is one single string because we want to make it easy to save it in a data base. It consists of several parts separated by the two characters "||". A part expresses either a condition under which the rule applies or it expresses some actions. Only one part for actions may be defined, but several condition expressions. The rule applies as soon as at least one condition expression matches the hand.</para
1481
>&kajongg; comes with a predefined ruleset implementing the Classical Chinese rules as defined by the German DMJL. That should give you a lot of examples.</para
1483
>These are all recognized parts:</para>
1487
>Variable Case Regular Expression</term>
1490
>A part starting with I is a <link linkend="regex"
1491
>Regular Expression</link
1492
> making no difference between upper/lowercase. However case is only ignored in the first, main part of the regular expression. For the parts starting with m,M,x or L, case always matters. </para
1500
>A part starting with A is a list of <link linkend="actions"
1507
>Manual Expression</term>
1510
>A part starting with M is an optional <link linkend="regex"
1511
>Regular Expression</link
1512
>. For scoring manual games, it defines whether this rule should be selectable by the user with a check box. The leading M does not belong to the Regular Expression. An example would be the Rule "Last Tile Taken from Dead Wall". </para
1520
>A part starting with F is a function. Sometimes regular expressions would be too complicated or too slow. In such cases the rule is encoded in the program itself, and it can be referenced here by giving its function name. As of now, only one function <literal
1521
>LastOnlyPossible</literal
1522
> is defined. This function determines if the last tile was the only tile possible for winning. </para
1527
>Regular Expression</term>
1530
>Any other part is a <link linkend="regex"
1531
>Regular Expression</link
1539
>Regular Expressions</title>
1541
>Regular expressions are a very powerful programming tool for matching strings of characters. Powerful but also quite difficult. This is not for the normal game player. There are books available which do nothing else but explain regular expressions.</para>
1543
>There are several dialects of regular expressions. &kajongg; is written in the programming language Python. Since the Python standard library contains a module for regular expressions, this is the dialect we use. </para
1545
>For details see <ulink url="http://docs.python.org/library/re.html#regular-expression-syntax"
1549
>Everything about a hand that might have an influence on the score is encoded in one single string. Then &kajongg; checks if the regular expression matches this string. If it does, the rule is applied.</para>
1551
>As an example, this regular expression matches the limit hand "All Greens":</para
1553
>( |[bB][23468]|[dD]g)*[fy/]</programlisting>
1556
>Structure of a Hand String</title>
1558
>The content of a hand string is always the same no matter what language you use on your desktop.</para>
1560
>The string representing a hand consists of several parts separated by a space. The order of those parts is always the same except for the meld parts at the beginning.</para>
1562
>&kajongg; is able to regroup concealed tiles into melds aiming to get a higher score. It does not matter how the concealed tiles are grouped for this to work. However when it comes to limit hands this might fail. That is why &kajongg; will try the original grouping of tiles as entered by the user and also the regrouped tiles. For both variants, all rules are applied. The variant achieving the higher total score is used.</para>
1564
>Here comes an example. This is really only one line but split here for better readability. Moreover this sentence is repeated once because some regular expressions are much easier to write if the parts can be referenced in another order. See the rule for Robbing the Kong: Its regular expression first looks at the L group (Last Tile) before looking at the melds.</para
1567
>c1c1c1C1 s1s2s3 b6b6b7b7b8b8 b5b5 fn yn
1568
/c416s000b000b000b200 -C416s000b000b000b200 %n Mneka LB5B5B5</literal
1571
>A tile is represented by 2 characters. The first one is s for stone, b for bamboo, c for character, w for wind, d for dragon, y for season bonus, f for flower bonus. The second one is 1..9 for the suits, e,s,w,n for the winds, w,r,g for the dragons (white, red, green) and 1,2,3,4 for the bonus tiles. Exposed tiles have the first character in lowercase, concealed tiles have it in uppercase.</para>
1573
>All the following parts are always present in this order except the part "Last Tile": This one exists only for the winner hand. <variablelist>
1579
>The part starting with any of the characters <literal
1580
>sbcdwSBCDW</literal
1581
> is a meld. A meld holds any number of tiles. &kajongg; will split melds with too many tiles trying to maximize the score.</para
1583
>We use a special syntax for kongs: c1c1c1c1 is an open kong. c1c1c1C1 is an open kong, 4th tile was called for, completing a concealed pung. This is needed for the limit game 'concealed true color game'. c1C1C1c1 is a concealed declared kong. C1C1C1C1 would be a concealed undeclared kong. But since it is undeclared, it is counted as a pung. So this meld will be split into pung C1C1C1 and single C1.</para
1585
>Bonus tiles appear after all other melds.</para
1593
>The part starting with / holds summary information about the melds. This makes it easier to write some regular expressions. Every meld is represented by four characters. The first character is one out of <literal
1594
>sbcdwSBCDW</literal
1595
>, again lowercase for exposed and uppercase for concealed. The second character is a number saying how many tiles the meld holds. This is 1 up to 4 for a kong. The 0 is used for a chow. The last two characters hold the scoring points for this meld. </para
1600
>Alternate summary</term>
1603
>The part starting with - is identical to the above summary but it contains claimed kongs as concealed kongs. Some rules like "Three Concealed Pongs" treat a claimed kong as being concealed. </para
1611
>The part starting with % holds information about the length of the hand: s is a short hand having too few tiles, n is a hand with the correct number of tiles, l is a long hand having too many tiles. </para
1619
>The part starting with m, M or x holds additional information. M stands for the winner hand, m for a loser hand, and x stands for a hand that is forbidden to say Mah Jong. M/m/x is followed by one character for the own wind, one character for the prevailing wind, one character for the source of the last tile leading to Mah Jong, one character for the declarations a player made.</para
1621
>These are the possible sources of the last tile: w=wall, d=discarded, e=dead end, z=last tile of living end, Z=last tile of living end, discarded, k=robbing the kong, 1=blessing of heaven/earth. The values w and d are special - they are sort of intermediate values. By choosing a concealed tile as last tile, the source is set to w. Next, several rules say that they apply only if the last tile comes from the wall. So this allows for a better preselection of actually applicable manual rules. For a better understanding, please look at the manual rules and read up about the <link linkend="actions"
1623
> &lastsource;.</para
1625
>These are the possible declarations: a=call at beginning, t=twofold fortune. </para
1633
>The part starting with L holds information about the last tile. It contains the last tile itself, followed by the meld that was completed with the last tile. We need this last meld for the rule "Last Tile is the Only Possible" because sometimes knowing only the last tile is not sufficient. Note that the last meld cannot be a Kong because if it completes a Kong you have to draw a replacement tile. </para
1638
>Calling Limit Hand</term>
1641
>This is not yet implemented but might be needed for rules like defined by the BMJA (in England). A part starting with K holds all possible tiles to be checked for if we give points for a calling limit hand. We could use brute force and check with every tile but that might take too much time. </para
1648
<sect1 id="actions">
1652
>All actions for a rule are defined in one string. They are separated by spaces. Some of them define a value. </para>
1659
>The player did something very nasty, so she must pay for all. Yet this is not a penalty since the sum of payments is the same - only the payer changes. Also, the two payers not involved do not exchange payments. </para
1667
>Defines how many payers this penalty rule implies. X is a number. </para
1675
>Defines how many payees this penalty rule implies. X is a number. </para
1683
>This action defines an absolute payment. The hand score is ignored. Used for penalty rules. </para
1688
>&lastsource;</term>
1691
>This action defines the source of the last tile. Used by manual rules like "last tile from dead end". Setting the last source with this action serves as a filter for other rules - if they trigger only for certain sources. Those other rules can of course also be manual rules. So this filtering will narrow down the amount of manual rules the user gets shown in the scoring dialog. If this seems complicated, just play around with the scoring dialog and watch check boxes appear and disappear depending on the source of the last tile. </para
1698
1471
<appendix id="problems"
1700
1473
>Відомі проблеми</title>