Author: simplet
Date: 2008-12-15 13:07:13 +0100 (Mon, 15 Dec 2008)
New Revision: 3131

Added:
   software_suite_v2/software/scripts/magic8ball/
   software_suite_v2/software/scripts/magic8ball/magic8ball.py
Log:
* First version. English only :)


Added: software_suite_v2/software/scripts/magic8ball/magic8ball.py
===================================================================
--- software_suite_v2/software/scripts/magic8ball/magic8ball.py                 
        (rev 0)
+++ software_suite_v2/software/scripts/magic8ball/magic8ball.py 2008-12-15 
12:07:13 UTC (rev 3131)
@@ -0,0 +1,64 @@
+#!/usr/bin/env python
+# -*- coding: latin1 -*-
+
+"""
+======================================================================
+
+  Magic 8 Ball  
+
+  Simplet <simplet _at_ ptigeek _dot_ net>
+
+
+  This script emulate the magic 8 ball.
+  
+======================================================================
+"""
+
+__author__  = 'Simplet <simplet _at_ ptigeek _dot_ net>'
+__appname__ = 'Magic 8 Ball script'
+__version__ = '0.0.1'
+__date__    = '2008/12/15'
+__license__ = 'GPL'
+
+
+import random
+from tuxisalive.api import *
+
+
+tux = TuxAPI('127.0.0.1', 270)
+tux.server.autoConnect(CLIENT_LEVEL_RESTRICTED, 'Magic8Ball', 'NONE')
+tux.server.waitConnected(10.0)
+tux.dongle.waitConnected(10.0)
+tux.radio.waitConnected(10.0)
+if tux.access.waitAcquire(10.0, ACCESS_PRIORITY_NORMAL):
+
+  answer = random.sample(["As I see it, yes",
+  "Ask again later",
+  "Better not tell you now",
+  "Cannot predict now",
+  "Concentrate and ask again",
+  "Don't count on it",
+  "It is certain",
+  "It is decidedly so",
+  "Most likely",
+  "My reply is no",
+  "My sources say no",
+  "Outlook good",
+  "Outlook not so good",
+  "Reply hazy, try again",
+  "Signs point to yes",
+  "Very doubtful",
+  "Without a doubt",
+  "Yes",
+  "Yes, definitely",
+  "You may rely on it"], 1)
+  
+  answer = "".join(answer)
+
+  tux.mouth.open()
+  tux.tts.speak(answer, "Ryan", 100)
+  tux.mouth.close()
+
+tux.access.release() 
+tux.server.disconnect()
+tux.destroy()


Property changes on: software_suite_v2/software/scripts/magic8ball/magic8ball.py
___________________________________________________________________
Name: svn:executable
   + *


------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Tux-droid-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tux-droid-svn

Reply via email to