ryan@server2:~/Go/src/github.com/ryanmr/wargame-go$ $GOPATH/bin/wargame-go
WarGame Go
4. done | et = 10s; g = 128691; s = 12.81850 g/ms; t = 875; 3;
---
Samples: 875 collected
Mean: 12.82404
Standard Deviation: 0.10184
Coefficient of Variation: 0.00794
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
func get_median(samples []float64) float64 { | |
sort.Float64s(samples) | |
l := len(samples) | |
r := 0.0 | |
if (l % 2 == 1) { | |
r = samples[int(math.Floor(float64(l/2)))] | |
} else { | |
s1 := l/2 | |
s2 := s1 + 1 | |
r = float64((samples[s1] + samples[s2])/2.0) |
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
package main | |
import ( | |
"golang.org/x/tour/wc" | |
"strings" | |
) | |
func WordCount(s string) map[string]int { | |
count := map[string]int{} | |
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
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func Sqrt(x float64) (float64, int) { | |
z, l, d := 1.0, 1.0, 1.0 | |
i := 0 |
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
import java.io.*; | |
import java.net.*; | |
class NetworkApp { | |
public static int payload = 10000000; | |
// public static int payload = 1000000; | |
// public static int payload = 100000; | |
public static int expected_rounds = 10; |
To compile:
javac NetworkApp.java
To run:
There are four CLI flags: 1: transport mode: tcp or udp 2: application mode: s or c (for client or server)
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
/* | |
create_graph | |
1. sets basic defaults on all nodes | |
2. finds the root nodes and sets them to READY | |
3. finds the number of parents of each node | |
*/ | |
void create_graph(node_t **nodes, int node_count) { | |
// initially set all to inelgible | |
int g = 0; |
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
; income-tax | |
; arguments: 3 | |
; income - the income on which to be taxed | |
; algorithm: | |
; first 35k @ 15% | |
; second 65k @ 25% | |
; third 10k @ 35% | |
; state-first 50k @ 5% | |
(define (income-tax income) |
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
{ | |
"id": null, | |
"title": "sometitle", | |
"subtitle": "somesubtitle", | |
"number": "4124", | |
"series_id": 3, | |
"state": "draft", | |
"hidden": false, | |
"nsfw": false, | |
"created_at": null, |