Back to index

gcompris  8.2.2
human.py
Go to the documentation of this file.
00001 #  gcompris - connect4 
00002 # 
00003 # Time-stamp: 
00004 # 
00005 # Copyright (C) 2005 Laurent Lacheny 
00006 # 
00007 #   This program is free software; you can redistribute it and/or modify
00008 #   it under the terms of the GNU General Public License as published by
00009 #   the Free Software Foundation; either version 2 of the License, or
00010 #   (at your option) any later version.
00011 # 
00012 #   This program is distributed in the hope that it will be useful,
00013 #   but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 #   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 #   GNU General Public License for more details.
00016 # 
00017 #   You should have received a copy of the GNU General Public License
00018 #   along with this program; if not, write to the Free Software
00019 #   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 
00021 #
00022 # This code comes from the project 4stattack
00023 # http://forcedattack.sourceforge.net/
00024 #
00025 #########################################################################
00026 #                            4st Attack 2                               #
00027 #########################################################################
00028 # Created by:                                                           #
00029 # Developer            - "slm" - Jeroen Vloothuis                       #
00030 # Graphics             - "Korruptor" - Gareth Noyce                     #
00031 # Music                - "theGREENzebra"                                #
00032 #########################################################################
00033 # Specail thanks:                                                       #
00034 # chakie(Jan Elkholm)    - letting me "embrace and extend" his gui lib  #
00035 # Mighty(Xander Soldaat) - for the Makefile and the Debian packages     #
00036 # Han                    - for the rpms                                 #
00037 # jk                     - for the FreeBSD port                         #
00038 # Tjerk Nan              - for the Windows version                      #
00039 # Micon                  - for the webdesign                            #
00040 # Everyone in #pygame and the opensource community in general           #
00041 #########################################################################
00042 # This software is licensed under the GPL - General Public License      #
00043 #########################################################################
00044 
00045 from player import *
00046 import rules
00047 
00048 class Human:
00049   type = 'human'
00050 
00051   def __init__(self, difficulty):
00052     pass
00053 
00054   # This method returns the move to be made
00055   def doMove(self, board, player, event):
00056     self.board = board
00057     if event >-1 and event < 7:
00058       return event
00059     return -1
00060 
00061   def setmove(self, trigger, event, number):
00062     if rules.isMoveLegal(self.board, number):
00063       self.move = number
00064       return widget.DONE
00065   def gameOver(self, move):
00066     return None
00067 
00068   def setDifficulty(self, difficulty):
00069     pass