This file contains 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
function initCanvas(w, h) { | |
var canvas = document.getElementById("myCanvas"); | |
canvas.width = w; | |
canvas.height = h; | |
canvas.style.width = w + "px"; | |
canvas.style.height = h + "px"; | |
return canvas.getContext('2d'); | |
} | |
function main() { |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>モンテカルロ法</title> | |
<style> | |
canvas { | |
width :200px; |
This file contains 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
<title>CodingChallenge40_WordCounter</title> | |
</head> | |
<body> | |
<h1>Word Counter</h1> |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>pixel sort</title> | |
</head> | |
<body> | |
<h1>Pixel sort</h1> | |
<canvas id="c" width="640" height="320"></canvas> |
This file contains 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
! Molokai theme | |
*xterm*background: #101010 | |
*xterm*foreground: #d0d0d0 | |
*xterm*cursorColor: #d0d0d0 | |
*xterm*color0: #101010 | |
*xterm*color1: #960050 | |
*xterm*color2: #66aa11 | |
*xterm*color3: #c47f2c | |
*xterm*color4: #30309b | |
*xterm*color5: #7e40a5 |
This file contains 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
# include <Siv3D.hpp> | |
#include <iostream> | |
#include <string> | |
#include <random> | |
using namespace std; | |
inline double myrand(double min, double max) | |
{ |
This file contains 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
#include "stdafx.h" | |
inline void _limit(Vec2& v, double a) | |
{ | |
double b = v.lengthSq(); | |
if (b > a*a) { | |
v /= sqrt((float)b); | |
} | |
v *= a; | |
} | |
inline double heading(Vec2 v) |
This file contains 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
#include <Siv3D.hpp> | |
#define _USE_MATH_DEFINES | |
#include <math.h> | |
// p5.js helper functions for OpenSiv3D | |
namespace p5h { | |
template <typename T> | |
inline T map(T n, T start1, T stop1, T start2, T stop2) noexcept { | |
return ((n - start1) / (stop1 - start1)) * (stop2 - start2) + start2; | |
} | |
inline void limit(Vec2& v, double a) noexcept { |
This file contains 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
# include <Siv3D.hpp> // OpenSiv3D v0.1.5 | |
// Polygonクラスを使った描画例と、 | |
// 頂点配列とPolygonクラスを組み合わせた例。 | |
void Main() | |
{ | |
Window::Resize(1280, 720); | |
const Font font(30); | |
// OpenSiv3Dにはポリゴンクラスが用意されているので多角形を作れます。 |
This file contains 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
/// <reference path="../../p5.global-mode.d.ts" /> | |
// Excercise_9.6 | |
// ok 各世代でターゲットに最も近い句を表示 | |
// ok 世代数表示 | |
// ok 平均適応度(fitness) | |
function newChar() { | |
let c = floor(random(64, 122)); // ascii code. | |
c = (c === 64) ? 32 : c; // @ mark to space. | |
return String.fromCharCode(c); | |
} |
OlderNewer