Skip to content

Instantly share code, notes, and snippets.

View bryanedds's full-sized avatar

Bryan Edds bryanedds

View GitHub Profile
namespace MyGame
open System
open System.Numerics
open Prime
open Nu
type GameplayState =
| Playing
| Quitting
@bryanedds
bryanedds / prime_collections_benchmarks.txt
Last active May 25, 2020 19:24
Prime Collections Benchmarks
Array Compute timings...
Run time: 00:00:00.2584128
Run time: 00:00:00.2624985
Run time: 00:00:00.2559355
Run time: 00:00:00.2585773
UList Compute timings...
Run time: 00:00:00.8482014
Run time: 00:00:00.8477076
Run time: 00:00:00.8356866
Run time: 00:00:00.8330682
namespace OmniBlade
open System
open FSharpx.Collections
open Prime
open Nu
open Nu.Declarative
open OmniBlade
[<AutoOpen>]
module OmniGame =
/// A tic-tac-toe piece, or the absence thereof.
type Piece = U | X | O
/// Tic-tac-toe board position.
type Position = { X : int; Y : int }
/// The game data abstraction.
abstraction Game =
{ FirstPlayerTurn : bool
Board : Map<Position, Piece> }
namespace OmniBlade
open Prime
open Nu
open OmniBlade
[<AutoOpen>]
module OmniGame =
type [<NoComparison>] OmniModel =
{ Omniscreen : Screen
@bryanedds
bryanedds / gist:3481e73bcb257720daf651272edc864b
Last active June 3, 2019 01:29
Latest example of WIP Nelmish.
type [<NoComparison>] OmniModel =
{ Splash : Screen
Title : Screen
TitleGui : Layer
TitlePlay : Entity
TitleCredits : Entity
TitleExit : Entity
Credits : Screen
CreditsGui : Layer
CreditsBack : Entity
[<AutoOpen>]
module GelmDispatcherModule =
type [<NoEquality; NoComparison>] Binding<'m, 's when 's :> Simulant> =
{ Address : Address<obj>
AddressType : Type
MakeMessage : Event<obj, 's> -> 'm option }
type [<NoEquality; NoComparison>] Binding<'m, 'e, 's when 's :> Simulant> =
| Binding of Binding<'m, 's>
@bryanedds
bryanedds / PlatonicSolidsOfSoftwareConstruction.txt
Last active December 12, 2017 20:05
The Platonic Solids of Software Construction and Their Realization in C
No matter the business domain or programming language, programmers always end up needing support for ALL of these things
in some form -
* Resource Semantics (such as RAII in C++, or finalizers in C#)
* Error Semantics (such as exceptions in most languages, or conditions in Common Lisp)
* Algebraic Types (such as structs and unions in C, or records and DUs in F#)
* Data Abstraction (such as that which is often badly entangled within object systems in OO languages)
@bryanedds
bryanedds / Assert.fs
Last active July 12, 2016 16:43
There, screw nunit.
exception AssertException of string
module Assert =
let isTrue value =
if not value then
raise (AssertException "Expected true but got false.")
let isFalse value =
if value then
@bryanedds
bryanedds / Assert.fs
Created July 12, 2016 16:35
There, fuck nunit.
exception AssertionException of string
module Assert =
let isTrue value =
if not value then
raise (AssertionException "Expected true but got false.")
let isFalse value =
if value then