spielwiese
Last change
on this file since 913156 was
913156,
checked in by Michael Brickenstein <bricken@…>, 18 years ago
|
*bricken: initial version
git-svn-id: file:///usr/local/Singular/svn/trunk@8995 2c84dea3-7e68-4137-9b89-c4e89433aadc
|
-
Property mode set to
100644
|
File size:
951 bytes
|
Line | |
---|
1 | # -*- coding: utf-8 -*- |
---|
2 | #imports and basic objects |
---|
3 | import sys |
---|
4 | sys.path.insert(0,"/Users/michael/sing3/modules/openmathserver") |
---|
5 | import CD.gametheory as gametheory |
---|
6 | from objects import OMApply |
---|
7 | from context import Context |
---|
8 | from os import pipe |
---|
9 | from subprocess import Popen,PIPE |
---|
10 | from omxmlreader import * |
---|
11 | context=Context() |
---|
12 | |
---|
13 | #our cake |
---|
14 | rectangle_list=[(4,3),(3,3),(1,1),(2,4),(4,2)] |
---|
15 | print "Eingabeliste", rectangle_list |
---|
16 | #create Openmath representation |
---|
17 | cake=gametheory.cake_to_OM(rectangle_list) |
---|
18 | task=OMApply(gametheory.left_wins_sym,[cake]) |
---|
19 | task=context.XMLEncodeObject(task) |
---|
20 | |
---|
21 | |
---|
22 | |
---|
23 | |
---|
24 | #open a pipe |
---|
25 | p=Popen(["python", "/Users/michael/sing3/modules/openmathserver/openmathhashunger.py"], |
---|
26 | stdout=PIPE,stdin=PIPE) |
---|
27 | p.stdin.write(task) |
---|
28 | p.stdin.close() |
---|
29 | |
---|
30 | #parse it |
---|
31 | root=readStream(p.stdout) |
---|
32 | builder=OMFromXMLBuilder() |
---|
33 | doc=builder.build(root) |
---|
34 | |
---|
35 | #output |
---|
36 | erg=doc.getValue() |
---|
37 | if erg: |
---|
38 | print "Spieler 1 gewinnt" |
---|
39 | else: |
---|
40 | print "Spieler 1 gewinnt nicht" |
---|
41 | p.stdout.close() |
---|
Note: See
TracBrowser
for help on using the repository browser.