Skip to content

Instantly share code, notes, and snippets.

@veeneck
veeneck / navmesh.swift
Created October 12, 2016 19:49
GameplayKit Pathfinding
//
// PKNavmesh.swift
// PathKit
//
// Created by Ryan Campbell on 9/12/16.
// Copyright © 2016 Phalanx Studios. All rights reserved.
//
import SpriteKit
import GameplayKit
@JadenGeller
JadenGeller / Matrix Examples.swift
Last active August 10, 2023 10:03
Matrices in Swift
// Numerical matrix examples
let x: Matrix = [[10, 9, 8], [3, 2, 1]]
let y: Matrix = [[1, 2, 3], [4, 5, 6]]
let z: Matrix = [[1, 2], [3, 4], [5, 6]]
x + y // [[11, 11, 11], [7, 7, 7]]
x * y // [[10, 18, 24], [12, 10, 6]]
2 * x // [[20, 18, 16], [6, 4, 2]]
y ** z // [[22, 28], [49, 64]]