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
(ns sekigahara-shogi-mobile.logic) | |
(defn- moves [koma] | |
(case koma | |
:hu [{:x 0 :y -1 :any? false}] | |
:ky [{:x 0 :y -1 :any? true }] | |
:ke [{:x -1 :y -2 :any? false} | |
{:x 1 :y -2 :any? false}] | |
:gi [ | |
{:x -1 :y -1 :any? false} |
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
cljs.user=> (update-in (vec (filter #(> % 0) [9 8 0 9 8 7 1])) [2] inc) | |
[9 8 10 8 7 1] | |
cljs.user=> (update-in [9 8 0 9 8 7 1] [2] inc) | |
[9 8 1 9 8 7 1] | |
cljs.user=> (update-in (filter #(> % 0) [9 8 0 9 8 7 1]) [2] inc) | |
No protocol method IAssociative.-assoc defined for type cljs.core/LazySeq: (9 8 9 8 7 1) | |
Object.cljs.core.missing_protocol (NO_SOURCE_FILE <embedded>:179:274) | |
Object.cljs.core._assoc (NO_SOURCE_FILE <embedded>:275:436) | |
Function.cljs.core.assoc.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:490:88) | |
Function.cljs.core.update_in.cljs$core$IFn$_invoke$arity$3 (NO_SOURCE_FILE <embedded>:1045:310) |
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
(defn- ninize [list-] | |
(take (count list-) (repeat 9))) | |
(defn- numberize [list-] | |
(map #(read-string (str %)) list-)) | |
(defn- asc-list [num-str] | |
(defn- iter [[f s & r] result] | |
(cond (nil? f) (flatten result) | |
(nil? s) (flatten (conj result f)) |
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
ymd = Time.now.strftime("%Y%m%d") | |
Dir.glob("*").sort.each_with_index do |file, idx| | |
File.rename(file, ymd + format("%06d", idx) + file[14, file.length]) | |
end |
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 | |
level1 = [] | |
level2 = [] | |
done = 0 | |
sum = STDIN.gets.to_i | |
num = STDIN.gets | |
while a = STDIN.gets | |
a = a.to_i | |
level2.each{|x| done += 1 if x == a } |
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
// | |
// UIView+adjustText.m | |
// | |
// Created by J_ogawa on 2014/04/04. | |
// Copyright (c) 2014年 J_ogawa. All rights reserved. | |
// | |
#import "UIView+adjustTextLabel.h" | |
@implementation UIView (adjustTextLabel) |
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
#!/bin/bash | |
if [ $# -gt 10 ] | |
then | |
echo -n "ggr $# possibilities? (y or n)" | |
read ans </dev/tty | |
if [ $ans != 'y' ] | |
then | |
exit 0 | |
fi |
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
// | |
// UIView+adjustSubView.m | |
// | |
// Created by J_ogawa on 2014/01/31. | |
// Copyright (c) 2014年 J_ogawa. All rights reserved. | |
// | |
#import "UIView+adjustSubView.h" | |
@implementation UIView (adjustSubView) |
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
// | |
// UIView+adjustSubView.h | |
// | |
// Created by J_ogawa on 2014/01/31. | |
// Copyright (c) 2014年 J_ogawa. All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
typedef enum { |
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
// | |
// UIScrollView+addView.m | |
// | |
// Created by J_ogawa on 2013/12/24. | |
// Copyright (c) 2013年 J_ogawa. All rights reserved. | |
// | |
#import "UIScrollView+addView.h" | |
@implementation UIScrollView (addView) |
NewerOlder