예제 #1
0
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Copyright 2015 Ozge Lule([email protected]),
#                Esref Ozturk([email protected])

from socket import *
from Test import Test

test = Test()

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))

test.send(s1, '{"op":"start","params":["single","easy","None"]}')
test.send(s1, '{"op":"play","params":["setdepth","1"]}')
test.send(s1,
          '{"op":"play","params":["nextmove","%s","%s"]}' % ('White', 'e2 e4'))
test.send(s1, '{"op":"play","params":["save","%s"]}' % 'pgnfile')

test.send(s1, '{"op":"play","params":["history"]}')
test.send(s1, '{"op":"play","params":["quit"]}')

s2 = socket(AF_INET, SOCK_STREAM)
s2.connect(("0.0.0.0", 20000))

test.send(s2, '{"op":"start","params":["single","easy","None"]}')
test.send(s2, '{"op":"play","params":["load","%s"]}' % 'pgnfile')

test.send(s2, '{"op":"play","params":["history"]}')
# Copyright 2015 Ozge Lule([email protected]), 
#                Esref Ozturk([email protected])


from socket import *
from json import *
from Test import Test

test = Test()

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))
s2 = socket(AF_INET, SOCK_STREAM)
s2.connect(("0.0.0.0", 20000))

data = test.send(s1, '{"op":"start","params":["single","easy","None"]}')
data = loads(data)
gameid = data['gameid']

test.send(s1, '{"op":"play","params":["setdepth","1"]}')
test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % ('White', 'e2 e4'))

test.send(s1, '{"op":"exit"}')

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))

test.send(s1, '{"op":"connect" ,"gameid":"%d"}' % gameid)
test.send(s1, '{"op":"play","params":["getboard"]}')
test.send(s1, '{"op":"play","params":["history"]}')
test.send(s1, '{"op":"play","params":["changemode","multi"]}')
예제 #3
0
from json import *
from Test import Test

moves = [('White', 'e2 e4'), ('Black', 'a7 a6'), ('White', 'd1 f3'),
         ('Black', 'a6 a5'), ('White', 'f1 c4'), ('Black', 'a5 a4'),
         ('White', 'f3 f7')]

test = Test()

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))

s2 = socket(AF_INET, SOCK_STREAM)
s2.connect(("0.0.0.0", 20000))

data = test.send(
    s1, '{"op":"start" , "color":"White","params":["multi","None","None"]}')

data = loads(data)
gameid = data['gameid']

test.send(s2, '{"op":"connect" , "color":"Black","gameid":"%d"}' % gameid)

test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[0])
test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[1])
test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[2])
test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[3])
test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[4])
test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[5])
test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[6])

test.send(s2, '{"op":"kill"}')
예제 #4
0
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Copyright 2015 Ozge Lule([email protected]),
#                Esref Ozturk([email protected])

from socket import *
from json import *
from Test import Test

test = Test()

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))

data = test.send(s1, '{"op":"start","params":["single","None","None"]}')

data = loads(data)
gameid = data['gameid']

print gameid

test.send(s1, '{"op":"play","params":["setdepth",%d]}' % (1, ))
test.send(s1,
          '{"op":"play","params":["nextmove","%s","%s"]}' % ('White', 'e2 e4'))

test.send(s1, '{"op":"play","params":["changemode","%s"]}' % ('multi', ))

nextmove = test.send(
    s1, '{"op":"play","params":["nextmove","%s","%s"]}' % ('White', 'afdsaf'))
# This file is part of Checkmate. 
# 
# This program is free software: you can redistribute it and/or modify 
# it under the terms of the GNU General Public License as published by 
# the Free Software Foundation, either version 3 of the License, or 
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful, 
# but WITHOUT ANY WARRANTY; without even the implied warranty of 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 
# Copyright 2015 Ozge Lule([email protected]), 
#                Esref Ozturk([email protected])


from socket import *
from Test import Test

test = Test()

s2 = socket(AF_INET, SOCK_STREAM)
s2.connect(("0.0.0.0", 20000))

test.send(s2, '{"op":"connect", "color":"Black", "gameid":"%d"}' % 1)

test.send(s2, '{"op":"kill"}')
#
# Copyright 2015 Ozge Lule([email protected]),
#                Esref Ozturk([email protected])

from socket import *
from json import *
from Test import Test

test = Test()

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))
s2 = socket(AF_INET, SOCK_STREAM)
s2.connect(("0.0.0.0", 20000))

data = test.send(s1, '{"op":"start","params":["single","easy","None"]}')
data = loads(data)
gameid = data['gameid']

test.send(s1, '{"op":"play","params":["setdepth","1"]}')
test.send(s1,
          '{"op":"play","params":["nextmove","%s","%s"]}' % ('White', 'e2 e4'))

test.send(s1, '{"op":"exit"}')

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))

test.send(s1, '{"op":"connect" ,"gameid":"%d"}' % gameid)
test.send(s1, '{"op":"play","params":["getboard"]}')
test.send(s1, '{"op":"play","params":["history"]}')
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 
# Copyright 2015 Ozge Lule([email protected]), 
#                Esref Ozturk([email protected])


from socket import *
from Test import Test

moves = [('Black', 'a7 a6'), ('Black', 'a6 a5'), ('Black', 'a5 a4')]

test = Test()

s2 = socket(AF_INET, SOCK_STREAM)
s2.connect(("0.0.0.0", 20000))

gameid = 1

test.send(s2, '{"op":"connect" , "color":"Black","gameid":"%d"}' % gameid)

test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[0])

test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[1])

test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[2])

test.send(s2, '{"op":"kill"}')
예제 #8
0
from random import randint
from socket import *
from json import *
from Test import Test

bookmodes = ['worst', 'best', 'random']

test = Test()

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))

s2 = socket(AF_INET, SOCK_STREAM)
s2.connect(("0.0.0.0", 20000))

data = test.send(s1, '{"op":"start", "color":"White","params":["multi","None","None"]}')

data = loads(data)
gameid = data['gameid']

test.send(s2, '{"op":"connect" , "color":"Black","gameid":"%d"}' % gameid)

# Be sure to download and extract http://ftp.gnu.org/gnu/chess/book_1.00.pgn.gz

test.send(s1, '{"op":"play","params":["addbook","book_1.00.pgn"]}')
test.send(s1, '{"op":"play","params":["enablebook","True"]}')

count = 0
while True:

    if count % 2 == 0:
# You should have received a copy of the GNU General Public License 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 
# Copyright 2015 Ozge Lule([email protected]), 
#                Esref Ozturk([email protected])


from socket import *
from Test import Test

test = Test()

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))

test.send(s1, '{"op":"start","params":["single","easy","None"]}')
test.send(s1, '{"op":"play","params":["setdepth","1"]}')
test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % ('White', 'e2 e4'))
test.send(s1, '{"op":"play","params":["save","%s"]}' % 'pgnfile')

test.send(s1, '{"op":"play","params":["history"]}')
test.send(s1, '{"op":"play","params":["quit"]}')

s2 = socket(AF_INET, SOCK_STREAM)
s2.connect(("0.0.0.0", 20000))

test.send(s2, '{"op":"start","params":["single","easy","None"]}')
test.send(s2, '{"op":"play","params":["load","%s"]}' % 'pgnfile')

test.send(s2, '{"op":"play","params":["history"]}')
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Copyright 2015 Ozge Lule([email protected]),
#                Esref Ozturk([email protected])

from socket import *
from Test import Test

moves = [('Black', 'a7 a6'), ('Black', 'a6 a5'), ('Black', 'a5 a4')]

test = Test()

s2 = socket(AF_INET, SOCK_STREAM)
s2.connect(("0.0.0.0", 20000))

gameid = 1

test.send(s2, '{"op":"connect" , "color":"Black","gameid":"%d"}' % gameid)

test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[0])

test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[1])

test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[2])

test.send(s2, '{"op":"kill"}')
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License 
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 
# Copyright 2015 Ozge Lule([email protected]), 
#                Esref Ozturk([email protected])


from socket import *
from Test import Test

moves = [('White', 'e2 e4'), ('White', 'd1 f3'), ('White', 'f1 c4'), ('White', 'f3 f7')]

test = Test()

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))

test.send(s1, '{"op":"start" , "color":"White","params":["multi","None","None"]}')

test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[0])

test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[1])

test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[2])

test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[3])

test.send(s1, '{"op":"kill"}')
from socket import *
from json import *
from Test import Test

moves = [('White', 'e2 e4'), ('Black', 'a7 a6'), ('White', 'd1 f3'), ('Black', 'a6 a5'), ('White', 'f1 c4'),
         ('Black', 'a5 a4'), ('White', 'f3 f7')]

test = Test()

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))

s2 = socket(AF_INET, SOCK_STREAM)
s2.connect(("0.0.0.0", 20000))

data = test.send(s1, '{"op":"start" , "color":"White","params":["multi","None","None"]}')

data = loads(data)
gameid = data['gameid']

test.send(s2, '{"op":"connect" , "color":"Black","gameid":"%d"}' % gameid)

test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[0])
test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[1])
test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[2])
test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[3])
test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[4])
test.send(s2, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[5])
test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % moves[6])

test.send(s2, '{"op":"kill"}')
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
# 
# Copyright 2015 Ozge Lule([email protected]), 
#                Esref Ozturk([email protected])


from socket import *
from json import *
from Test import Test

test = Test()

s1 = socket(AF_INET, SOCK_STREAM)
s1.connect(("0.0.0.0", 20000))

data = test.send(s1, '{"op":"start","params":["single","None","None"]}')

data = loads(data)
gameid = data['gameid']

print gameid

test.send(s1, '{"op":"play","params":["setdepth",%d]}' % (1,))
test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % ('White', 'e2 e4'))

test.send(s1, '{"op":"play","params":["changemode","%s"]}' % ('multi',))

nextmove = test.send(s1, '{"op":"play","params":["nextmove","%s","%s"]}' % ('White', 'afdsaf'))

nextmove = loads(nextmove)