This file contains hidden or 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
/// Epistomological puzzle implemented in Rust. | |
/// | |
/// There are two players in cooperative game. They are given a shared bipartite | |
/// graph and secretly assigned a vertex each. They need to determine if those | |
/// vertices are connected with an edge, and to that end players can exchange | |
/// their probability estimates. By Aumann's agreement theorem, they will agree | |
/// eventually. | |
/// | |
/// Thought up and implemented by | |
/// (c) ProgramCrafter, 2025 |
This file contains hidden or 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
module Main | |
%default total | |
data Bijection : Type -> Type -> Type where | |
||| A bijection between two types. | |
||| @ a the first type | |
||| @ b the second type | |
||| @ fwd mapping from first type to the second |
This file contains hidden or 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::mem::*; | |
use std::ptr::read_unaligned; | |
use std::sync::atomic::*; | |
use std::thread::*; | |
use std::time::*; | |
#[cfg(windows)] | |
mod our_mem { | |
use windows::prelude::*; |
This file contains hidden or 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
#![allow(incomplete_features)] | |
#![feature(generic_const_exprs)] | |
#![feature(maybe_uninit_write_slice, maybe_uninit_array_assume_init)] | |
use std::{fmt::{Display, Formatter}, mem::MaybeUninit}; | |
use is_true::IsTrue; | |
use size_def::{Bound, CtSize, Erased, Fixed}; | |
mod is_true { | |
pub trait IsTrue<const COND: bool> {} |
This file contains hidden or 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
forall X -> tuple change_tuple(tuple t, int pos, X value) asm(t value pos) "SETINDEXVAR"; | |
tuple get_c7() asm "c7 PUSHCTR"; | |
slice vm::invoke_get_addr(slice owner_address, tuple c7, cell master_data, cell master_code) asm | |
"CTOS // owner_addr c7 md mc" | |
"2 PUSHINT // owner_addr c7 md mc args" | |
"103289 PUSHINT // owner_addr c7 md mc args get_jwa_method_id" | |
"5 0 REVERSE DUMPSTK // owner_addr get_jwa_method_id args mc md c7" | |
"53 RUNVM DUMPSTK // address exit_code c4' c5'" | |
"3 BLKDROP // address"; |
This file contains hidden or 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 { Address, beginCell, Cell, Dictionary, Contract, ContractProvider, contractAddress, Slice, TupleBuilder, toNano } from "ton-core"; | |
import { compileFunc } from '@ton-community/func-js'; | |
import { Blockchain } from "@ton-community/sandbox"; | |
const stdlib_fc_code = ` | |
;; Standard library for funC | |
;; | |
{- | |
# Tuple manipulation primitives |
This file contains hidden or 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
# Hell is Game Theory Folk Theorems | |
# https://www.lesswrong.com/posts/d2HvpKWQ2XGNsHr8s/hell-is-game-theory-folk-theorems | |
import random | |
import math | |
def minimize(prev_list, prev_temp): | |
return 30 |
This file contains hidden or 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
from tonsdk.boc import Builder, Cell, begin_dict | |
from tonsdk.utils import Address | |
import threading | |
import traceback | |
import hashlib | |
import base64 | |
import sys |
This file contains hidden or 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
#![feature(bench_black_box)] | |
use std::ptr::{read, write}; | |
use std::hint::black_box; | |
use std::mem::size_of; | |
use std::any::Any; | |
trait Animal: Any { | |
fn say(&self) -> &'static str; | |
fn name(&self) -> &'static str; |