Skip to content

Instantly share code, notes, and snippets.

using System;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
class Cell {
public enum State {
None,
Mine,
}
@MikuroXina
MikuroXina / bit_iter.rs
Last active September 25, 2020 01:02
Iterator for Binary Indexed Tree
struct BITIter {
start: i64,
end: i64
}
impl BITIter {
fn new(start: usize, end: usize) -> Self {
BITIter { start: start as i64, end: end as i64 }
}
}
@MikuroXina
MikuroXina / 2 link robot arm.jl
Created September 28, 2019 11:20
Simulation of 2 link robot arm
@MikuroXina
MikuroXina / Hamlet.cs
Last active January 6, 2022 02:09
The Connected Four game.
using System;
using System.Diagnostics;
using System.Linq;
using System.Text.RegularExpressions;
using Internal;
enum Cell {
Empty,
Black,
White,
@MikuroXina
MikuroXina / Exported.vssettings
Created November 27, 2019 06:38
My vssettings
<UserSettings><ApplicationIdentity version="16.0"/><ToolsOptions><ToolsOptionsCategory name="Environment" RegisteredName="Environment"/><ToolsOptionsCategory name="TextEditor" RegisteredName="TextEditor"><ToolsOptionsSubCategory name="Basic" RegisteredName="Basic" PackageName="Text Management Package"><PropertyValue name="TabSize">4</PropertyValue><PropertyValue name="ShowChanges">true</PropertyValue><PropertyValue name="AutoListMembers">true</PropertyValue><PropertyValue name="ShowPreview">true</PropertyValue><PropertyValue name="ShowMarks">true</PropertyValue><PropertyValue name="IndentStyle">2</PropertyValue><PropertyValue name="ShowCaretPosition">true</PropertyValue><PropertyValue name="HideAdvancedMembers">false</PropertyValue><PropertyValue name="ShowNavigationBar">true</PropertyValue><PropertyValue name="UseMapMode">false</PropertyValue><PropertyValue name="VirtualSpace">false</PropertyValue><PropertyValue name="ShowAnnotations">true</PropertyValue><PropertyValue name="ShowVerticalScrollBar">true</Prop
export interface RotOffset {
x: number;
y: number;
}
export interface RotMat {
upToLeft: RotOffset[];
leftToDown: RotOffset[];
downToRight: RotOffset[];
rightToUp: RotOffset[];
@MikuroXina
MikuroXina / Board.cpp
Created January 28, 2020 16:18
Tic tac toe
#include "Board.hpp"
void defaultEndGame(Judge) {}
Board make() {
Board made{};
for (int y = 0; y < 3; ++y) {
for (int x = 0; x < 3; ++x) {
made.cells[x][y] = Cell::Empty; // マスめの なかみは カラッポ!
}
#ifndef EVENT_SOURCE_HPP
#define EVENT_SOURCE_HPP
#include <functional>
#include <vector>
template<class ...Args>
class EventSource {
public:
using Listener = std::function<void(Args...)>;
// イベント駆動型プログラミング言語 Alyr (開発予定)
/*
他の言語にホストしてもらって動作するスクリプト言語
各イベントはシングルスレッド上で非同期実行される
状態 Outside に発行されるイベントはホストから購読できる
*/
value VirusKind = enum { Tiny, Normal, Huge, };
value Position = enum { Holder, Board = struct { int x; int y }, };
impl Position {
enum Expr {
Num(i64),
Op(Box<Expr>, fn(i64, i64) -> i64, Box<Expr>),
}
#[derive(Debug)]
enum Token {
Num(i64),
Add,
Sub,