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); | |
} |
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
fun random(min: Double = 0.0, max: Double = 1.1) = (Math.random() * (max - min + 1)) + min | |
fun random(min: Int = 0, max: Int = 1) = ((Math.random() * (max - min + 1)) + min).toInt() | |
fun randomASCII(upper: Boolean = true) = (if (upper) random(65, 90) else random(97, 122)).toChar() | |
fun randomString(n: Int = 5) = (1..n).map { randomASCII() }.joinToString(separator = "") | |
const val answer = "CAT" |
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
// http://krr.blog.shinobi.jp/javafx/javafx%203d%20%E5%BA%A7%E6%A8%99%E5%A4%89%E6%8F%9B%EF%BC%88%E5%B9%B3%E8%A1%8C%E7%A7%BB%E5%8B%95%E3%83%BB%E5%9B%9E%E8%BB%A2%E3%83%BB%E6%8B%A1%E7%B8%AE%EF%BC%89 | |
// https://gamedevelopment.tutsplus.com/ja/tutorials/introduction-to-javafx-for-game-development--cms-23835 | |
import javafx.animation.AnimationTimer | |
import javafx.application.Application | |
import javafx.geometry.Point2D | |
import javafx.scene.Group | |
import javafx.scene.Scene | |
import javafx.scene.canvas.Canvas | |
import javafx.scene.canvas.GraphicsContext | |
import javafx.scene.paint.Color |
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
import javafx.animation.AnimationTimer | |
import javafx.application.Application | |
import javafx.scene.Group | |
import javafx.scene.Scene | |
import javafx.scene.canvas.Canvas | |
import javafx.scene.canvas.GraphicsContext | |
import javafx.scene.paint.Color | |
import javafx.scene.text.Font | |
import javafx.stage.Stage |
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
/*jshint esversion: 6 */ | |
function setup() { | |
createCanvas(720, 720, WEBGL); | |
rectMode(CENTER); | |
noStroke(); | |
colorMode(HSB, 255); | |
} | |
function thing(q) { | |
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> | |
<svg width="1024" height="1024" font-family="sans-serif" font-size="10" text-anchor="middle"></svg> | |
<script src="https://d3js.org/d3.v4.min.js"></script> | |
<script> | |
var svg = d3.select("svg"), | |
width = +svg.attr("width"), | |
height = +svg.attr("height"); | |
var format = d3.format(",d"); |
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
# -*- coding:utf-8 -*- | |
""" 数あてゲーム """ | |
import random | |
class GuessTheNumber: | |
""" 数あてゲーム """ | |
VERSION = 1.0 |
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
# -*- coding:utf-8 -*- | |
""" リスト内包表記で、タプルデータからクラス型で取り出す。""" | |
class Person: | |
def __init__(self, name, age: int, email): | |
self.name = name | |
self.age = age | |
self.email = email |