This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ops::{FnMut}; | |
pub trait Automaton<'f, I, A> { | |
fn transition(&'f mut self, input: &I) -> A; | |
} | |
impl<'f, I, A> Automaton<'f, I, A> for FnMut(&I) -> A { | |
fn transition(&'f mut self, input: &I) -> A { | |
self(&input) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub mod automaton; | |
pub mod state_machine; | |
pub mod move_state_machine; | |
#[cfg(test)] | |
mod tests { | |
use automaton::Automaton; | |
#[test] | |
fn fnmut_automaton_test() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ops::{FnMut}; | |
pub trait Automaton<'f, I, A> { | |
fn transition(&'f mut self, input: &I) -> A; | |
} | |
impl<'f, I, A> Automaton<'f, I, A> for FnMut(&I) -> A { | |
fn transition(&'f mut self, input: &I) -> A { | |
self(&input) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ops::Fn; | |
use automaton::Automaton; | |
pub struct StateMachine<'f, I: 'f, A: 'f, C: 'f> where C: Fn(&I)->(A, &'f C) | |
{ | |
current_state: &'f Fn(&I)->(A, &'f C) | |
} | |
impl <'f, I, A, C> StateMachine<'f, I, A, C> where C: Fn(&I)->(A, &'f C) { | |
pub fn new(init_state: &'f C) -> StateMachine<'f, I, A, C> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let vertexVector = rest | |
.windows(2) | |
.map(|vertices| { | |
let arr = [ | |
PosColor{ | |
position: [first[0], first[1], 0.0_f32], | |
color: color | |
}, | |
PosColor{ | |
position: [ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error[E0161]: cannot move a value of type dyn for<'r> std::ops::FnOnce(&'r mut nphysics2d::world::World<f32>) + std::marker::Send: the size of dyn for<'r> std::ops::FnOnce(&'r mut nphysics2d::world::World<f32>) + std::marker::Send cannot be statically determined | |
--> src/physics_world_resource.rs:54:13 | |
| | |
54 | request(&mut self.world); | |
| ^^^^^^^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
error[E0599]: no method named `call_once` found for type `std::boxed::Box<dyn for<'r> std::boxed::FnBox<(&'r mut nphysics2d::world::World<f32>,), Output=()> + std::marker::Send>` in the current scope | |
--> src/physics_world_resource.rs:57:21 | |
| | |
57 | request.call_once(&mut self.world); | |
| ^^^^^^^^^ | |
| | |
= note: the method `call_once` exists but the following trait bounds were not satisfied: | |
`&std::boxed::Box<dyn for<'r> std::boxed::FnBox<(&'r mut nphysics2d::world::World<f32>,), Output=()> + std::marker::Send> : std::ops::FnOnce<_>` | |
`&mut std::boxed::Box<dyn for<'r> std::boxed::FnBox<(&'r mut nphysics2d::world::World<f32>,), Output=()> + std::marker::Send> : std::ops::FnOnce<_>` | |
`&dyn for<'r> std::boxed::FnBox<(&'r mut nphysics2d::world::World<f32>,), Output=()> + std::marker::Send : std::ops::FnOnce<_>` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Overview | |
====== | |
While the [ants of the highlands](https://codegolf.stackexchange.com/questions/135102/formic-functions-ant-queen-of-the-hill-contest) gather food and walk around each other, their distant cousins live in the forests below, growing fungus and aggressively raiding the ground and other nests for food. But like their highland counterparts, they want food, and they have armies of workers at their disposal to get at it. | |
The Arena | |
------ | |
The arena is a torodial 1000*2500 grid of squares. Each cell has one of eight colors, and at most one object at any one time. There are three types of objects of significance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GPU HANG: ecode 9:0:0x8ed9fff2, in leelaz [9165], reason: Hang on rcs0, action: reset | |
Kernel: 4.15.0-17.2-liquorix-amd64 | |
Time: 1524186864 s 634062 us | |
Boottime: 6582 s 751188 us | |
Uptime: 6580 s 924628 us | |
Active process (on ring render): leelaz [9165], score 0 | |
Reset count: 0 | |
Suspend count: 0 | |
Platform: KABYLAKE | |
PCI ID: 0x5916 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env julia | |
import LibArchive | |
# Load the moby dick source into one buffer | |
moby = read("mobydick") | |
# Generate random fuzz mutation | |
mutate(genome) = (genome .+ sprand(UInt8, size(genome)[1], .000001)) .% 256 |