Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
47
Task/Magic-8-ball/CFEngine/magic-8-ball.cfengine
Normal file
47
Task/Magic-8-ball/CFEngine/magic-8-ball.cfengine
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#!/var/cfengine/bin/cf-agent --no-lock
|
||||
bundle agent __main__
|
||||
{
|
||||
methods: "rosettacode_org:magic_8_ball";
|
||||
}
|
||||
body file control
|
||||
{
|
||||
namespace => "rosettacode_org";
|
||||
}
|
||||
bundle agent magic_8_ball
|
||||
{
|
||||
vars:
|
||||
"_responses"
|
||||
slist => {
|
||||
"It is certain", "It is decidedly so", "Without a doubt",
|
||||
"Yes definitely", "You may rely on it", "As I see it yes",
|
||||
"Most likely", "Outlook good", "Signs point to yes", "Yes",
|
||||
"Reply hazy try again", "Ask again later",
|
||||
"Better not tell you now", "Cannot predict now",
|
||||
"Concentrate and ask again", "Don't bet on it",
|
||||
"My reply is no", "My sources say no", "Outlook not so good",
|
||||
"Very doubtful",
|
||||
};
|
||||
"_selected_response"
|
||||
int => randomint( 0, length( _responses) ),
|
||||
unless => isvariable( "$(this.namespace):$(this.promiser)" );
|
||||
|
||||
"_consideration_time"
|
||||
int => randomint( 3, 5),
|
||||
unless => isvariable( "$(this.namespace):$(this.promiser)" );
|
||||
|
||||
commands:
|
||||
"/bin/sleep $(_consideration_time)"
|
||||
inform => "false",
|
||||
handle => "consider",
|
||||
depends_on => { "think" },
|
||||
comment => "This magic 8 ball takes a few seconds to consider the answer
|
||||
after you bring your question to mind.";
|
||||
|
||||
reports:
|
||||
"Think about your question ..."
|
||||
handle => "think";
|
||||
|
||||
"Response: $(with)"
|
||||
with => nth( _responses, $(_selected_response) ),
|
||||
depends_on => { "consider" };
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue