<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta />
    <article-meta>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>a strategy</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>turn-based</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>multiplayer game</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>instead</string-name>
        </contrib>
        <contrib contrib-type="author">
          <string-name>like Java</string-name>
        </contrib>
      </contrib-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>We propose three dierent A.I. di ulty levels: easy, medium and hard. The</title>
      <p>the game. We hoose to guide the A.I. through some well-known ases in ea h
Our rst implementation is a Java model apt to represent the game board and
predi ates. Ea h skill that distinguish medium and hard di ulty is mapped
interpreter into our Java appli ation be ause it respe ts the ISO standards.
into Prolog predi ates. We use GNU Prolog for Java to embed the Prolog
easy level performs random a tions. Instead the hard level will be an extension
of the medium level that is an intelligent implementation of the same Prolog
We assume that the aim is to onquer 24 territories to simplify the study of
all the informations that it ontains (territory borders, neighborhood relations,
stru ture paying attention on data onsisten y with the Java model.
phase of the player’s turn.
ontinents, territory ownership, . . . ). We also dene the Prolog knowledge-base</p>
    </sec>
    <sec id="sec-2">
      <title>4 Methodology</title>
      <p>3 Related works
2 The game of Risk!
behavior seems to be neither too smart nor naive and this an tire out the human
Risk Digital of Hasbro but there are a lot of Risk! lones like Lux for Linux,
issues or in games where the arti ial player’s behavior is stri tly onne ted with
a dierent and more suitable way in order to improve the game-play.
logi al des ription like Risk!.
player.
This approa h an be used in games whi h present randomness and multiplayer
Some of those implementations present ustomizable arti ial players but their
Our approa h, besides fo using on e ien y, hallenges the logi al aspe t in
Nowadays there are several implementations of Risk!. The most famous is
Dominion for mobile phones or other ash games an be found over the Internet.</p>
    </sec>
    <sec id="sec-3">
      <title>In ea h turn there are three phases: pla ing armies, atta king, fortifying. In the</title>
      <p>the player atta k a nearby enemy territory, the su ess or fail of an atta k is
politi al map of the Earth that ontains 42 territories distributed in 6 ontinents.
themselves until a player rea hes his goal.
Risk! is a turn-based strategi board game for two to six players in whi h the
There are several goals but in our appli ation, for simpli ity and for a general
rst phase the player puts new armies into the owned territories. In the se ond
goal is indi ated by an obje tive ard. The game is played on a board depi ting a
At the start-up ea h player distributes a xed number of armies on the board.
purpose, we onsider only the aim to own 24 territories.
de ided by the throw of di es. In the third phase the player an move some
armies between two owned nearby territories only on e. The phases will repeat
owner ( j a u z i a , r e d ) .
owner ( i t a , g r e e n ) .
owner ( s i b e r i a , r e d ) .
the territory’s ownership;
the number of armies a territory holds;
a relation of neighborhood between territories;
p l a y e r ( r e d ) .
p l a y e r ( g r e e n ) .
The Risk! Map an be onsidered as a set of ountries (territories). For ea h
territory we dene:
army ( j a u z i a , 4 ) .
army ( s i b e r i a , 3 ) .
army ( i t a , 2 ) .
army/2 represents the army number for ea h territory.
player.
territory/1 represents a territory, identied by his name.
owner/2 represents the ownership of a territory identied by the denoted
neighbor/2 represents the relation of the neighborhood between two territories.
bla k, yellow).
represents a player, identied by his olor (blue, red, green, pink,
t e r r i t o r y ( j a u z i a ) .
t e r r i t o r y ( i t a ) .
t e r r i t o r y ( s i b e r i a ) .
n e i g h b o r ( j a u z i a , i t a ) .
n e i g h b o r ( s i b e r i a , i t a ) .
n e i g h b o r ( j a u z i a , s i b e r i a ) .
n e i g h b o r ( i t a , s i b e r i a ) .
n e i g h b o r ( s i b e r i a , j a u z i a ) .
n e i g h b o r ( i t a , j a u z i a ) .
win an atta k. Inside the Knowledge Base in Prolog we represent this information
with vi tory/3 :
is be ause we’d have to insert two randomness level (atta k and defense di es)
Be ause of randomness omponent of the game, exploring a de isional tree to
Therefore we de ide to represent the randomness omponents using a table
level.
into the de ision tree in reasing exponentially the number of the nodes in that
that ontains, given the numer of atta ker and defender army, the probability to
hoose whi h territory to atta k, ould lead to a general low-responsivity. This</p>
    </sec>
    <sec id="sec-4">
      <title>2 // Loading t h e knowledge base f i l e and A. I . implementation</title>
      <p>3 env . ensureLoaded (AtomTerm . g e t ( " knowledge . p l " ) ) ;
1 Environment env = new Environment ( ) ;
4 env . ensureLoaded (AtomTerm . g e t ( " easy . p l " ) ) ;
5 i n t e r p r e t e r = env . r e a t e I n t e r p r e t e r ( ) ;
6 env . r u n I n i t i a l i z a t i o n ( i n t e r p r e t e r ) ;
6 }
2 for ( Continent o n t i n e n t : o n t i n e n t s )
5
3 {
1 P r o l o g V i s i t o r v i s i t o r = new P r o l o g V i s i t o r ( ) ;
4</p>
    </sec>
    <sec id="sec-5">
      <title>Otherwise the CPL solution would require a ne tuning of the obje tive fun tion</title>
      <p>dierent A.I. logi s (and approa hes) leaving the ore appli ation un hanged.
for ea h di ulty in order to meet the optimal value for ea h A.I. level. This
solution for these kinds of problems. By using Prolog it is easier to swit h between
Our implementation grants a good level of playing for every kind of player.
will produ e an unnatural playing style. The Prolog interpreter is an optimal
depending on the player’s di ulty level.
A.I. di ulty level, ght ea h-other. Otherwise, if there is at least one player
with a dierent di ulty level, then the spe i onditions are not so evident,
sometimes the A.I. rea hes a deadlo k situation where no one either atta ks or
some spe i Prolog onditions.
to the evaluation of dierent variables. This evaluation is either rough or rened
After thit we again tested the system by letting two players, with the same
an obje tive fun tion that will either be minimized or maximized, depending on
as a Constraint Linear Programming problem in whi h every de ision is driven by
so the Turing test is passed.
To over ome these problems a ner solution ould be to represent the model
the a tion that the player has performed. The obje tive fun tion varies a ording
moves armies between the territories. To break the deadlo k we need to hard ode</p>
    </sec>
  </body>
  <back>
    <ref-list />
  </back>
</article>