Skip to content

Instantly share code, notes, and snippets.

#途中であきらめました
def getbaisu(n,na)
head = n.gsub("x","0").to_i
st = 0
ed = fact(n.count("x")) #10のx乗を求めたい
return 0
end
def fact(n)
return 1 if n == 0
#あってるかわからない(- ^ -)
def yakusu(n)
n = n.to_i
st = 1
g = 0
lst = []
loop {
if (n % st == 0) then
lst.push(st)
@yowasou
yowasou / fib.rb
Last active August 29, 2015 14:21
Hamamatsu.rb 52 フィボナッチ数列
def fib(x)
#ゼロ始まり
a = 0 #ふたつ前の結果
b = 1 #ひとつ前の結果
c = 1 #現在の結果
for i in 0..x-1
c = a + b
a = b
b = c
end
@yowasou
yowasou / gist:1b52383f26d7076017e9
Created March 14, 2015 09:15
MMD4Mecaniumで読み込んできたモデルに、カメラ位置用の空ゲームオブジェクトを追加する
using UnityEngine;
using System.Collections;
using UnityEditor;
using System.Collections.Generic;
public class CreateCameraPos : EditorWindow
{
public class CameraPos
{
public string BoneNameJP;
@yowasou
yowasou / gist:0882e2e330cad2da209e
Created March 14, 2015 07:22
RayBlackOut.cs Oclusカメラ用のコード。当たり判定があるものに近づきすぎると徐々にブラックアウト&FOV減少して、めり込みされる状態の描画を防ぐ
using UnityEngine;
using System.Collections;
public class RayBlackOut : MonoBehaviour {
/// <summary>暗転用黒テクスチャ</summary>
private Texture2D blackTexture;
/// <summary>フェード中の透明度</summary>
private float fadeAlpha = 0;
/// <summary>フェード中かどうか</summary>
private bool isFading = false;