Merge branch 'feature/cleanups' into develop
This commit is contained in:
commit
24d9b15b6e
|
|
@ -8,8 +8,8 @@ excluded:
|
|||
line_length: 220
|
||||
number_separator:
|
||||
minimum_length: 5
|
||||
disabled_rules:
|
||||
- identifier_name
|
||||
#disabled_rules:
|
||||
#- identifier_name
|
||||
opt_in_rules:
|
||||
- file_header
|
||||
- array_init
|
||||
|
|
|
|||
|
|
@ -5,12 +5,12 @@
|
|||
// Created by Christian Treffs on 08.10.17.
|
||||
//
|
||||
|
||||
public final class Entity: UniqueEntityIdentifiable {
|
||||
open class Entity: UniqueEntityIdentifiable {
|
||||
internal(set) public var identifier: EntityIdentifier = EntityIdentifier.invalid
|
||||
public var name: String?
|
||||
unowned let nexus: Nexus
|
||||
|
||||
init(nexus: Nexus, id: EntityIdentifier, name: String? = nil) {
|
||||
internal init(nexus: Nexus, id: EntityIdentifier, name: String? = nil) {
|
||||
self.nexus = nexus
|
||||
self.identifier = id
|
||||
self.name = name
|
||||
|
|
|
|||
|
|
@ -34,11 +34,11 @@ public final class Family: Equatable {
|
|||
}
|
||||
|
||||
public final var memberIds: UniformEntityIdentifiers {
|
||||
return nexus?.members(of: traits) ?? UniformEntityIdentifiers()
|
||||
return nexus?.members(withFamilyTraits: traits) ?? UniformEntityIdentifiers()
|
||||
}
|
||||
|
||||
public final var count: Int {
|
||||
return nexus?.members(of: traits)?.count ?? 0
|
||||
return nexus?.members(withFamilyTraits: traits)?.count ?? 0
|
||||
}
|
||||
|
||||
public final func canBecomeMember(_ entity: Entity) -> Bool {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
public extension Nexus {
|
||||
|
||||
final var numComponents: Int {
|
||||
return componentsByType.reduce(0) { return $0 + $1.value.count }
|
||||
return componentsByType.reduce(0) { $0 + $1.value.count }
|
||||
}
|
||||
|
||||
final func has(componentId: ComponentIdentifier, entityIdx: EntityIndex) -> Bool {
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ extension Nexus {
|
|||
return entityStorage.count
|
||||
}
|
||||
|
||||
public func has(entity entityId: EntityIdentifier) -> Bool {
|
||||
public func exists(entity entityId: EntityIdentifier) -> Bool {
|
||||
return entityStorage.contains(entityId.index)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ public extension Nexus {
|
|||
return family.traits.isMatch(components: componentSet)
|
||||
}
|
||||
|
||||
func members(of traits: FamilyTraitSet) -> UniformEntityIdentifiers? {
|
||||
func members(withFamilyTraits traits: FamilyTraitSet) -> UniformEntityIdentifiers? {
|
||||
return familyMembersByTraits[traits]
|
||||
}
|
||||
|
||||
|
|
@ -46,11 +46,11 @@ public extension Nexus {
|
|||
}
|
||||
|
||||
func isMember(_ entityId: EntityIdentifier, in family: Family) -> Bool {
|
||||
return isMember(entityId, in: family.traits)
|
||||
return isMember(entity: entityId, inFamilyWithTraits: family.traits)
|
||||
}
|
||||
|
||||
func isMember(_ entityId: EntityIdentifier, in traits: FamilyTraitSet) -> Bool {
|
||||
guard let members: UniformEntityIdentifiers = members(of: traits) else {
|
||||
func isMember(entity entityId: EntityIdentifier, inFamilyWithTraits traits: FamilyTraitSet) -> Bool {
|
||||
guard let members: UniformEntityIdentifiers = members(withFamilyTraits: traits) else {
|
||||
return false
|
||||
}
|
||||
return members.contains(entityId.index)
|
||||
|
|
@ -63,9 +63,8 @@ extension Nexus {
|
|||
|
||||
func update(familyMembership entityId: EntityIdentifier) {
|
||||
// FIXME: iterating all families is costly for many families
|
||||
for (familyTraits, _) in familyMembersByTraits {
|
||||
update(membership: familyTraits, for: entityId)
|
||||
}
|
||||
familyMembersByTraits.forEach { familyTraits, _ in update(membership: familyTraits, for: entityId) }
|
||||
|
||||
}
|
||||
|
||||
enum UpdateState {
|
||||
|
|
@ -76,32 +75,34 @@ extension Nexus {
|
|||
case unchanged(id: EntityIdentifier, traits: FamilyTraitSet)
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
func update(membership traits: FamilyTraitSet, for entityId: EntityIdentifier) -> UpdateState {
|
||||
func update(membership traits: FamilyTraitSet, for entityId: EntityIdentifier) {
|
||||
let entityIdx: EntityIndex = entityId.index
|
||||
guard let componentIds: SparseComponentIdentifierSet = componentIdsByEntity[entityIdx] else {
|
||||
return .noComponents(id: entityId, traits: traits)
|
||||
// no components - so skip
|
||||
return
|
||||
}
|
||||
|
||||
let isMember: Bool = self.isMember(entityId, in: traits)
|
||||
if !has(entity: entityId) && isMember {
|
||||
remove(from: traits, entityId: entityId, entityIdx: entityIdx)
|
||||
return .removedDeleted(id: entityId, traits: traits)
|
||||
let isMember: Bool = self.isMember(entity: entityId, inFamilyWithTraits: traits)
|
||||
if !exists(entity: entityId) && isMember {
|
||||
remove(entityWithId: entityId, andIndex: entityIdx, fromFamilyWithTraits: traits)
|
||||
return
|
||||
}
|
||||
|
||||
// TODO: get rid of set creation for comparison
|
||||
let componentsSet: ComponentSet = ComponentSet(componentIds)
|
||||
let isMatch: Bool = traits.isMatch(components: componentsSet)
|
||||
|
||||
switch (isMatch, isMember) {
|
||||
case (true, false):
|
||||
add(to: traits, entityId: entityId, entityIdx: entityIdx)
|
||||
add(entityWithId: entityId, andIndex: entityIdx, toFamilyWithTraits: traits)
|
||||
notify(FamilyMemberAdded(member: entityId, toFamily: traits))
|
||||
return .added(id: entityId, traits: traits)
|
||||
return
|
||||
case (false, true):
|
||||
remove(from: traits, entityId: entityId, entityIdx: entityIdx)
|
||||
remove(entityWithId: entityId, andIndex: entityIdx, fromFamilyWithTraits: traits)
|
||||
notify(FamilyMemberRemoved(member: entityId, from: traits))
|
||||
return .removed(id: entityId, traits: traits)
|
||||
return
|
||||
default:
|
||||
return .unchanged(id: entityId, traits: traits)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -127,28 +128,27 @@ extension Nexus {
|
|||
// MARK: - fileprivate extensions
|
||||
private extension Nexus {
|
||||
|
||||
func get(family traits: FamilyTraitSet) -> Family? {
|
||||
final func get(family traits: FamilyTraitSet) -> Family? {
|
||||
return create(family: traits)
|
||||
}
|
||||
|
||||
func create(family traits: FamilyTraitSet) -> Family {
|
||||
final func create(family traits: FamilyTraitSet) -> Family {
|
||||
let family: Family = Family(self, traits: traits)
|
||||
return family
|
||||
}
|
||||
|
||||
func calculateTraitEntityIdHash(traitHash: FamilyTraitSetHash, entityIdx: EntityIndex) -> TraitEntityIdHash {
|
||||
final func calculateTraitEntityIdHash(traitHash: FamilyTraitSetHash, entityIdx: EntityIndex) -> TraitEntityIdHash {
|
||||
return hash(combine: traitHash, entityIdx)
|
||||
}
|
||||
|
||||
func add(to traits: FamilyTraitSet, entityId: EntityIdentifier, entityIdx: EntityIndex) {
|
||||
final func add(entityWithId entityId: EntityIdentifier, andIndex entityIdx: EntityIndex, toFamilyWithTraits traits: FamilyTraitSet) {
|
||||
if familyMembersByTraits[traits] == nil {
|
||||
familyMembersByTraits[traits] = UniformEntityIdentifiers()
|
||||
}
|
||||
|
||||
familyMembersByTraits[traits]?.insert(entityId, at: entityIdx)
|
||||
}
|
||||
|
||||
func remove(from traits: FamilyTraitSet, entityId: EntityIdentifier, entityIdx: EntityIndex) {
|
||||
final func remove(entityWithId entityId: EntityIdentifier, andIndex entityIdx: EntityIndex, fromFamilyWithTraits traits: FamilyTraitSet) {
|
||||
familyMembersByTraits[traits]?.remove(at: entityIdx)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
// Created by Christian Treffs on 30.10.17.
|
||||
//
|
||||
|
||||
public class UnorderedSparseSet<Element>: Sequence {
|
||||
public class UnorderedSparseSet<Element> {
|
||||
public typealias Index = Int
|
||||
public typealias Key = Int
|
||||
|
||||
|
|
@ -136,6 +136,33 @@ public class UnorderedSparseSet<Element>: Sequence {
|
|||
}
|
||||
}
|
||||
|
||||
extension UnorderedSparseSet: MutableCollection, RandomAccessCollection {
|
||||
public func index(after index: Index) -> Int {
|
||||
return dense.index(after: index)
|
||||
}
|
||||
|
||||
public subscript(position: Index) -> Element {
|
||||
get {
|
||||
guard let element: Element = get(at: position) else {
|
||||
fatalError("no element at index \(position)")
|
||||
}
|
||||
return element
|
||||
}
|
||||
set(newValue) {
|
||||
insert(newValue, at: position)
|
||||
}
|
||||
}
|
||||
|
||||
public var startIndex: Index {
|
||||
return dense.startIndex
|
||||
}
|
||||
|
||||
public var endIndex: Index {
|
||||
return dense.endIndex
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension UnorderedSparseSet.Entry: Equatable where UnorderedSparseSet.Element: Equatable {
|
||||
public static func == (lhs: UnorderedSparseSet.Entry, rhs: UnorderedSparseSet.Entry) -> Bool {
|
||||
return lhs.element == rhs.element && lhs.key == rhs.key
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ class ExampleSystem {
|
|||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
// Created by Christian Treffs on 09.05.18.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import FirebladeECS
|
||||
import XCTest
|
||||
|
||||
class FamilyPerformanceTests: XCTestCase {
|
||||
|
||||
|
|
@ -22,7 +22,6 @@ class FamilyPerformanceTests: XCTestCase {
|
|||
super.tearDown()
|
||||
}
|
||||
|
||||
|
||||
func testMeasureIterateMembers() {
|
||||
|
||||
let number: Int = 10_000
|
||||
|
|
@ -88,6 +87,4 @@ class FamilyPerformanceTests: XCTestCase {
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,7 +110,6 @@ class FamilyTests: XCTestCase {
|
|||
let familyB = nexus.family(requiresAll: [Velocity.self],
|
||||
excludesAll: [Position.self])
|
||||
|
||||
|
||||
XCTAssertEqual(familyA.count, 10)
|
||||
XCTAssertEqual(familyB.count, 0)
|
||||
|
||||
|
|
@ -132,7 +131,6 @@ class FamilyTests: XCTestCase {
|
|||
|
||||
}
|
||||
|
||||
|
||||
func testFamilyMemberBasicIteration() {
|
||||
|
||||
for i in 0..<1000 {
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
// Created by Christian Treffs on 09.05.18.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import FirebladeECS
|
||||
import XCTest
|
||||
|
||||
class FamilyTraitsTests: XCTestCase {
|
||||
|
||||
|
|
@ -22,7 +22,6 @@ class FamilyTraitsTests: XCTestCase {
|
|||
super.tearDown()
|
||||
}
|
||||
|
||||
|
||||
func testTraitCommutativity() {
|
||||
|
||||
let t1 = FamilyTraitSet(requiresAll: [Position.self, Velocity.self],
|
||||
|
|
|
|||
|
|
@ -39,9 +39,9 @@ class HashingTests: XCTestCase {
|
|||
}
|
||||
|
||||
func testMeasureCombineHash() {
|
||||
let a: Set<Int> = Set<Int>.init([14_561_291, 26_451_562, 34_562_182, 488_972_556, 5_128_426_962, 68_211_812])
|
||||
let b: Set<Int> = Set<Int>.init([1_083_838, 912_312, 83_333, 71_234_555, 4_343_234])
|
||||
let c: Set<Int> = Set<Int>.init([3_410_346_899_765, 90_000_002, 12_212_321, 71, 6_123_345_676_543])
|
||||
let a: Set<Int> = Set<Int>([14_561_291, 26_451_562, 34_562_182, 488_972_556, 5_128_426_962, 68_211_812])
|
||||
let b: Set<Int> = Set<Int>([1_083_838, 912_312, 83_333, 71_234_555, 4_343_234])
|
||||
let c: Set<Int> = Set<Int>([3_410_346_899_765, 90_000_002, 12_212_321, 71, 6_123_345_676_543])
|
||||
|
||||
let input: ContiguousArray<Int> = ContiguousArray<Int>(arrayLiteral: a.hashValue, b.hashValue, c.hashValue)
|
||||
measure {
|
||||
|
|
@ -53,9 +53,9 @@ class HashingTests: XCTestCase {
|
|||
}
|
||||
|
||||
func testMeasureSetOfSetHash() {
|
||||
let a: Set<Int> = Set<Int>.init([14_561_291, 26_451_562, 34_562_182, 488_972_556, 5_128_426_962, 68_211_812])
|
||||
let b: Set<Int> = Set<Int>.init([1_083_838, 912_312, 83_333, 71_234_555, 4_343_234])
|
||||
let c: Set<Int> = Set<Int>.init([3_410_346_899_765, 90_000_002, 12_212_321, 71, 6_123_345_676_543])
|
||||
let a: Set<Int> = Set<Int>([14_561_291, 26_451_562, 34_562_182, 488_972_556, 5_128_426_962, 68_211_812])
|
||||
let b: Set<Int> = Set<Int>([1_083_838, 912_312, 83_333, 71_234_555, 4_343_234])
|
||||
let c: Set<Int> = Set<Int>([3_410_346_899_765, 90_000_002, 12_212_321, 71, 6_123_345_676_543])
|
||||
|
||||
let input = Set<Set<Int>>(arrayLiteral: a, b, c)
|
||||
measure {
|
||||
|
|
|
|||
|
|
@ -61,7 +61,6 @@ class NexusTests: XCTestCase {
|
|||
XCTAssertEqual(nexus.numEntities, 0)
|
||||
}
|
||||
|
||||
|
||||
func testComponentCreation() {
|
||||
|
||||
XCTAssert(nexus.numEntities == 0)
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ class SparseSetTests: XCTestCase {
|
|||
let pos = Position(x: idx, y: idx)
|
||||
set.insert(pos, at: idx)
|
||||
XCTAssertEqual(set.sparse[idx], idx)
|
||||
XCTAssertEqual(set.dense.count, idx+1)
|
||||
XCTAssertEqual(set.dense.count, idx + 1)
|
||||
}
|
||||
|
||||
XCTAssertEqual(set.count, num)
|
||||
|
|
@ -120,14 +120,12 @@ class SparseSetTests: XCTestCase {
|
|||
XCTAssertEqual(set.sparse[6], 6)
|
||||
XCTAssertEqual(set.sparse[7], nil)
|
||||
|
||||
|
||||
// ---------------------------------------------
|
||||
set.remove(at: 3)
|
||||
|
||||
XCTAssertEqual(set.count, num-1)
|
||||
XCTAssertEqual(set.sparse.count, num-1)
|
||||
XCTAssertEqual(set.dense.count, num-1)
|
||||
|
||||
XCTAssertEqual(set.count, num - 1)
|
||||
XCTAssertEqual(set.sparse.count, num - 1)
|
||||
XCTAssertEqual(set.dense.count, num - 1)
|
||||
|
||||
XCTAssertEqual(set.get(at: 0)?.x, 0)
|
||||
XCTAssertEqual(set.get(at: 1)?.x, 1)
|
||||
|
|
@ -156,15 +154,12 @@ class SparseSetTests: XCTestCase {
|
|||
XCTAssertEqual(set.sparse[6], 3)
|
||||
XCTAssertEqual(set.sparse[7], nil)
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------
|
||||
set.remove(at: 2)
|
||||
|
||||
XCTAssertEqual(set.count, num-2)
|
||||
XCTAssertEqual(set.sparse.count, num-2)
|
||||
XCTAssertEqual(set.dense.count, num-2)
|
||||
|
||||
XCTAssertEqual(set.count, num - 2)
|
||||
XCTAssertEqual(set.sparse.count, num - 2)
|
||||
XCTAssertEqual(set.dense.count, num - 2)
|
||||
|
||||
XCTAssertEqual(set.get(at: 0)?.x, 0)
|
||||
XCTAssertEqual(set.get(at: 1)?.x, 1)
|
||||
|
|
@ -193,15 +188,12 @@ class SparseSetTests: XCTestCase {
|
|||
XCTAssertEqual(set.sparse[6], 3)
|
||||
XCTAssertEqual(set.sparse[7], nil)
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------
|
||||
set.remove(at: 0)
|
||||
|
||||
XCTAssertEqual(set.count, num-3)
|
||||
XCTAssertEqual(set.sparse.count, num-3)
|
||||
XCTAssertEqual(set.dense.count, num-3)
|
||||
|
||||
XCTAssertEqual(set.count, num - 3)
|
||||
XCTAssertEqual(set.sparse.count, num - 3)
|
||||
XCTAssertEqual(set.dense.count, num - 3)
|
||||
|
||||
XCTAssertEqual(set.get(at: 0)?.x, nil)
|
||||
XCTAssertEqual(set.get(at: 1)?.x, 1)
|
||||
|
|
@ -230,14 +222,12 @@ class SparseSetTests: XCTestCase {
|
|||
XCTAssertEqual(set.sparse[6], 3)
|
||||
XCTAssertEqual(set.sparse[7], nil)
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------------
|
||||
set.remove(at: 1)
|
||||
|
||||
XCTAssertEqual(set.count, num-4)
|
||||
XCTAssertEqual(set.sparse.count, num-4)
|
||||
XCTAssertEqual(set.dense.count, num-4)
|
||||
XCTAssertEqual(set.count, num - 4)
|
||||
XCTAssertEqual(set.sparse.count, num - 4)
|
||||
XCTAssertEqual(set.dense.count, num - 4)
|
||||
|
||||
XCTAssertEqual(set.get(at: 0)?.x, nil)
|
||||
XCTAssertEqual(set.get(at: 1)?.x, nil)
|
||||
|
|
@ -269,9 +259,9 @@ class SparseSetTests: XCTestCase {
|
|||
// ---------------------------------------------
|
||||
set.remove(at: 6)
|
||||
|
||||
XCTAssertEqual(set.count, num-5)
|
||||
XCTAssertEqual(set.sparse.count, num-5)
|
||||
XCTAssertEqual(set.dense.count, num-5)
|
||||
XCTAssertEqual(set.count, num - 5)
|
||||
XCTAssertEqual(set.sparse.count, num - 5)
|
||||
XCTAssertEqual(set.dense.count, num - 5)
|
||||
|
||||
XCTAssertEqual(set.get(at: 0)?.x, nil)
|
||||
XCTAssertEqual(set.get(at: 1)?.x, nil)
|
||||
|
|
@ -303,9 +293,9 @@ class SparseSetTests: XCTestCase {
|
|||
// ---------------------------------------------
|
||||
set.remove(at: 5)
|
||||
|
||||
XCTAssertEqual(set.count, num-6)
|
||||
XCTAssertEqual(set.sparse.count, num-6)
|
||||
XCTAssertEqual(set.dense.count, num-6)
|
||||
XCTAssertEqual(set.count, num - 6)
|
||||
XCTAssertEqual(set.sparse.count, num - 6)
|
||||
XCTAssertEqual(set.dense.count, num - 6)
|
||||
|
||||
XCTAssertEqual(set.get(at: 0)?.x, nil)
|
||||
XCTAssertEqual(set.get(at: 1)?.x, nil)
|
||||
|
|
@ -395,7 +385,6 @@ class SparseSetTests: XCTestCase {
|
|||
XCTAssertEqual(set.get(at: 99)?.x, 99)
|
||||
XCTAssertEqual(set.get(at: 3)?.x, 3)
|
||||
|
||||
|
||||
}
|
||||
|
||||
func testSparseSetRemoveNonPresent() {
|
||||
|
|
@ -429,14 +418,12 @@ class SparseSetTests: XCTestCase {
|
|||
XCTAssertEqual(set.sparse.count, 1)
|
||||
XCTAssertEqual(set.dense.count, 1)
|
||||
|
||||
|
||||
XCTAssertNil(set.remove(at: 1))
|
||||
|
||||
XCTAssertEqual(set.count, 1)
|
||||
XCTAssertEqual(set.sparse.count, 1)
|
||||
XCTAssertEqual(set.dense.count, 1)
|
||||
|
||||
|
||||
XCTAssertTrue(set.get(at: 0) === a)
|
||||
|
||||
XCTAssertEqual(set.count, 1)
|
||||
|
|
@ -445,7 +432,6 @@ class SparseSetTests: XCTestCase {
|
|||
|
||||
func testSparseSetNonCongiuousData() {
|
||||
|
||||
|
||||
var indices: Set<Int> = [0, 30, 1, 21, 78, 56, 99, 3]
|
||||
|
||||
for idx in indices {
|
||||
|
|
@ -499,7 +485,6 @@ class SparseSetTests: XCTestCase {
|
|||
func testSparseSetReduce() {
|
||||
let characters = UnorderedSparseSet<Character>()
|
||||
|
||||
|
||||
characters.insert("H", at: 4)
|
||||
characters.insert("e", at: 13)
|
||||
characters.insert("l", at: 44)
|
||||
|
|
@ -515,8 +500,8 @@ class SparseSetTests: XCTestCase {
|
|||
|
||||
XCTAssertEqual(characters.count, 11)
|
||||
|
||||
let string: String = characters.reduce("") { (res, char) in
|
||||
return res + "\(char)"
|
||||
let string: String = characters.reduce("") { res, char in
|
||||
res + "\(char)"
|
||||
}
|
||||
|
||||
// NOTE: this tests only dense insertion order, this is no guarantee for the real ordering.
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
// Created by Christian Treffs on 10.05.18.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import FirebladeECS
|
||||
import XCTest
|
||||
|
||||
class SystemsTests: XCTestCase {
|
||||
|
||||
|
|
@ -86,7 +86,6 @@ class SystemsTests: XCTestCase {
|
|||
XCTAssertEqual(colorSystem.family.memberIds.count, num)
|
||||
XCTAssertEqual(positionSystem.family.memberIds.count, num)
|
||||
|
||||
|
||||
colorSystem.update()
|
||||
positionSystem.update()
|
||||
|
||||
|
|
@ -152,7 +151,6 @@ class ColorSystem {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
class PositionSystem {
|
||||
let family: Family
|
||||
|
||||
|
|
@ -170,8 +168,8 @@ class PositionSystem {
|
|||
func update() {
|
||||
family.iterate { [unowned self](pos: Position!) in
|
||||
|
||||
let deltaX: Double = self.velocity*((self.randNorm() * 2) - 1)
|
||||
let deltaY: Double = self.velocity*((self.randNorm() * 2) - 1)
|
||||
let deltaX: Double = self.velocity * ((self.randNorm() * 2) - 1)
|
||||
let deltaY: Double = self.velocity * ((self.randNorm() * 2) - 1)
|
||||
let x = pos.x + Int(deltaX)
|
||||
let y = pos.y + Int(deltaY)
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ bundle install
|
|||
swift package update
|
||||
|
||||
# generate project
|
||||
swift package generate-xcodeproj #--xcconfig-overrides settings.xcconfig
|
||||
swift package generate-xcodeproj --enable-code-coverage #--xcconfig-overrides settings.xcconfig
|
||||
|
||||
# add project specialities
|
||||
bundle exec ./prepareXcodeProject.rb
|
||||
|
|
|
|||
Loading…
Reference in New Issue