Skip to content

Instantly share code, notes, and snippets.

Yuya Kono takoeight0821

Block or report user

Report or block takoeight0821

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@takoeight0821
takoeight0821 / bf.rs
Created Dec 13, 2017
RustでBFインタプリタ(なんもわからん)
View bf.rs
use std::io::{self, Read, stdin};
use std::collections::HashMap;
#[derive(Debug)]
struct BFM {
program: String,
tape: Vec<i32>,
ip: usize,
dp: usize,
braces: HashMap<usize, usize>,
View hard.c
#include <stdio.h>
int main(void) {
char flag[12];
flag[0] = 'F';
flag[1] = 'L';
flag[2] = 'A';
flag[3] = 'G';
flag[4] = '{';
flag[5] = 'h';
View easy.c
#include <stdio.h>
int main(void) {
char* flag = "FLAG{hello_world}";
puts("hello");
return 0;
}
@takoeight0821
takoeight0821 / othello.c
Last active May 22, 2018
『実用Common Lisp』に出てくるオセロをCに移植(単純なCPU対戦まで)
View othello.c
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#define EMPTY 0
#define BLACK 1
#define WHITE 2
#define OUTER 3
@takoeight0821
takoeight0821 / oxgame.lisp
Created Jul 5, 2017
マルバツゲーム
View oxgame.lisp
(defparameter *board*
(list #\_ #\_ #\_
#\_ #\_ #\_
#\_ #\_ #\_))
(defun show-board (board)
(format t " 012~%")
(format t "0 ~{~a~}~%" (subseq board 0 3))
(format t "1 ~{~a~}~%" (subseq board 3 6))
(format t "2 ~{~a~}~%" (subseq board 6 9)))
View malgo.lisp
(ql:quickload '(:trivia.level2 :serapeum :trivia.ppcre :alexandria) :silent t)
(in-package :cl-user)
(defpackage :malgo
(:use :cl :trivia.level2 :trivia.ppcre)
(:export :parse))
(in-package :malgo)
(alexandria:define-constant +number-re+ "^(\\+|\\-|)([0-9]+(?:\\.[0-9]+|))" :test #'string=)
(alexandria:define-constant +number-without-sign-re+ "^([0-9]+(?:\\.[0-9]+|))" :test #'string=)
@takoeight0821
takoeight0821 / hello_glut.lisp
Created Dec 14, 2016
[GLUTによる「手抜き」OpenGL入門]をcommon lispで
View hello_glut.lisp
(ql:quickload :cl-glut)
(defclass main-window (glut:window)
()
(:default-initargs :pos-x 100 :pos-y 100 :width 320 :height 240 :title "hello opengl"
:mode '(:single :rgba)))
(defmethod glut:display-window :before ((w main-window))
(gl:clear-color 1 1 1 1))
@takoeight0821
takoeight0821 / map.cc
Last active Nov 12, 2016
Map function on C++
View map.cc
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <iterator>
template <class T, class F>
decltype(auto) map(const std::vector<T> a, const F fn) {
std::vector<decltype( fn(a[0]) )> result = {};
std::transform(a.cbegin(), a.cend(), std::back_inserter(result), fn);
@takoeight0821
takoeight0821 / dual_number.ex
Created Oct 25, 2016
Dual Number on Elixir
View dual_number.ex
import Kernel, except: [+: 1, +: 2, -: 1, -: 2, *: 2, /: 2]
defprotocol Arithmetic do
def left + right
def left - right
def left * right
def left / right
def +value
def -value
end
@takoeight0821
takoeight0821 / interp.lisp
Created Aug 6, 2016
Mini Lisp Interpreter 0.0.1
View interp.lisp
(ql:quickload :alexandria)
(defparameter *globol-env* (make-hash-table))
(defun bindp (expr env)
(second (multiple-value-list (gethash expr env))))
(defun get-env (expr env)
(gethash expr env))
(defun set-env (var val env)
(setf (gethash var env) val))
You can’t perform that action at this time.