If you wish to play khan games in a text console window, or are designing
a khan game client yourself, you can download the command line engine
(listed above). The documentation for the engine, and the game in general,
follow:
Object of the game
In the era of the mongols (the 13th century AD), disparate tribes were
constantly at war with one other.
Khan is a chess-like board game (uci
compliant), with an original twist on warriors from the Ghengis Khan
era.
The goal of the game is to capture the leaders
of an enemy tribe and assimilate them before the enemy tribe assimilates
you.
Board setup and piece
movements
To play the command line engine version of the game, download the executable
(mac or windows), save it in a folder, then run it.
You will get the following board display:
Two tribes occupy either side of the board. White pieces denote one
tribe and are depicted in upper case (K A S N M W F). Black pieces denote
the opposing tribe, that are depicted in lower case (k a s n m w f).
The pieces, in increasing order of rank, are:
(S) SWORDSMAN, moves 1 square on diagonals.
(N) ASSASIN, moves up to two squares on the horizontal and vertical.
(A) ARCHER, moves 1 square in any direction.
(M) MAGICIAN, moves 1 square on horizontal and vertical. Can cast spells
on enemy pieces up to 2 squares, demoting them to lower-ranking pieces.
(W) WARRIOR (mounted bowman), moves 2 squares in any direction.
(F) BONDSMAN: mounted bowman having all the movements of the WARRIOR
with extended 3 square range on the horizontal and vertical. This is
the khan's right hand man (the first bondsman), and is the backup leader
of the tribe.
(K) KHAN, is the main leader of the tribe. He moves like a WARRIOR with
an extended 3 square range on the horizontal, vertical and diagonal.
To win, you must capture both the enemy Khan (k) and the Bondsman (f).
Here are some examples of the piece movements (taken from the basic game
configuration, with no magicians):
In the above diagram,
The white archer at square D2, can move to 5 positions (see red arrows).
The piece is blocked in the other directions by the white first bondsman
'F' at square E2 and the white archer 'A' at square D1.
The white swordsman at F2 can move to only square (see green).
The black bondsman at D7 can move to any # of squares (see rose).
The black khan at B7 can move to 5 possible squares (see blue arrows).
The other squares like B5 and B6 are blocked by surrounding pieces.
None of the warrior (W) pieces of either side can move because they
are blocked. (Note: pieces cannot move off the board)
Move summary:
If a piece is at position x, below, here are the
potential range of moves in the basic configuration:
where 'x' is:
Archer(A): [can move to blue squares]
Warrior (W): [can move to blue and green squares]
Bondsman(F): [blue + green + yellow]
Khan (K): [blue + green + yellow + red]
Magicians:
In a more advanced startup game configuration, we have magicians, pieces
which can move as follows:
If a magician (M) is at square 'x', then he can physically move to any
of the BLUE squares, provided they are UNOCCUPIED, or, he can cast spells
on enemies residing on any of the blue OR red squares. After casting his
spell he does not move from his position at 'X'.
Note: Magicians cannot capture enemy pieces. They can only 'demote' them
to the next lower rank.
For example, if an enemy Archer is at square B7, then the magician at
x can demote him to rank 'S' (SWORDSMAN).
This is equivalent to the magician fouling the archer's bow, or leaving
the Archer with only a sword to fight with.
Likewise, if an enemy Warrior (F, W or K) is at square D3, then the magician
can demote him to rank 'A', or ARCHER.
This is equivalent to the magician fouling the warrior's horse, or leaving
the Warrior stranded with only a bow to fight with.
Magician spells can be extended to the green squares by typing:
rules magicianextendeddemotionsqs 1
and another tier of squares beyond that by typing:
rules magicianextendeddemotionsqs 2
Similarly, for powermagicians (M+):
rules powermagicianextendeddemotionsqs [1/2]
Power magicians:
Power magicians are magicians that have extended mobility. Think of them
like magicians, but on a horse, so they can move like a warrior, but still
retain all the spell-casting abilities with range.
You can start a game of power magicians by typing:
new powermagician
A synopsis of piece movements
In the above board setup, the archer at B5 can capture the white warrior
at C5.
Likewise, the warrior at C5 can capture the archer, depending on whose
turn it is to move.
The white warrior cannot capture the black warrior at A6, because its
path is blocked by the pieces at B5 and B6.
Likewise, the black warrior at A6 cannot capture the white warrior at
C5 for the same reasons.
The same white warrior can capture the black magician at E5. The magician
cannot capture the white warrior because of his innate rule of not being
able to kill enemies, but he can demote the warrior to next lower rank
(an Archer), depending on whose turn it is to move.
The magician can also demote the assassin at G5 to a swordsman, casting
his xray spell through (F), the bondsman.
The magician can also demote the white enemy magician at E3 to a lower
ranking one (M-) that can only move one square on the horizontal and vertical,
thus severely limiting his spell-casting ability. If it were white's turn
to move, the magician at E3 could similarly cast a spell on E5 and demote
him to a lower ranking piece.
The Assassin at G5 (which has 2 squares mobility in horizontal or vertical
directions) cannot capture the magician at E5 because it is blocked by
F5 by F.
He can capture the archer at H5 and G7 though. He cannot attack the white
Khan at G2 because the Khan is outside his range, but the Khan at G2 can
capture him because he is within his attack range (3 squares on the horizontal,
vertical or diagonal).
The First bondsman at F5 can capture the black warrior at F8 because he
has 3 square range on the horizontal and vertical.
But the black warrior cannot capture F, which is out of range as warriors
have only a 2 square mobility.
The black swordsman at D4 can capture the magician at E3, but he cannot
capture mounted pieces like W at C5.
This is because a swordsman could never kill a mounted bowman in real
life. He would get ridden down or bowed down in short order.
Note: this rule can be changed, allowing swordsmen to capture mounted
pieces. Type:
rules swordscapturemounts
The game capturing logic proceeds like regular chess would: any piece
can take any other piece (except magician).
Making moves
To make a move, type
m f2e3 [hit enter]
This will move your WHITE swordsman at F2 towards the centre of the board
at E3:
If you made a mistake, then type undo. This restores the board.
(You can type redo to replay the move.)
Once you have made a move, you prompt the computer to make a move by typing:
g [enter]
You see:
That black moved his archer from A5 to A4.
(Note: the first few opening moves are randomized, so you may see a different
move other than this.)
Khan under threat
In the above diagram, WHITE has moved his warrior to E6 to attack the
BLACK khan at G7 (see red arrow threat).
The yellow arrows show the options for black who must move out of the
threat.
Options: Black's khan can move to any of the 3 squares (H6,H7,H8) denoted
in yellow, or black can capture the offending piece (k at G7 takes W at
E6) or (w at C8 takes W at E6). These moves are denoted as [kxe6] or [wxe6]
as listed in the legal moves below the board. The black khan cannot move
to any other squares because it will be threatened by the white warrior
at E6 or the white archer at G4. If the black khan tries to take the white
archer at G4, it will get killed by K at F3, W at G3 or W at H3.
How to win
In the above diagram the white warrior has moved to F6 and the black khan
has no more moves and no backup leader (f) and is under threat by the
WHITE warrior at F6 (see red arrow).
The game is over, white wins.
(Note: Black's escape routes are all defended by W at F6 and K at F4.
If the black khan tries to take the white warrior at F6, it will get taken
by the white archer at E6.)
Types of games
There are 3 core types of games: 'basic','magician'
or 'powermagician'
The default game is 'magician', where each side has a magician positioned
on the 2nd rank. The 'basic' game is one without magicians, which involves
somewhat easier play...
A more advanced game is available by selecting 'powermagician'. Each side
has a magician (M+), with extended mobility. The power magician has all
the power of the regular magician (M), but can move like a Warrior in
a 2 square range...of course, provided he doesn't demote anything while
moving.
To select this game, type:
new powermagician
In addition, there are 7 game rules, which function as options in conjunction
with the above 3 games. This allows custom play:
Type 'rules' to see the current game rules:
Current game rules:
===================
bondsmen leaders are: ON ..[bondsmenleaders/nobondsmenleaders]
Enemy base promotions are: ON ..[basepromotions/nobasepromotions]
capturepromotions are: OFF ..[capturepromotions/nocapturepromotions]
Exchanges moves are: ON ..[exchanges/noexchanges]
Swords capture mounts is: OFF ..[swordscapturemounts/noswordscapturemounts]
Magician demotes Khan is: ON ..[magiciandemoteskhan/nomagiciandemoteskhan]
# Magician extended demotions squares is: 0 ..[magicianextendeddemotionsqs
0-2]
# Power magician extended demotions squares is: 0 ..[powermagicianextendeddemotionsqs
0-2]
You can turn on or off any of these options by typing:
rules nocapturepromotions/capturepromotions swordscancapturemounts/noswordscancapturemounts
magiciandemoteskhan/nomagiciandemoteskhan ... or any of the keywords that
are listed
For example, entering the command:
rules nobondsmenleaders
turns off multiple leader play, then a player must only capture the enemy
Khan (K) to win the game.
Promotions, an advanced game feature, are described in the following section.
Swordscapturemounts is described in a prior section ('A synopsis of piece
movements').
Exchange moves are described in a following section.
Magiciandemoteskhan is described in the 'Demotions' section following.
Setting # of magician/power magician extended squares to anything other
than zero, extends the spell-casting range of a Magician or Power magician.
Ex:
rules powermagicianextendeddemotionsqs 2
grants the powermagician (M+) an extra 2 squares of spell-range casting,
making him a devastating opponent...
Type 'game' to see the current game configuration: ('basic','magician','powermagician')
Promotions
There are 2 types of promotions in khan, 'enemy
base promotions' and 'capture promotions'.
Enemy Base promotions
Throughout history, the mongols were always worried
about having their base camp discovered and pillaged by enemies.
For this reason, they would always leave behind a small force to guard
the camp, usually injured or older warriors and of course, their women
and children.
If a player manages to get a minor piece to the enemy camp (any of the
4 corner squares in enemy territory), then that piece is automatically
promoted to 'Warrior' status. Basically the piece gains a horse and/or
weapons necessary to elevate the piece to that rank. In real life, note
the mongols would always leave behind extra horses and weapons, the former
being their life blood. By default, enemy base promotions are turned on.
To disable the option, enter:
Upon reaching the enemy base, the Magician (M) can be promoted to a Power
magician (M+)
Archers (A), Swordsmen (S) and Assassins (N) can be promoted to Warrior
(W)
Khan archer (K-) can be promoted to Khan (K)
Khan sword (K--) can be promoted to Khan (K)
Note: Warriors and Bondsmen cannot be promoted, because they already have
weapons and horse...
Capture promotions
In real battles, a fighter will make use of any
enemy's resources the moment he defeats him.
For this reason if a Swordsman captures an Archer, he would get his bow
and become a bowman.
Likewise, if a swordsman or Archer captures a Warrior, then that fighter
would lay claim to his horse and become a mounted warrior.
Here are the logical combinations of promotions that occur after captures
are made:
Fighting piece
Captures
Promotes himself to
Sword
Archer
Archer
Sword
Warrior: (W/F/K)
Warrior
Assassin
Warrior: (W/F/K)
Warrior
Archer
Warrior: (W/F/K)
Warrior
Demotions
Likewise, demotions operate on the same principle,
but in reverse order, and are governed by magicians casting spells on
enemy pieces:
Fighting piece
Casts spell on
Demotes piece to
Magician (M/M-/M+)
Magician (M)
Lower order Magician (M-)
Magician (M/M-/M+)
Warrior: (W/F)
Archer (A)
Magician (M/M-/M+)
Khan (K)
*Horseless Khan(K-)
Magician (M/M-/M+)
Horseless Khan: (K-)
*Swordsman Khan(-K-)
*Provided the magiciandemoteskhan rule is set to on in rules section (the
default is on).
These rules make for more complex game analysis on part of the player,
but are more challenging to play. In particular, PROMOTIONS logic discourages
undefended attacks by higher order pieces(like W). Unsound trades (WxW)
result in devasting losses of material, when lower order pieces like the
archer promote themselves on the trade.
By default, PROMOTIONS are turned OFF and DEMOTIONS are in effect as long
as there are magician(s) on the board...
To clear the board of magicians, select the 'basic' game configuration
by typing:
new basic
Exchanges
If the Khan gets demoted by an enemy magician to a Khan archer (K-) or
Khan sword (-K-) piece, then that piece has the option of promoting himself
back to a Khan of higher rank by exchanging with an adjacent Warrior (W/F)
or Archer (A) piece respectively.
Of course, the Warrior or Archer gets demoted, and such is the price for
the exchange.
In long range strategy, it is almost always advantageous to promote the
Khan back to its highest value rank, which reduces the chance of an easy
capture by the enemy. You lose a warrior type piece, albeit, which may
be crucial in offense or defense, so there is a tradeoff.
Black, above, can exchange its Bondsman on B8 (see red arrow), or any
of the 3 surrounding warriors to 'give a horse' to its khan to get him
up to full strength again. The Warrior/Bondsman piece is demoted the Warrior
to an Archer.
Black types m b7b8 to accomplish this. Note that the
bondsman is not the best piece to exchange with k- because it has highest
value and will be demoted to an Archer, but there will be times when it
may be the only choice and the difference between losing the game and
drawing, or even winning.
In parallel, white could promote its magician on E2 to a power magician
(see green arrow) by employing a similar trick. White moves m
e2f1.
Now the power magician has the mobility of a mounted warrior while the
'exchanged' warrior at F1 has been reduced to an Archer.
On the next move, white could exchange its doubly demoted, sword-like
Khan (-K-) on G2 for a K- (archer-like khan) with archer mobility (m
b7b8) (see yellow arrow)
Only one Archer is within 1 square of the khan so there is only this possibity
of exchange.
As an aside: the demoted magician (m-) at D7 cannot be promoted to anything
greater. Its rank is fixed at this point, and is equivalent roughly to
a Sword.
If all 3 of the above described moves are made, the board looks like:
Exchange combinations
Here is a tally of the logical combinations of exchanges that can occur
for both the Khan and Magician:
Fighting piece
Exchanges with
Promotes himself to
Demotes the exchange piece to
Khan archer (K-)
Warrior: (W/F)
Khan (K)
Archer
Khan sword (-K-)
Archer
Khan archer (K-)
Sword
Magician (M)
Warrior: (W/F)
Power magician (M+)
Archer
To turn off these capabilities in the game, select:
rules noexchanges
to turn off exchange moves. By default, Exchange moves are on.
I'm stuck, I don't know
where to move
You can ask the computer to give you a hint by typing:
h [enter]
You see:
Hint >d2d3
The computer then is suggesting to move your WHITE archer from D2 to D3.
Saving and opening games
Type 'save mygame.txt' to save the current game to the current folder.
You can resume your game at a later time by typing:
open mygame.txt
If the program is installed in C:\Khan, for example, then all files will
be stored here. You can replay a game's moves by typing undo ('u') or
redo ('r') or 'start' (to move to the first move in the game) or 'start
x' (to move to a particular move).
Note: a backup file of the current game is stored in backup.txt in the
current directory after every move, so you can always restore to the last
game saved by typing:
open backup.txt
Replaying moves
Once moves have been made, or a game has been loaded,
you can page to any board position of any move. Type:
start (moves to the initial board position)
redo (replays the 1st move)
redo (replays the 2nd move)
undo (goes back to the 1st move)
end (moves to the last move)
start 3 (moves to the 3rd move board position)
showmoves (shows all the moves made so far)
The game is too hard or
too easy
To make Khan play stronger, increase the move time. Type 'g 8'. This will
allow the computer to move in 8 seconds versus the default search of 3
seconds. Higher search depth makes it harder to beat when deeper tactics
are explored. (A 3s search time is enough to challenge most casual players.)
You can also set the default move time by typing:
mt 8
Then when you type 'g', the computer moves in 8 seconds.
To make Khan play easier, you can select a particular skill level. Enter:
skill 1 [very easy]
skill 2 [ a little less easier]
skill 3 [ even less easier]
... up to
skill 12 [harder], etc
A skill level specification of x, searches for moves up to depth x, where
x is one "half" move, WHITE or BLACK.
If skill level is set to 4, the computer is searching 2 of its (black)
moves and 2 of its (white) opponent moves ahead... Strongest play is still
assured by setting the time control to an absolute setting, ie 'mt x'
or 'g x'. For example,
g 10
Tells the computer to search at maximum depth up to 10 seconds. On a fast
machine, this will be searching at least 6 full moves ahead (12 plies),
white or black.
Playing computer against
computer
Typing g [Enter]
when it is black or white's turn to move, will allow the computer to play
the roles of both black and white.
You can then watch the computer's style of play while learning the piece
movements.
Additionally, you can set specific move time or skill levels for black
or white via the 'mtb' (movetime black) or 'skillb' (skill level black)
commands:
mtb 2 (sets movetime for black to 2s)
mt 6 (sets movetime for white to 6s)
cc (signals computer on computer mode)
or
skillb 2 (sets skill level for black)
skill 4 (sets skill level for white)
cc
You can mix and match:
mt 3 (sets movetime for black to 2s)
skill 5 (sets skill level for white)
cc
Type 'cc off' to turn off the computer versus computer mode (saves memory).
Note: cc forces each side to search for moves in their own private memory
space.
This avoids one side capitalizing on the work done by the other.
The default console window size is generally too
small to play the game comfortably. The board keeps scrolling off the
screen. You can maximize the window by clicking the middle square on the
top right of the window, or you can increase the window height by right
mouse clicking on the window title bar and selecting "Defaults". You get:
Select the Layout tab and change height to 40:
You can optionally change the foreground/background color settings for
something softer to the eye. I like the blue background (red:130, green:163,
blue:253), with the "Screen text" color set to black:
Other functions, setting
up board positions, new game, etc
Type ? to see a list of commands:
Type 'd' to display the board at any time. This is useful if the board
has scrolled off the screen.
Setup a board position by entering 'sp' followed by a string that describes
the piece positions & the # spaces in between the pieces and who is to
move next.
For example, this string has 3 ranks populated with pieces, black and
white:
sp 1k4K/6W/3w/ black 5 1
Rank 8 has 2 Khans, separated by 4 spaces (1k4K)
Rank 7 has 1 White Warrior, 6 squares to the right (6W)
Rank 6 has 1 Black Warrior, 3 squares to the right (2w)
... the other ranks are not specified (ie empty)
... black is to move
... '5' describes the # of moves since no captures
... '1' describes the move #, in this case (no moves made)
Type 'msglevel 1' or 'msglevel 2' to show the computer's statistics while
searching for a move.
The default is 'msglevel 0', which suppresses output and displays only
the best move.
Have fun!
Disclaimer
This program is free software and shipped with no warranties.
Redistribution
This game is currently free. You can redistribute it as is, without
modification, without monetary renumeration.
The concept of Khan was inspired by ideas from Conn Iggulden's epic
saga, Wolf
of the Plains. My interest in game design over the past 20 years
has made this project possible.
Many thanks to the myriad chess programmers whose open source code and
ideas presented therein has facilited engine design, in particular,
praise for:
Winglet (Stef Luijten)
Stockfish (Tord Romstad, Marco
Costalba, Joona Kiiski) Arasan (Jon Dart) Crafty (Robert Hyatt) Fruit (Fabien Letouzey)