+ try:
+ while self.src.readline().strip(" \r\n") != "# Initial board":
+ self.line_number += 1
+
+ line = self.src.readline().strip(" \r\n")
+
+ while line != "# Start game":
+ #print "Reading line " + str(line)
+ self.line_number += 1
+ [x,y] = map(int, line.split("at")[1].strip(" \r\n").split(","))
+ colour = line.split(" ")[0]
+ current_type = line.split(" ")[1]
+ types = map(lambda e : e.strip(" [],'"), line.split(" ")[2:4])
+ p = Piece(colour, x, y, types)
+ if current_type != "unknown":
+ p.current_type = current_type
+ p.choice = types.index(current_type)
+
+ self.board.pieces[colour].append(p)
+ self.board.grid[x][y] = p
+ if current_type == "king":
+ self.board.king[colour] = p
+
+ line = self.src.readline().strip(" \r\n")
+
+ except Exception, e:
+ raise Exception("FILE line: " + str(self.line_number) + " \""+str(line)+"\"") #\n" + e.message)