Ejemplo n.º 1
0
def Read():
    try:
        with con:
            cur.execute("SELECT * FROM SPILLER ORDER BY SCORE DESC") # Indholdet hentes
            rows=cur.fetchall() # resultatet gemmes i variablen rows
            for row in rows:
                Console.WriteLine(row)
    except:
        Console.WriteLine("Failed to get highscores from database")
Ejemplo n.º 2
0
def Attack(self):
    if (self._windup):
        Console.WriteLine("You swing your {0} and deal {1} damage", self._name,
                          self._damage)
        self._windup = False
        return self._damage
    else:
        self._windup = True
        Console.WriteLine("You ready your {0}", self._name)
        return 0
Ejemplo n.º 3
0
def CDREventArrived(sender, e):
    ##Get the Event object and display it
    pd = e.NewEvent.Properties["TargetInstance"]
    mbo = pd.Value
    if (mbo.Properties["VolumeName"].Value is not None):
        titleRetriever = TitleRetriever(mbo.Properties["DeviceID"].Value[0:1])
        movieName = titleRetriever.getMovieName()
        Console.WriteLine("Found: "+movieName)
        notifier.showBalloon("Begining Archive",movieName)

        mkvFile = ripper.rip(titleRetriever.driveLetter, movieName)
        ripper.transcode(mkvFile, movieName)
    else:
        notifier.showBalloon("Disk Ejected")
        Console.WriteLine("CD has been ejected")
Ejemplo n.º 4
0
def Attack(self):
    if self._windup == False:
        self._windup = True
        Console.WriteLine("The enemy attacks for {0} damage", self._damage)
        return self._damage
    else:
        print("The enemy is winding up!")
        self._windup = False
        return 0
Ejemplo n.º 5
0
def Block(self, damage):

    Console.WriteLine(
        "You defend yourself with your {0}, it blocks {1} damage", self._name,
        self._block)

    if (self._block < damage):
        return damage - self._block
    else:
        return 0
Ejemplo n.º 6
0
    def _bp_add(self, keyinfo):
        try:
            args = Console.ReadLine().Trim().split(':')
            if len(args) != 2: raise Exception, "Only pass two arguments"
            linenum = int(args[1])

            for assm in self.active_appdomain.Assemblies:
                for mod in assm.Modules:
                    bp = create_breakpoint(mod, args[0], linenum)
                    if bp != None:
                        self.breakpoints.append(bp)
                        bp.Activate(True)
                        Console.WriteLine("Breakpoint set")
                        return False
            raise Exception, "Couldn't find %s:%d" % (args[0], linenum)

        except Exception, msg:
            with CC.Red:
                print "Add breakpoint failed", msg
Ejemplo n.º 7
0
    def _print_source_line(self, sp, lines):
        linecount = len(lines)
        linecount_fmt = "%%%dd: " % len(str(linecount))

        for i in range(sp.start_line, sp.end_line + 1):
            with CC.Cyan:
                Console.Write(linecount_fmt % i)
            line = lines[i - 1] if i <= linecount else ""
            start = sp.start_col if i == sp.start_line else 1
            end = sp.end_col if i == sp.end_line else len(line) + 1

            with CC.Gray:
                Console.Write(line.Substring(0, start - 1))
                with CC.Yellow:
                    Console.Write(line.Substring(start - 1, end - start))
                Console.Write(line.Substring(end - 1))

            if sp.start_line == sp.end_line == i and sp.start_col == sp.end_col:
                with CC.Yellow:
                    Console.Write(" ^^^")
            Console.WriteLine()
Ejemplo n.º 8
0
print "Enter expressions.  Enter blank line to abort input."
print "Enter 'exit (the symbol) to exit."
print "\n"
while True:
    print prompt,
    input = Console.ReadLine()
    if (input == ""):
        exprstr = ""
        prompt = ">>> "
        continue
    else:
        exprstr = exprstr + " " + input
    ## See if we have complete input.
    try:
        sympl.parser.ParseExpr(StringReader(exprstr))
    except Exception, e:
        prompt = "... "
        continue
    ## We do, so execute.
    try:
        res = s.ExecuteExpr(exprstr, feo)
        exprstr = ""
        prompt = ">>> "
        if res is s.MakeSymbol("exit"): break
        print res
    except Exception, e:
        exprstr = ""
        prompt = ">>> "
        Console.Write("ERROR: ")
        Console.WriteLine(e)
Ejemplo n.º 9
0
    cur = con.cursor()

    cur.execute("Select * from Player")
    rows = cur.fetchall()
    print ""
    i = 0  #Number of rows
    for row in rows:
        print "Save ID", row[0]
        print "Save Name", row[1]
        print "Save Money", row[2]
        print ""
        i += 1

    while True:
        Console.WriteLine("Select a save file (Write the ID number)")
        playerinput = Console.ReadLine()
        try:
            if int(playerinput) < i + 1 and int(playerinput) > 0:
                break
            else:
                print "Please enter something valid"
        except ValueError:
            print "Please enter something valid"

    with con:
        cur.execute("Select * from Player where Id = " + playerinput)
    playersave = cur.fetchall()
    for row in playersave:
        playerId = row[0]
        playerName = row[1]
Ejemplo n.º 10
0
import sqlite3 as lite
import sys
from System import Console

con = None

Console.WriteLine("Saving...")


def Update(id, money):
    try:
        con = lite.connect('Users.db')
        cur = con.cursor()

        with con:
            cur.execute("UPDATE Player SET Money = " + money + " WHERE Id = " +
                        id)

    except lite.Error, e:
        print "Error %s:" % e.args[0]
        sys.exit(1)

    finally:
        if con:
            con.close()
Ejemplo n.º 11
0
Archivo: AI.py Proyecto: ekolis/FrEee
import FrEee
import FrEee.Utility
from FrEee.Game.Objects.Commands import *
clr.ImportExtensions(FrEee.Utility.Extensions)
from System import Console

# alias the domain and context variables to avoid confusion
empire = domain
galaxy = context

# TODO - Design Managment ministers
# TODO - Colony Management ministers
if (enabledMinisters.ContainsKey("Empire Management")):
    category = enabledMinisters["Empire Management"]
    if (category.Contains("Research")):
        # choose what to research
        # TODO - actually choose sensibly, don't always research Propulsion
        cmd = ResearchCommand()
        cmd.Spending[Mod.Current.Technologies.FindByName("Propulsion")] = 100
        empire.ResearchCommand = cmd
    # TODO - check for more ministers and execute their code
# TODO - Vehicle Managment ministers

# test AI data storage
if (not empire.AINotes.HasProperty("Log")):
    empire.AINotes.Log = []
empire.AINotes.Log.Add("{0} has played its turn for stardate {1}.\n".format(
    empire.Name, galaxy.Stardate))
for msg in empire.AINotes.Log:
    Console.WriteLine(msg)
Ejemplo n.º 12
0
# -*- coding: utf-8 -*-

# clrをインポートして、System.Windows.Forms.dllを参照に追加
import clr
clr.AddReferenceByPartialName("System.Windows.Forms")

# System.Windows.Forms名前空間からMessageBoxクラスをインポートして
# そのMessageBoxクラスを使ってメッセージ・ボックスを表示
from System.Windows.Forms import MessageBox
MessageBox.Show("Hello IronPython!", "Insider.NET") 

from System import Console
Console.WriteLine(u"あいうえお(Console版)")

'''
How to run

1. Download IronPython-2.7.7-win.zip
1. Extract zip
1. Set full path of extracted(installed) folder into PATH environment variable.
1. Type following command in terminal.
    ipy hello_ironpython.py
'''
Ejemplo n.º 13
0
def Ability(self):
    Console.WriteLine("Your {0} heals you and you gain gain {1} health",
                      self._name, self._heal)
    return self._heal
Ejemplo n.º 14
0
 def testFail(self):
     Console.WriteLine("--testFail--")
     Assert.IsTrue(False, "this will fail")
Ejemplo n.º 15
0
import clr
from System import Console

Console.WriteLine("Hello My World!")
Ejemplo n.º 16
0
def Add(name,score,time):
    try:
        with con:       
            cur.execute("INSERT INTO SPILLER (Id,name,score,time) VALUES(NULL,?,?,?)",(name,score,time))
    except:
        Console.WriteLine("Failed to add player to the highscore database")
Ejemplo n.º 17
0
def Attack(self):
    Console.WriteLine("You swing your {0} and deal {1} damage", self._name,
                      self._damage)
    return self._damage
Ejemplo n.º 18
0
"""


>>> import clr
..> clr.AddReference("System.Windows.Forms")
..> from System.Windows.Forms import MessageBox
..> MessageBox.Show("Hello World")
..> END



import clr
clr.AddReference("System")
from System import Console, ConsoleColor
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Red.");
Console.WriteLine("Another line."); # <-- This line is still white on blue.
Console.ResetColor();




"""
try:
   sys.platform="win32"
   os.environ['TERM'] = 'dumb'
   from prompt_toolkit import prompt
except Exception as e:
   traceback.print_exc(file=sys.stdout)

"""
Ejemplo n.º 19
0
sqlDbConnection = SqlClient.SqlConnection(sqlConnectionString)
sqlDbConnection.Open()

workTable = DataTable()
workTable.Columns.Add("Col1", Byte)
workTable.Columns.Add("Col2",Byte)
workTable.Columns.Add("Col3", Int32)
workTable.Columns.Add("Col4", Byte)
workTable.Columns.Add("Col5", Byte)
workTable.Columns.Add("Col6", Single)

sampleArray = [Byte(7), Byte(8), Int32(1), Byte(15), Byte(12), Single(0.34324)]
for i in range (0, 189000) :
    workTable.Rows.Add(Array[object](sampleArray))

cmd = SqlClient.SqlCommand("truncate table dbo.MyTable", sqlDbConnection);
def bulkLoadEsgData ():
    sbc = SqlClient.SqlBulkCopy(sqlConnectionString, SqlClient.SqlBulkCopyOptions.TableLock, BulkCopyTimeout=0, DestinationTableName="dbo.MyTable")
    sbc.WriteToServer(workTable)

# Start simulation
Console.WriteLine("Enter number of simulations (1 simulation = 189,000 data rows):"+"\n")
strN = Console.ReadLine()

n = int(strN)
cmd.ExecuteNonQuery()
for i in range (0, n):
    bulkLoadEsgData()

sqlDbConnection.Close()
Environment.Exit(1111)
Ejemplo n.º 20
0
def Attack(self):
    Console.WriteLine("The enemy attacks for {0} damage", self._damage)
    return self._damage
Ejemplo n.º 21
0
Archivo: api.py Proyecto: recs12/bom
def raw_input(message):
    Console.WriteLine(message)
    return Console.ReadLine()
Ejemplo n.º 22
0
 def testPass(self):
     Console.WriteLine("--testPass--")
     Assert.IsTrue(True)
Ejemplo n.º 23
0
import clr
from System import Console

Console.Write("Digite o seu nome: ")
v_nome = Console.ReadLine()
Console.WriteLine("Ola, " + v_nome + ".")

Ejemplo n.º 24
0
 def testInBase(self):
     Console.WriteLine("--testInBase--")
     Assert.IsTrue(True)
Ejemplo n.º 25
0
"""
Provides an interface between the F# implementation of SAT and Python.

If this script is run directly it will make some test calls into F# and print the results.
"""
import sys
from os import path

import clr

project_dir = path.dirname(path.abspath(__file__))
library_dir = path.join(project_dir, "FSharpImplementation", "bin", "Debug")
sys.path.append(library_dir)

clr.AddReference("FSharpImplementation")

from FSharpImplementationNamespace import SeparatingAxisTheorem

has_collided = SeparatingAxisTheorem.hasCollied

if __name__ == "__main__":
    from System import Console
    Console.WriteLine("Hello from .net")
    print()

    print(SeparatingAxisTheorem.mathTest(9, 2))
    print()

    print(SeparatingAxisTheorem.typeTest(((9, 2), (54, 4))))
    print()