- 浏览: 135364 次
- 性别:
- 来自: 福建省莆田市
文章分类
最新评论
-
houruiming:
tks for your info which helps m ...
setcontent和setcontentobject用的是同一片内存 -
turingfellow:
in.tftpd -l -s /home/tmp -u ro ...
commands -
turingfellow:
LINUX下的网络设置 ifconfig ,routeLINU ...
commands -
turingfellow:
安装 linux loopbackyum install um ...
commands
<!--
<H3>The blackjack dealer controls the game.</H3>
The dealer registers itself at the DirectoryFacilitator
and waits for player agents to join the table.
-->
<agent xmlns="http://jadex.sourceforge.net/jadex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jadex.sourceforge.net/jadex
http://jadex.sourceforge.net/jadex-0.96.xsd"
name="Dealer"
package="jadex.examples.blackjack.dealer">
<imports>
<import>jadex.examples.blackjack.*</import>
<import>jadex.examples.blackjack.gui.*</import>
<import>jadex.runtime.*</import>
<import>jadex.planlib.*</import>
<import>jadex.util.*</import>
<import>jadex.adapter.fipa.*</import>
<import>java.util.logging.*</import>
<import>java.util.*</import>
</imports>
<capabilities>
<!-- this capability provides easy access to "out-of-the-box"-plans
allowing - for example - to register at the DF. -->
<capability name="dfcap" file="jadex.planlib.DF"/>
</capabilities>
<!--
These are the dealers beliefs. None of these beliefs should be edited in the ADF
because all beliefs are initialised by the plans during the game or have
expedient start-up values (like the three beliefs below).
-->
<beliefs>
<!-- The card set used to play the game. -->
<belief name="cardset" class="CardSet" />
<!-- The number of seconds to wait for answers from players. -->
<belief name="playerwaitmillis" class="long">
<fact>(Integer)$propertybase.getProperty("standard.timeout")</fact>
</belief>
<!-- The number of seconds to wait before drawing a card.
Can be adjusted in the GUI. -->
<belief name="stepdelay" class="int">
<fact>1</fact>
</belief>
<!-- When set to true, each step in the game must be manually
issued in the GUI. -->
<belief name="singleStepMode" class="boolean">
<fact>false</fact>
</belief>
<!-- The self representation of the dealer. -->
<belief name="myself" class="Dealer">
<fact>new Dealer()</fact>
</belief>
<!-- The players. -->
<beliefset name="players" class="Player"/>
<!-- The history of played games. -->
<belief name="statistics" class="GameStatistics">
<fact>new GameStatistics()</fact>
</belief>
<belief name="gamestate" class="GameState">
<fact>new GameState($beliefbase.myself, null)</fact>
</belief>
<belief name="gui" class="DealerFrame"/>
<!--
It's possible that a few different manager (possibly from remote Players)
want to track their players during the game, therefor a beliefset containing
all manager-AIDs is needed.
-->
<beliefset name="tracker" class="AgentIdentifier"/>
</beliefs>
<!--
The dealer has only one initial goal: registering a
dealing-service at the DF and renew this registration
every 10 seconds.
-->
<goals>
<!-- Main goal to play a game. -->
<performgoal name="play_game" exclude="never" retrydelay="3000">
<contextcondition>
$beliefbase.players.length > 0
</contextcondition>
</performgoal>
<!-- Goal to play with a single player (in the context of a larger game). -->
<performgoal name="play_with_player">
<parameter name="player" class="Player"/>
</performgoal>
<!-- Used for registering the dealer at the df. -->
<achievegoalref name="df_register">
<concrete ref="dfcap.df_register"/>
</achievegoalref>
<!-- Used for deregistering the dealer at the df. -->
<achievegoalref name="df_deregister">
<concrete ref="dfcap.df_deregister"/>
</achievegoalref>
</goals>
<!--
These are all the plans, the dealer will execute during a game.
There is one plan for every major task. Have a look into the
plan-classes to get a detailed insight in whats going on there.
-->
<plans>
<!-- Register a player. -->
<plan name="register_plan">
<body class="DealerRegisterPlayerPlan" />
<!-- <body>new DealerRegisterPlayerPlan()</body>-->
<trigger>
<messageevent ref="request_join" />
</trigger>
</plan>
<!-- Play a game. -->
<plan name="play_game_plan">
<body class="DealerGameRoundMasterPlan" />
<!-- <body>new DealerGameRoundMasterPlan()</body> -->
<trigger>
<goal ref="play_game"/>
</trigger>
</plan>
<!-- Play a game with a single player. -->
<plan name="play_with_player_plan">
<parameter name="player" class="Player">
<goalmapping ref="play_with_player.player"/>
</parameter>
<body class="DealerGameRoundPlayerPlan" />
<!-- <body>new DealerGameRoundPlayerPlan()</body>-->
<trigger>
<goal ref="play_with_player"/>
</trigger>
<!-- <contextcondition>
$beliefbase.getBeliefSet("players").containsFact($plan.player)
&& !$plan.player.getState().equals(Player.STATE_IDLE)
</contextcondition>-->
<contextcondition>
$beliefbase.getBeliefSet("players").containsFact($plan.player)
&& !$plan.player.getState().equals(Player.STATE_IDLE)
</contextcondition>
</plan>
<plan name="propagate_game_state_plan">
<body class="PropagateGameStatePlan" />
<!-- <body>new PropagateGameStatePlan()</body> -->
<trigger>
<beliefchange ref="myself"/>
<beliefsetchange ref="players"/>
</trigger>
<!-- not possible because game must always be updated. -->
<!--<precondition>$beliefbase.players.length>0</precondition>-->
</plan>
</plans>
<!-- events -->
<events>
<!-- Event to trigger a step. -->
<internalevent name="step"/>
<!-- player messages -->
<!-- Player request to join the game. -->
<messageevent name="request_join" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REQUEST</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>RequestJoin.class</value>
</parameter>
</messageevent>
<!-- A player wants to draw another card. -->
<messageevent name="request_draw" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REQUEST</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>RequestDraw.class</value>
</parameter>
</messageevent>
<!-- A player makes a bet. -->
<messageevent name="request_bet" direction="send" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REQUEST</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<!--<parameter name="reply-with" class="String" direction="inout">
<value>SFipa.createUniqueId($scope.getAgentName())</value>
</parameter>-->
<parameter name="conversation-id" class="String" direction="inout">
<value>SFipa.createUniqueId($scope.getAgentName())</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>RequestBet.class</value>
</parameter>
</messageevent>
<messageevent name="refuse_bet" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REFUSE</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>RequestBet.class</value>
</parameter>
</messageevent>
<!-- A player has finished its game (i.e. doesn't want to draw any more cards). -->
<messageevent name="request_finished" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REQUEST</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>RequestFinished.class</value>
</parameter>
</messageevent>
<!-- todo: manager messages -->
<!-- The manager is shutting down the BlackJack application. -->
<messageevent name="inform_shutdown" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.INFORM</value>
</parameter>
<parameter name="content-start" class="String" direction="fixed">
<value>"manager:shutDown"</value>
</parameter>
</messageevent>
<!-- The manager registers as tracker on game settings. -->
<messageevent name="query_tracking" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.QUERY_REF</value>
</parameter>
<parameter name="content-start" class="String" direction="fixed">
<value>"manager:registerAsTracker"</value>
</parameter>
</messageevent>
<!-- sent messages -->
<!-- inform a player about a the game result -->
<messageevent name="inform_action_done" direction="send_receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.INFORM</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>Done.class</value>
</parameter>
</messageevent>
<!-- inform a player about a the game result -->
<messageevent name="refuse_action" direction="send" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REFUSE</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
</messageevent>
<!-- inform tracker about playing players -->
<messageevent name="inform_tracker" direction="send" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.INFORM</value>
</parameter>
<parameter name="content" class="String" direction="in" />
</messageevent>
<messageevent name="inform_game_state" direction="send" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.INFORM</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="conversation-id" class="String" direction="inout">
<value>SFipa.createUniqueId($scope.getAgentName())</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>GameState.class</value>
</parameter>
</messageevent>
</events>
<expressions>
<!-- The player that gets the next card (if any). -->
<expression name="turnplayer">
select one Player $p from $beliefbase.players
where $p.getState().equals(Player.STATE_PLAYING)
order by $p.getCards().length
</expression>
<!-- Check if it is the dealer's turn. -->
<condition name="dealers_turn">
// The dealer may draw its initial card when all players have two cards.
$beliefbase.myself.getCards().length==0 &&
(select one Player $p from $beliefbase.players
where !$p.getState().equals(Player.STATE_IDLE) && $p.getCards().length!=2)
== null
// The dealer may draw more cards, when all players are either idle or finished.
|| (select one Player $p from $beliefbase.players
where !$p.getState().equals(Player.STATE_IDLE) && !$p.getState().equals(Player.STATE_FINISHED))
== null
</condition>
<!-- Check if it is the $player's turn. -->
<condition name="players_turn">
// All players must be idle, playing, or finished.
(select one Player $p from $beliefbase.players
where !$p.getState().equals(Player.STATE_IDLE)
&& !$p.getState().equals(Player.STATE_PLAYING)
&& !$p.getState().equals(Player.STATE_FINISHED))
== null
// And this player must be the first with the least number of cards.
// Hack !!! Assume "any" selects players in order.
&& (select one Player $p from $beliefbase.players
where $p.getState().equals(Player.STATE_PLAYING)
&& $p.getCards().length<=$player.getCards().length
order by $p.getCards().length)
== $player
<parameter name="$player" class="Player"/>
</condition>
<!-- Check if the dealer has drawn its first card. -->
<condition name="dealer_card">
$beliefbase.myself.getCards().length==1
</condition>
<!-- Check if the dealer has finished drawing cards. -->
<condition name="dealer_finished">
$beliefbase.myself.getState().equals(Player.STATE_FINISHED)
|| $beliefbase.myself.getState().equals(Player.STATE_IDLE)
</condition>
</expressions>
<properties>
<!-- logging-properties, needed to debug the application.
Start the Jadex-Logging-Agent to see whats going on behind the scenes -->
<!--<property name="logging.level">Level.INFO</property>-->
</properties>
<configurations>
<configuration name="default">
<beliefs>
<initialbelief ref="gui">
<fact>new DealerFrame($beliefbase.myself, $agent.getExternalAccess())</fact>
</initialbelief>
</beliefs>
<goals>
<!-- Register the dealer at the df on startup. -->
<initialgoal ref="df_register">
<!-- The services to register. -->
<parameter ref="description">
<value>
<!-- This is the agent-description for the dealer. With this description
the dealers is registered at the directory facilitator.
Note, that the dealer only offers one service, that is 'dealing'
(see service description below). -->
SFipa.createAgentDescription(null,
SFipa.createServiceDescription("dealing", "blackjack", "University of Hamburg"))
</value>
</parameter>
</initialgoal>
<initialgoal ref="play_game"/>
<endgoal ref="df_deregister"/>
</goals>
</configuration>
</configurations>
</agent>
<H3>The blackjack dealer controls the game.</H3>
The dealer registers itself at the DirectoryFacilitator
and waits for player agents to join the table.
-->
<agent xmlns="http://jadex.sourceforge.net/jadex"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jadex.sourceforge.net/jadex
http://jadex.sourceforge.net/jadex-0.96.xsd"
name="Dealer"
package="jadex.examples.blackjack.dealer">
<imports>
<import>jadex.examples.blackjack.*</import>
<import>jadex.examples.blackjack.gui.*</import>
<import>jadex.runtime.*</import>
<import>jadex.planlib.*</import>
<import>jadex.util.*</import>
<import>jadex.adapter.fipa.*</import>
<import>java.util.logging.*</import>
<import>java.util.*</import>
</imports>
<capabilities>
<!-- this capability provides easy access to "out-of-the-box"-plans
allowing - for example - to register at the DF. -->
<capability name="dfcap" file="jadex.planlib.DF"/>
</capabilities>
<!--
These are the dealers beliefs. None of these beliefs should be edited in the ADF
because all beliefs are initialised by the plans during the game or have
expedient start-up values (like the three beliefs below).
-->
<beliefs>
<!-- The card set used to play the game. -->
<belief name="cardset" class="CardSet" />
<!-- The number of seconds to wait for answers from players. -->
<belief name="playerwaitmillis" class="long">
<fact>(Integer)$propertybase.getProperty("standard.timeout")</fact>
</belief>
<!-- The number of seconds to wait before drawing a card.
Can be adjusted in the GUI. -->
<belief name="stepdelay" class="int">
<fact>1</fact>
</belief>
<!-- When set to true, each step in the game must be manually
issued in the GUI. -->
<belief name="singleStepMode" class="boolean">
<fact>false</fact>
</belief>
<!-- The self representation of the dealer. -->
<belief name="myself" class="Dealer">
<fact>new Dealer()</fact>
</belief>
<!-- The players. -->
<beliefset name="players" class="Player"/>
<!-- The history of played games. -->
<belief name="statistics" class="GameStatistics">
<fact>new GameStatistics()</fact>
</belief>
<belief name="gamestate" class="GameState">
<fact>new GameState($beliefbase.myself, null)</fact>
</belief>
<belief name="gui" class="DealerFrame"/>
<!--
It's possible that a few different manager (possibly from remote Players)
want to track their players during the game, therefor a beliefset containing
all manager-AIDs is needed.
-->
<beliefset name="tracker" class="AgentIdentifier"/>
</beliefs>
<!--
The dealer has only one initial goal: registering a
dealing-service at the DF and renew this registration
every 10 seconds.
-->
<goals>
<!-- Main goal to play a game. -->
<performgoal name="play_game" exclude="never" retrydelay="3000">
<contextcondition>
$beliefbase.players.length > 0
</contextcondition>
</performgoal>
<!-- Goal to play with a single player (in the context of a larger game). -->
<performgoal name="play_with_player">
<parameter name="player" class="Player"/>
</performgoal>
<!-- Used for registering the dealer at the df. -->
<achievegoalref name="df_register">
<concrete ref="dfcap.df_register"/>
</achievegoalref>
<!-- Used for deregistering the dealer at the df. -->
<achievegoalref name="df_deregister">
<concrete ref="dfcap.df_deregister"/>
</achievegoalref>
</goals>
<!--
These are all the plans, the dealer will execute during a game.
There is one plan for every major task. Have a look into the
plan-classes to get a detailed insight in whats going on there.
-->
<plans>
<!-- Register a player. -->
<plan name="register_plan">
<body class="DealerRegisterPlayerPlan" />
<!-- <body>new DealerRegisterPlayerPlan()</body>-->
<trigger>
<messageevent ref="request_join" />
</trigger>
</plan>
<!-- Play a game. -->
<plan name="play_game_plan">
<body class="DealerGameRoundMasterPlan" />
<!-- <body>new DealerGameRoundMasterPlan()</body> -->
<trigger>
<goal ref="play_game"/>
</trigger>
</plan>
<!-- Play a game with a single player. -->
<plan name="play_with_player_plan">
<parameter name="player" class="Player">
<goalmapping ref="play_with_player.player"/>
</parameter>
<body class="DealerGameRoundPlayerPlan" />
<!-- <body>new DealerGameRoundPlayerPlan()</body>-->
<trigger>
<goal ref="play_with_player"/>
</trigger>
<!-- <contextcondition>
$beliefbase.getBeliefSet("players").containsFact($plan.player)
&& !$plan.player.getState().equals(Player.STATE_IDLE)
</contextcondition>-->
<contextcondition>
$beliefbase.getBeliefSet("players").containsFact($plan.player)
&& !$plan.player.getState().equals(Player.STATE_IDLE)
</contextcondition>
</plan>
<plan name="propagate_game_state_plan">
<body class="PropagateGameStatePlan" />
<!-- <body>new PropagateGameStatePlan()</body> -->
<trigger>
<beliefchange ref="myself"/>
<beliefsetchange ref="players"/>
</trigger>
<!-- not possible because game must always be updated. -->
<!--<precondition>$beliefbase.players.length>0</precondition>-->
</plan>
</plans>
<!-- events -->
<events>
<!-- Event to trigger a step. -->
<internalevent name="step"/>
<!-- player messages -->
<!-- Player request to join the game. -->
<messageevent name="request_join" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REQUEST</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>RequestJoin.class</value>
</parameter>
</messageevent>
<!-- A player wants to draw another card. -->
<messageevent name="request_draw" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REQUEST</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>RequestDraw.class</value>
</parameter>
</messageevent>
<!-- A player makes a bet. -->
<messageevent name="request_bet" direction="send" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REQUEST</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<!--<parameter name="reply-with" class="String" direction="inout">
<value>SFipa.createUniqueId($scope.getAgentName())</value>
</parameter>-->
<parameter name="conversation-id" class="String" direction="inout">
<value>SFipa.createUniqueId($scope.getAgentName())</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>RequestBet.class</value>
</parameter>
</messageevent>
<messageevent name="refuse_bet" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REFUSE</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>RequestBet.class</value>
</parameter>
</messageevent>
<!-- A player has finished its game (i.e. doesn't want to draw any more cards). -->
<messageevent name="request_finished" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REQUEST</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>RequestFinished.class</value>
</parameter>
</messageevent>
<!-- todo: manager messages -->
<!-- The manager is shutting down the BlackJack application. -->
<messageevent name="inform_shutdown" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.INFORM</value>
</parameter>
<parameter name="content-start" class="String" direction="fixed">
<value>"manager:shutDown"</value>
</parameter>
</messageevent>
<!-- The manager registers as tracker on game settings. -->
<messageevent name="query_tracking" direction="receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.QUERY_REF</value>
</parameter>
<parameter name="content-start" class="String" direction="fixed">
<value>"manager:registerAsTracker"</value>
</parameter>
</messageevent>
<!-- sent messages -->
<!-- inform a player about a the game result -->
<messageevent name="inform_action_done" direction="send_receive" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.INFORM</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>Done.class</value>
</parameter>
</messageevent>
<!-- inform a player about a the game result -->
<messageevent name="refuse_action" direction="send" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.REFUSE</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
</messageevent>
<!-- inform tracker about playing players -->
<messageevent name="inform_tracker" direction="send" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.INFORM</value>
</parameter>
<parameter name="content" class="String" direction="in" />
</messageevent>
<messageevent name="inform_game_state" direction="send" type="fipa">
<parameter name="performative" class="String" direction="fixed">
<value>SFipa.INFORM</value>
</parameter>
<parameter name="language" class="String" direction="fixed">
<value>SFipa.NUGGETS_XML</value>
</parameter>
<parameter name="ontology" class="String" direction="fixed">
<value>BlackjackOntology.ONTOLOGY_NAME</value>
</parameter>
<parameter name="conversation-id" class="String" direction="inout">
<value>SFipa.createUniqueId($scope.getAgentName())</value>
</parameter>
<parameter name="content-class" class="Class" direction="fixed">
<value>GameState.class</value>
</parameter>
</messageevent>
</events>
<expressions>
<!-- The player that gets the next card (if any). -->
<expression name="turnplayer">
select one Player $p from $beliefbase.players
where $p.getState().equals(Player.STATE_PLAYING)
order by $p.getCards().length
</expression>
<!-- Check if it is the dealer's turn. -->
<condition name="dealers_turn">
// The dealer may draw its initial card when all players have two cards.
$beliefbase.myself.getCards().length==0 &&
(select one Player $p from $beliefbase.players
where !$p.getState().equals(Player.STATE_IDLE) && $p.getCards().length!=2)
== null
// The dealer may draw more cards, when all players are either idle or finished.
|| (select one Player $p from $beliefbase.players
where !$p.getState().equals(Player.STATE_IDLE) && !$p.getState().equals(Player.STATE_FINISHED))
== null
</condition>
<!-- Check if it is the $player's turn. -->
<condition name="players_turn">
// All players must be idle, playing, or finished.
(select one Player $p from $beliefbase.players
where !$p.getState().equals(Player.STATE_IDLE)
&& !$p.getState().equals(Player.STATE_PLAYING)
&& !$p.getState().equals(Player.STATE_FINISHED))
== null
// And this player must be the first with the least number of cards.
// Hack !!! Assume "any" selects players in order.
&& (select one Player $p from $beliefbase.players
where $p.getState().equals(Player.STATE_PLAYING)
&& $p.getCards().length<=$player.getCards().length
order by $p.getCards().length)
== $player
<parameter name="$player" class="Player"/>
</condition>
<!-- Check if the dealer has drawn its first card. -->
<condition name="dealer_card">
$beliefbase.myself.getCards().length==1
</condition>
<!-- Check if the dealer has finished drawing cards. -->
<condition name="dealer_finished">
$beliefbase.myself.getState().equals(Player.STATE_FINISHED)
|| $beliefbase.myself.getState().equals(Player.STATE_IDLE)
</condition>
</expressions>
<properties>
<!-- logging-properties, needed to debug the application.
Start the Jadex-Logging-Agent to see whats going on behind the scenes -->
<!--<property name="logging.level">Level.INFO</property>-->
</properties>
<configurations>
<configuration name="default">
<beliefs>
<initialbelief ref="gui">
<fact>new DealerFrame($beliefbase.myself, $agent.getExternalAccess())</fact>
</initialbelief>
</beliefs>
<goals>
<!-- Register the dealer at the df on startup. -->
<initialgoal ref="df_register">
<!-- The services to register. -->
<parameter ref="description">
<value>
<!-- This is the agent-description for the dealer. With this description
the dealers is registered at the directory facilitator.
Note, that the dealer only offers one service, that is 'dealing'
(see service description below). -->
SFipa.createAgentDescription(null,
SFipa.createServiceDescription("dealing", "blackjack", "University of Hamburg"))
</value>
</parameter>
</initialgoal>
<initialgoal ref="play_game"/>
<endgoal ref="df_deregister"/>
</goals>
</configuration>
</configurations>
</agent>
发表评论
-
protocols
2011-04-03 19:22 925<!-- The protocols capabilit ... -
dfcap
2011-04-03 19:15 878<!-- The df capability has a ... -
booktrading /seller
2011-03-29 23:19 930<html><head><tit ... -
booktrading / manager
2011-03-29 23:18 1094<html><head><tit ... -
booktrading / common
2011-03-29 23:17 989<html><head><tit ... -
booktrading / buyer
2011-03-29 23:13 848<!-- <H3>The buyer age ... -
tomcat的context说明书
2011-03-20 17:39 805http://tomcat.apache.org/tomcat ... -
msyql的select语法
2010-09-13 22:52 107613.2.7. SELECT语法 13.2.7.1. ... -
zotero与word集成
2010-09-11 08:50 1768Manually Installing the Zotero ... -
university 2/n
2010-08-24 07:54 899Chapter 1.Introduction of regis ... -
university 1/n
2010-08-24 07:53 942chapter? Introduction ?.?The st ... -
Sun Java Bugs that affect lucene
2010-08-23 08:59 737Sometimes Lucene runs amok of b ... -
Snowball分词
2010-08-22 13:07 1226using System; using Lucene.Net. ... -
penn tree bank 6/6
2010-08-20 07:09 91911 This use of 12 Contact the - ... -
penn tree bank 5/n
2010-08-19 07:40 923always errs on the side of caut ... -
penn tree bank 4/n
2010-08-19 07:39 8194. Bracketing 4.1 Basic Methodo ... -
penn tree bank 3/n
2010-08-15 23:31 8212.3.1 Automated Stage. During t ... -
penn tree bank 2/n
2010-08-15 23:30 1505Mitchell P Marcus et al. Buildi ... -
capabilities 3/3
2010-08-11 22:58 78101<capability xmlns="ht ... -
capabilities 2/3
2010-08-11 22:57 742Fig.3.Element creation cases:a) ...
相关推荐
问题1: ERROR – file: storage_ip_changed_dealer.c, line: 163, connect to tracker server xx.xx.xx.xx:22122 fail, errno: 4, error info: Interrupted system call 或ERROR – file: storage_ip_changed_...
《iLabelChina(Dealer)——打造专业电子秤标签设计与打印解决方案》 iLabelChina(Dealer)是一款专为经销商设计的电子秤标签格式设置软件,它集成了丰富的模板和强大的编辑功能,旨在帮助用户轻松创建符合业务需求的...
将创建myproxy/dealer.wsdl和myproxy/dealer.wsdl.go 。 2.生成客户端代码 使用 : protoc --grpcer_out=myproxy -I $GOPATH/src $GOPATH/src/unosoft.hu/ws/bruno/pb/dealer/dealer.proto 将创建myproxy/dealer....
dealer.connect("tcp://localhost:5555"); // 发送消息 for (int i = 0; i ; i++) { dealer.sendMore("Task"); // 额外的前缀,用于标识消息类型 dealer.send(String.valueOf(i)); } context.close(); ...
《FastDFS Storage端配置文件详解及启动注意事项》 FastDFS是一款开源的高性能、轻量级的分布式文件系统,主要用于解决大容量存储和负载均衡的问题。本文将深入解析FastDFS的Storage端配置文件`storage.conf`,并...
git官网版,供无法用git下载的使用,liunx使用。 FastDFS(Fast Distributed File System)是一个开源的轻量级分布式文件系统,主要用于文件存储和访问。它以高性能和高可靠性为目标,特别适用于一些需要大规模文件...
据此可以推测,“dealer.info”文件很可能包含有关编号12864的经销商详细资料,诸如联系信息、服务条款、产品目录、系统要求,以及与该经销商相关的业务操作说明等。 综合以上信息,虽然无法从描述中直接获取具体的...
以下是`Dealer.java`和`Monitor.java`的简要示例: **Dealer.java** ```java package com.vstsoft.dataimport.dto; public class Dealer { // 属性与方法... } ``` **Monitor.java** ```java package ...
施乐DocuPrint P M105、M205b、M158ab、M158b、M158f、P105b、P158b、P205b系列打印机是施乐公司生产的一系列产品,该系列设备以其高效率和多功能性而闻名。从提供的文件内容中,我们可以了解到这些设备的维护和修理...
Ø Smart patterns like pub-sub, push-pull, and router-dealer. Ø High-speed asynchronous I/O engines, in a tiny library. Ø Backed by a large and active open source community. Ø ...
车行:dealer.html 车商:带shop_ V2018.1.1 此版是根据网上某二手车修改而成,已经原版修正很多错误,增加了新车等栏目.并增加安全性,请放心使用. 官方: 大泉州汽车网:http://www.xqzqc.com/ 南安汽车网:...
【标题】"毕博咨询报告-Driving Change in the dealer IT Enviorment.zip" 提供的是一份关于汽车经销商IT环境变革的专业报告。这份报告聚焦于如何推动汽车销售行业的经销商在信息技术(IT)环境中进行有效变革,以...
your local Trimble dealer. Bluetooth and 900 MHz radio-modems operate in license-free bands. Before operating an SPSx81 Smart GPS antenna, determine if authorization or a license to operate the unit ...
Ø Smart patterns like pub-sub, push-pull, and router-dealer. Ø High-speed asynchronous I/O engines, in a tiny library. Ø Backed by a large and active open source community. Ø ...
`Dealer`类的实例可以通过`bean`转换器自动映射到JavaScript对象,而`Monitor`类的方法如`setDealers`和`setDealersMap`允许接收`List<Dealer>`和`Map, Dealer>`类型的参数。 接下来,让我们看看具体的Java类。`...
console.log(`${this.dealer.name}'s hand: ${this.dealer.hand.map(card => `${card.value}${card.suit}`).join(', ')} (${this.dealer.score})`); if (this.dealer.score > 21) { console.log(`${this.dealer....
dealer.Hand.Add(deck.Draw()); } } // 省略WantsToHit方法和显示结果的代码 } ``` 至此,我们已经构建了一个基本的21点游戏框架。玩家可以通过选择是否要牌来控制其手牌的点数,直到达到满意的结果或超过21点...