[dependencies]
tokio = { version = "1.23.0", features = ["time", "macros", "rt-multi-thread"] }
または
#include <stdio.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <string.h> | |
#include <arpa/inet.h> | |
#include <errno.h> | |
#include <thread> | |
#include <unistd.h> | |
static void client(int s); |
%% SameGame solver by Prolog | |
%% +-+-+-+ +-+-+-+ +-+-+-+ +-+-+-+ | |
%% |g|b|r| | | |r| | | | | | | | | | |
%% +-+-+-+ +-+-+-+ +-+-+-+ +-+-+-+ | |
%% |g|g|r| -> | |b|r| -> | |r| | -> | | | | | |
%% +-+^+-+ +-+-+-+ +-+-+-+ +-+-+-+ | |
%% |r|b|b| |r|b|b| |r|r| | | | | | | |
%% +-+-+-+ +-+-+^+ +^+-+-+ +-+-+-+ |
module Tetris (main) where | |
import Graphics.UI.Gtk | |
import Graphics.UI.Gtk.Gdk.GC | |
import Control.Monad.Trans (liftIO) | |
import Control.Monad (forM_, when) | |
import Data.Text (unpack) | |
import Data.IORef | |
import System.Random (randomR, getStdRandom) | |
-- ゲーム状態を表す型 |
module Tetris (main) where | |
import Graphics.UI.Gtk | |
import Graphics.UI.Gtk.Gdk.GC | |
import Control.Monad.Trans (liftIO) | |
import Control.Monad (forM_) | |
-- テトリスのブロックを表す型 (EはEmpty, Gはボード周囲の番兵用) | |
data Block = I | O | S | Z | J | L | T | E | G deriving (Show, Eq) | |
-- ボードを表す型 |
(* Snake Game by OCaml *) | |
(* see) http://newral.info/publics/index/79 *) | |
(* column No.19 - No.23 *) | |
let cls () = print_string "\x1B[2J";; | |
let set_pos (x,y) = | |
print_string ("\x1b[" ^ string_of_int y ^ ";" ^ string_of_int x ^ "H");; | |
let show_board () = |
;; 8-Queens solver program | |
;; see) http://newral.info/publics/index/79 | |
;; colum No.14 - No.18 | |
(def board-size 8) | |
(defn on-board? [[row col]] | |
(and (>= row 1) (<= row board-size) (>= col 1) (<= col board-size))) | |
(defn unique-row? [[row _] queens] |
-module(eularProblem3). | |
-export([answer/0]). | |
%% Answer of Eular Problem 3 "Largest prime factor" | |
answer() -> largePrimeFactorOf(600851475143). | |
largePrimeFactorOf(X) -> largePrimeFactorOf(X, 2). | |
largePrimeFactorOf(X, P) -> |