~ml-launchpad/ubuntu/natty/gcompris/fix-for-777349

« back to all changes in this revision

Viewing changes to src/boards/python/connect4p/board.py

  • Committer: Bazaar Package Importer
  • Author(s): Marc Gariepy, Marc Gariepy, Stephane Graber
  • Date: 2010-01-04 17:42:49 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20100104174249-7bupatd9dtxyhvs4
Tags: 9.0-0ubuntu1
[Marc Gariepy]
* New upstream release (9.0).
* Remove cache.c from POTFILES to avoid FTBFS
* Remove unneeded rm in debian/rules (file no longer exists upstream)

[Stephane Graber]
* Bump Debian standards to 3.8.3
* Add patch system (dpatch)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#  gcompris - connect4
2
 
#
3
 
# Time-stamp:
4
 
#
5
 
# Copyright (C) 2005 Laurent Lacheny
6
 
#
7
 
#   This program is free software; you can redistribute it and/or modify
8
 
#   it under the terms of the GNU General Public License as published by
9
 
#   the Free Software Foundation; either version 3 of the License, or
10
 
#   (at your option) any later version.
11
 
#
12
 
#   This program is distributed in the hope that it will be useful,
13
 
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
#   GNU General Public License for more details.
16
 
#
17
 
#   You should have received a copy of the GNU General Public License
18
 
#   along with this program; if not, see <http://www.gnu.org/licenses/>.
19
 
 
20
 
#
21
 
# This code comes from the project 4stattack
22
 
# http://forcedattack.sourceforge.net/
23
 
#
24
 
#########################################################################
25
 
#                            4st Attack 2                               #
26
 
#########################################################################
27
 
# Created by:                                                           #
28
 
# Developer            - "slm" - Jeroen Vloothuis                       #
29
 
# Graphics             - "Korruptor" - Gareth Noyce                     #
30
 
# Music                - "theGREENzebra"                                #
31
 
#########################################################################
32
 
# Specail thanks:                                                       #
33
 
# chakie(Jan Elkholm)    - letting me "embrace and extend" his gui lib  #
34
 
# Mighty(Xander Soldaat) - for the Makefile and the Debian packages     #
35
 
# Han                    - for the rpms                                 #
36
 
# jk                     - for the FreeBSD port                         #
37
 
# Tjerk Nan              - for the Windows version                      #
38
 
# Micon                  - for the webdesign                            #
39
 
# Everyone in #pygame and the opensource community in general           #
40
 
#########################################################################
41
 
# This software is licensed under the GPL - General Public License      #
42
 
#########################################################################
43
 
 
44
 
 
45
 
 
46
 
class Board:
47
 
  # Setup an empty board
48
 
  def __init__(self):
49
 
    self.state = []
50
 
    for x in range(7):
51
 
      self.state.append([])
52
 
    self.last_move = -1
53
 
 
54
 
  def move(self, move, player):
55
 
    self.state[move].append(player)
56
 
    self.last_move = move
57
 
 
58
 
  def domoves(self, moves):
59
 
    for (move, player) in moves:
60
 
      self.move(move, player)
61
 
 
62
 
  def undomove(self, move):
63
 
    if len(self.state[move]) > 0:
64
 
      del self.state[move][len(self.state[move])-1]