Skip to content

Instantly share code, notes, and snippets.

View Tokeiya's full-sized avatar

Tokeiya3 Tokeiya

  • The Open University of Japan
View GitHub Profile
use std::marker::PhantomData;
pub trait TypeArgConverter<T, U> {
fn convert(scr: T) -> U;
}
pub trait AssociatedConverter {
type Target;
type Output;
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<style>
.step {
margin-bottom: 40px;
border-bottom: 2px solid black;
use std::borrow::Borrow;
use std::cell::{Cell, Ref, RefCell, RefMut};
#[derive(Debug)]
struct Sample(i32);
struct Envelope(Sample);
fn main() {}

大砲ゲームに関する一考察

統合元帥曰く『百発百中の一砲能く百発一中の敵砲百門に対抗し得る』と言ってた。こいつを以下の通りモデル化する。

  1. 軍Aが命中率1%の砲を100門有し、軍Bが命中率100%の砲を1門有している。
  2. 互いに全く同じタイミングで砲撃を開始する。
  3. 攻撃の結果は命中か外れのいずれかに収束し、命中の場合は砲が破壊される。従って次回の砲撃には参加できない。
  4. 砲が破損した状態は存在せず健在か破壊されたかのいずれかとなる。
@Tokeiya
Tokeiya / Raw.txt
Last active December 25, 2020 06:54
# はじめに
実際の入力文字は*RAW*でTextを出してみてください。
# 改行
このように、改行する前に半角スペースを2つ入れると
任意の場所で
改行できます。
@Tokeiya
Tokeiya / EquatabilityTester.cs
Last active September 4, 2020 05:16
Draft of arbitrary Type's typically "Equatability" test runner.
using System;
using System.Collections.Generic;
using Xunit;
using Xunit.Sdk;
using ChainingAssertion;
namespace SharpSourceFinderCoreTests
{
/// <summary>
@Tokeiya
Tokeiya / dynamic.cs
Created September 2, 2020 11:12
relationship of dynamic parameter and visibility.
using static System.Console;
namespace Playground
{
public class OuterClass
{
public OuterClass(int value) => Value = value;
public int Value { get; }
using System;
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;
using static CSfmt.Defination;
namespace CSfmt
{
public static unsafe class SfmtNative
{
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System;
using System.Collections.Generic;
using System.Linq;
namespace ConsoleApp1
{
[MaxIterationCount(100_000)]
[CsvMeasurementsExporter]
@Tokeiya
Tokeiya / Benchmark.cs
Created June 29, 2020 07:48
DIv bench
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;
using System;
namespace ConsoleApp1
{
public class DivBench
{
const int Base = 3;
const int Threshold = 10_000_000;