# 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 random import randint
from Checkmate import Checkmate
from Test import Test

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

a = Checkmate(mode="multi")

# Be sure to download and extract http://ftp.gnu.org/gnu/chess/book_1.00.pgn.gz
a.addbook("book_1.00.pgn")
a.enablebook(enable=True)

dummy = Test()

while not a.isfinished():

    a.setbookmode(bookmodes[randint(0, 2)])

    move = a.hint()

    if move:
        a.nextmove(a.currentplayer(), move)
示例#2
0
# (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])

# Scholar's mate
from Checkmate import Checkmate
from Test import Test

a = Checkmate(mode='multi')

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

dummy = Test()

for move in moves:
    a.nextmove(move[0], move[1])
    dummy.show(a)

a.quit()
# 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 Checkmate import Checkmate
from Test import Test

dummy = Test()

a = Checkmate(mode='multi')

a.nextmove('White', 'e2 e4')
a.nextmove('Black', 'a7 a6')

dummy.show(a)

a.undo()

a.nextmove('Black', 'a7 a5')

dummy.show(a)

a.quit()
# 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 Checkmate import Checkmate
from Test import Test

a = Checkmate(mode="multi")
dummy = Test()

a.setdepth(1)

a.nextmove("White", "e2 e4")

dummy.show(a)

a.changemode("single")

dummy.show(a)

a.changemode("multi")

dummy.show(a)
# 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 Checkmate import Checkmate

a = Checkmate(difficulty='easy')
a.setdepth(1)
a.nextmove('White', 'e2 e4')
a.save('pgnfile')
print a.history()
a.quit()

b = Checkmate()
b.load('pgnfile')
print b.history()
b.newgame()
print b.history()
b.quit()
#
# 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 Checkmate import Checkmate
from Test import Test

a = Checkmate(mode='multi')
dummy = Test()

a.setdepth(1)

a.nextmove('White', 'e2 e4')

dummy.show(a)

a.changemode('single')

dummy.show(a)

a.changemode('multi')

dummy.show(a)
# (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])


# Scholar's mate
from Checkmate import Checkmate
from Test import Test

a = Checkmate(mode='multi')

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

dummy = Test()

for move in moves:
    a.nextmove(move[0], move[1])
    dummy.show(a)

a.quit()
示例#8
0
# 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 Checkmate import Checkmate
from Test import Test

dummy = Test()

a = Checkmate(mode='multi')

a.nextmove('White', 'e2 e4')
a.nextmove('Black', 'a7 a6')

dummy.show(a)

a.undo()

a.nextmove('Black', 'a7 a5')

dummy.show(a)

a.quit()
# 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 random import randint
from Checkmate import Checkmate
from Test import Test

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

a = Checkmate(mode='multi')

# Be sure to download and extract http://ftp.gnu.org/gnu/chess/book_1.00.pgn.gz
a.addbook('book_1.00.pgn')
a.enablebook(enable=True)

dummy = Test()

while not a.isfinished():

    a.setbookmode(bookmodes[randint(0, 2)])

    move = a.hint()

    if move:
        a.nextmove(a.currentplayer(), move)