예제 #1
0
def FieldFromData(module, data, struct):
  field = mojom.Field()
  field.name = data['name']
  field.kind = KindFromData(
      module.kinds, data['kind'], (module.namespace, struct.name))
  field.ordinal = data.get('ordinal')
  field.default = FixupExpression(
      module, data.get('default'), (module.namespace, struct.name))
  return field
예제 #2
0
                probabRight[rowIndex][elIndex] += 0.1
                probabDown[rowIndex][elIndex] += 0.8
                probabLeft[rowIndex][elIndex] += 0.1
            else:
                probabRight[rowIndex + 1][elIndex] += 0.1
                probabDown[rowIndex + 1][elIndex] += 0.8
                probabLeft[rowIndex + 1][elIndex] += 0.1
        else:
            probabUp = 0
            probabRight = 0
            probabLeft = 0
            probabDown = 0

        probabs = [probabUp, probabRight, probabDown, probabLeft]
        allElements[rowIndex][elIndex] = module.Field(
            rowIndex, elIndex, probabs, float(tabV[rowIndex][elIndex]),
            float(tabV[rowIndex][elIndex]), 0, element)

        elIndex += 1
    rowIndex += 1

for i in range(1000):
    for row in allElements:
        for element in row:
            if element.type == '1':
                actionTab = [
                    module.Action(1, 0),
                    module.Action(2, 0),
                    module.Action(3, 0),
                    module.Action(4, 0)
                ]