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
# アリコット数列を求めるプログラム | |
# | |
# アリコット数列はある項が前の項の真の約数の和になっているような数列で | |
# す。 | |
# | |
# 276で始まるアリコット数列が有限かどうかはわかっていないらしいです。 | |
require 'prime' | |
def aliquot_function(n) |
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
#!/usr/bin/ruby | |
require 'net/http' | |
def router_online | |
puts "router_online" | |
uri = URI('http://192.168.0.1/hgi-bin/Setup/main_index.cgi') | |
req = Net::HTTP::Post.new(uri) | |
req.basic_auth('admin', 'qtnetbbiq') | |
req.set_form_data({ | |
'o' => 'online', |
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
(setf (get 'A 'adjacent) '(B C) | |
(get 'B 'adjacent) '(A C D) | |
(get 'C 'adjacent) '(A B E) | |
(get 'D 'adjacent) '(B E F) | |
(get 'E 'adjacent) '(C D G) | |
(get 'F 'adjacent) '(D) | |
(get 'G 'adjacent) '(E)) | |
(defun bfs (goal start) | |
(labels ((next-path (path) |
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
;; プリム法による迷路作成。 | |
(defparameter *w* 10) ; 頂点グリッドの幅。 | |
(defparameter *h* 10) ; 頂点グリッドの高さ。 | |
(defparameter *adj* (make-array (* *w* *h*) :initial-element '())) ; 隣接配列。 | |
(defparameter *cost* (make-array (* *w* *h*) :initial-element nil)) | |
;; 印刷に使う文字。 | |
(defconstant +floor-char+ #\・) | |
(defconstant +wall-char+ #\鬱) |
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
;; クラスカル法による迷路作成。 | |
(defparameter *w* 10) ; 頂点グリッドの幅。 | |
(defparameter *h* 10) ; 頂点グリッドの高さ。 | |
(defparameter *edges* '()) ; 辺のリスト。 | |
;; 印刷に使う文字。 | |
(defconstant +floor-char+ #\・) | |
(defconstant +wall-char+ #\鬱) | |
;; 印刷する内容。 |
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
;; 逆削除法による迷路作成。 | |
(defparameter *w* 10) ; 頂点グリッドの幅。 | |
(defparameter *h* 10) ; 頂点グリッドの高さ。 | |
(defparameter *adj* (make-array (* *w* *h*) :initial-element '())) ; 隣接配列。 | |
(defparameter *edges* '()) ; 辺のリスト。 | |
;; 印刷に使う文字。 | |
(defconstant +floor-char+ #\・) | |
(defconstant +wall-char+ #\田) |
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=ja> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>ペントミノパズルソルバー</title> | |
<style> | |
table { border-spacing: 0; border-collapse: separate } | |
table.board-table { margin-bottom: 32px; } | |
table.board-table td { width: 32px; height: 32px; border: 3px solid #ccc; text-align: center; font-family: monospace } |
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
#!/usr/bin/ruby | |
require 'colorize' | |
COLOR_SCHEME = { | |
'F' => [:light_yellow, :light_black], | |
'I' => [:blue, :light_white], | |
'L' => [:yellow, :light_white], | |
'N' => [:light_yellow, :light_black], | |
'P' => [:cyan, :light_white], |
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 <stdio.h> | |
#include <stdlib.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <string.h> | |
#include <netdb.h> |
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
require 'spreadsheet' | |
year, filename = ARGV | |
if year | |
year = year.to_i | |
else | |
year = Time.now.year | |
end | |
unless filename | |
filename = "out.xls" |
NewerOlder