Remote agent/Agent logic: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
(→‎{{header|Wren}}: Oops, posted wrong code to this part of the task.)
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(One intermediate revision by one other user not shown)
Line 9:
 
=={{header|Go}}==
<langsyntaxhighlight lang="go">package agent
 
import (
Line 175:
agentBall = noColor
return
}</langsyntaxhighlight>
 
 
Line 188:
mismatches second. Empty sectors are shown in blue, sectors with a matching ball are shown in green, and
sectors with a mismatching ball are shown in red.
<langsyntaxhighlight lang="perl">#!/usr/bin/perl
 
use strict; # https://rosettacode.org/wiki/Remote_agent
Line 410:
(time - $start) / $turns * 1e6;
 
</syntaxhighlight>
</lang>
 
=={{header|Phix}}==
<!--<langsyntaxhighlight Phixlang="phix">(noonline)-->
<span style="color: #000080;font-style:italic;">--
-- demo\rosetta\Remote_Agent_Agent_Logic.exw
Line 679:
<span style="color: #000000;">register_agent</span><span style="color: #0000FF;">(</span><span style="color: #000000;">get_command</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">accept_event</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">get_agent</span><span style="color: #0000FF;">)</span>
<!--</langsyntaxhighlight>-->
For example output see [[Remote_agent/Simulation#Phix]]
 
Line 688:
Sample agent (''not'' a good or smart player of the game; just to show how to program to the interface).
{{works with|Tcl|8.6}}
<langsyntaxhighlight lang="tcl">package require Tcl 8.6
package require RC::RemoteAgent
 
Line 744:
 
Agent new "localhost" 12345
vwait wonGame</langsyntaxhighlight>
 
=={{header|Wren}}==
{{trans|Go}}
{{libheader|Wren-str}}
<langsyntaxhighlight ecmascriptlang="wren">/* agent.wren */
 
import "random" for Random
Line 891:
gameOver = drop.call()
}
}</langsyntaxhighlight>
9,482

edits