当前位置: 首页>>代码示例>>Python>>正文


Python Grid.Grid类代码示例

本文整理汇总了Python中Grid.Grid的典型用法代码示例。如果您正苦于以下问题:Python Grid类的具体用法?Python Grid怎么用?Python Grid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Grid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: loadReferenceImage

 def loadReferenceImage(self, path = ''):
     ref_grid = Grid()
     #if self.grid.ext_color:
         #self.ref_name = 'ext_'+self.ref_name
     ref_grid.image2Grid(path+self.ref_name, ext_colors=self.grid.ext_color)
     ref_grid.visualize()
     return ref_grid
开发者ID:AndraAlexa,项目名称:NC-urban-CA,代码行数:7,代码来源:CellularAutomata.py

示例2: test_get_value

def test_get_value():
	g_1 = Grid(3,3)
	assert g_1.get_value(2,2) == 0
	g_1.array[2][2] = 3
	assert g_1.get_value(2,2) == 3
	assert g_1.get_value(10, 10) == -1
	assert g_1.get_value(-5, -3) == -1
开发者ID:avh2ag,项目名称:Spelling-Suggester,代码行数:7,代码来源:test_grid.py

示例3: __init__

	def __init__(self, points=(), left=0.0, right=1.0,
				start=0.0, end=1.0,
				id=u'', classes=(),
				lineidprefix=u'', lineclasses=()):
		"""
		@param points: A sequence of points to draw grid lines at
		@param left: The leftmost coordinate to begin drawing grid lines at
		@param right: The rightmost coordinate to stop drawing grid lines at

		@param start: The starting coordinate of the axis
		@param end: The ending coordinate of the axis
		
		@param id: The unique ID to be used in the SVG document
		@type id: string
		@param classes: Classnames to be used in the SVG document
		@type classes: string or sequence of strings

		@param lineidprefix: The prefix for each grid line's ID
		@type lineidprefix: string
		@param lineclasses: Classnames to be applied to each grid line
		@type lineclasses: string or sequence of strings
		"""

		Grid.__init__(self, points, start, end, id, classes, lineidprefix, lineclasses)

		self.left = left
		self.right = right
开发者ID:agold,项目名称:svgchart,代码行数:27,代码来源:HorizontalGrid.py

示例4: __init__

    def __init__(self, data, param):
        Grid.__init__(self, data, param)

        self.param.m = self.param.partitionsHTree[1]
        self.param.maxHeightHTree = 2

        logging.debug("Grid_pure: size: %d" % self.param.m)
开发者ID:ubriela,项目名称:geocrowd-priv,代码行数:7,代码来源:Grid_pure.py

示例5: __init__

class GridManager:
	# Constructor
	def __init__(self):
		self.__grid = Grid()
		self.__gamePlayer = GamePlayer()
		self.__userPlayer = UserPlayer()

	# Start Game
	def startGame(self):
		# Will continue toggling between
		# Game and User turns until the
		# Grid is Full (which is a loss)
		# or a 2048 tile is encountered
		# (which is a win)
		while (not self.__grid.gridContains(2048)):
			self.__gamePlayer.makeMove(self.__grid)

			self.__grid.printGrid()

			if (not self.__userPlayer.makeMove(self.__grid)):
				print "User Lost!"
				break

		if (self.__grid.gridContains(2048)):
			print "User Won!"
开发者ID:jonnadul,项目名称:2048_solver,代码行数:25,代码来源:GridManager.py

示例6: __init__

    def __init__(self, data, param):
        Grid.__init__(self, data, param)

        self.param.m = self.param.part_size
        self.param.maxHeightHTree = 2

        logging.debug("Grid_standard: size: %d" % self.param.m)
开发者ID:infolab-usc,项目名称:BDR,代码行数:7,代码来源:Grid_standard.py

示例7: make_grid

 def make_grid(self):
     if not(self.Density): self.PCL.reset(); self.Density = Grid(self.shape, self.x0y0, self.cellsize, self.nodata)
     if not(self.Intensity): self.PCL.reset(); self.Intensity = Grid(self.shape, self.x0y0, self.cellsize, self.nodata)
     [[self.__converter__(xyz, mode="both") for xyz in XYZ] for XYZ in self.PCL.input.a()]
     print "[Grid = Intensity / Density] ...";
     self.Gridded = Grid(self.shape, self.x0y0, self.cellsize, self.nodata)
     self.Gridded.Z = self.Intensity.Z / self.Density.Z
     return self.Gridded
开发者ID:geoign,项目名称:xyppy,代码行数:8,代码来源:PointCloud.py

示例8: __init__

 def __init__(self, width, height):
     self.width = width
     self.height = height
     self.block = None
     
     self.grid = Grid(width, height)
     self.__add_borders(self.grid)
     self.background = Grid(width, height)
     self.grid.copy_content_into(self.background)
开发者ID:john2x,项目名称:tetrys,代码行数:9,代码来源:Map.py

示例9: __init__

    def __init__(self, raw_grid):
        Grid.__init__(self, raw_grid)
        # Inherits Grid class
        self.number_of_iterations_yet = 0
        self.gamma = 0.7
        # gamma : discount factor

        self.errant_probability = 0.1
        # two errant outcomes
        self.intended_probability = 0.8
开发者ID:Kristofir,项目名称:MarkovDecisionProcess,代码行数:10,代码来源:MDP.py

示例10: getNewPuzzle

def getNewPuzzle():
	global difficulty_setting
	new_grid = Grid(db_read, difficulty_setting)
	new_puzzle = new_grid.generate_puzzle()
	clues = new_grid.clues
	missing_letters = new_grid.missing_letters

	#we return three things in the data - a new puzzle, a list of clues for that puzzle, and the missing letters to the answer of that puzzle
	print missing_letters
	return json.dumps({'puzzle': new_puzzle, 'clues': clues, 'answers' : missing_letters})
开发者ID:mrkarthikbala,项目名称:crossword_game,代码行数:10,代码来源:app.py

示例11: initializeGrid

 def initializeGrid(self, M, n):
     """Grid initizialed by funtions startLevel and startState
     Function takes the number of species M and dims of the
     2-D lattice (n by n)"""
     grid = Grid()
     for i in range(n):
         row = []
         for j in range(n):
             row.append(Cell(self,self.startLevel(M), self.startState()))
         grid.append(row)
     return grid
开发者ID:Roandinho,项目名称:SelfOrg,代码行数:11,代码来源:CAmodel.py

示例12: main

def main():
    """Manages the huddling simulation"""
    sim = Simulate(60)
    grid = Grid()

    # Iterate board
    iterations = 150
    for i in range(0, iterations):
        sim.step()
        grid.update(sim.penguins)
        # time.sleep(0.1)
        sim.save("iter_" + str(i))
    time.sleep(3)
开发者ID:CommandoScorch16,项目名称:Huddling-Emperor-Penguin-Simulation,代码行数:13,代码来源:main.py

示例13: __init__

    def __init__(self,parent):
        AbsolutePanel.__init__(self)
        self.userGrid = Grid()
        self.userGrid.createGrid(6, 6)
        self.userGrid.addTableListener(self)

        self.userGrid.setBorderWidth(2)
        self.userGrid.setCellPadding(4)
        self.userGrid.setCellSpacing(1)
        self.userGrid.setColLabelValue(0,"Username")
        self.userGrid.setColLabelValue(1,"First Name")
        self.userGrid.setColLabelValue(2,"Last Name")
        self.userGrid.setColLabelValue(3,"Email")
        self.userGrid.setColLabelValue(4,"Department")
        self.userGrid.setColLabelValue(5,"Password")

        self.newBtn = Button("New")
        self.deleteBtn = Button("Delete")
        self.deleteBtn.setEnabled(False)

        self.add(self.userGrid)
        self.add(self.newBtn)
        self.add(self.deleteBtn)

        return
开发者ID:Afey,项目名称:pyjs,代码行数:25,代码来源:components.py

示例14: __init__

	def __init__(self, window):
		self.window = window
		self.colours = {'white' : (255, 255, 255, 0), 'outerspace': (65, 74, 76, 0) }
		pyglet.gl.glClearColor(*self.colours['outerspace'])
		
		#Load images, create batch-groups, a batch
		pyglet.resource.path = ['tiles']
		pyglet.resource.reindex()
		#self.explosion_stream = open('explosion2strip.png', 'rb')
		#self.explosion = pyglet.image.load('explosion1strip.png')
		self.hexWater = pyglet.resource.image('hex.png')
		self.hexMud = pyglet.resource.image('hexDirt.png')
		self.hexUnwalkable = pyglet.resource.image('hexUnwalkable.png')
		self.ship = pyglet.resource.image('ship.png')
		self.background = pyglet.graphics.OrderedGroup(0)
		self.foreground = pyglet.graphics.OrderedGroup(1)
		self.effectslayer = pyglet.graphics.OrderedGroup(2)
		self.cellbatch = pyglet.graphics.Batch()
		
		self.grid = Grid(12, 8)	
		
		self.hexView = HexView(self.grid, 64, 55, 17, 0, 0) #todo: something to get this centered in the screen automatically
		self.screenCoordinates = self.hexView.screenCoordinates()
		
		self.selectedCell = None
		self.phase = 1
		self.movingUnit = False #True if a unit is being moved
		self.currentFaction = "Viper"
开发者ID:matthew-morgan,项目名称:python-a-star,代码行数:28,代码来源:Game.py

示例15: __init__

 def __init__(self):
     self.user_requested_exit = False
     self.player_turn = 1
     self.grid = Grid()
     self.is_a_winner = False
     print 'Welcome to TicTacToe!'
     print 'Here is the grid'
开发者ID:Nerus92,项目名称:udemy_python,代码行数:7,代码来源:main.py


注:本文中的Grid.Grid类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。