「Loop」を含む日記 RSS

はてなキーワード: Loopとは

2011-05-19

「これからの「パスワード」の話をしよう」のバグについて突っ込む

Web屋のネタ帳( http://neta.ywcafe.net/ )様の

これからの「パスワード」の話をしよう( http://neta.ywcafe.net/001184.html )で

紹介されているパスワードハッシュ化のバグについて突っ込んでみる

バグといっても大きなものではな

 「1回ハッシュ化を解読できただけ、プレーンパスワードを入手することが可能である

というものである

問題の部分はここ

    /**
     * 平文のパスワードハッシュ&stretchするメソッドです。
     * loop回数は1000としていますが、999でも1001でもお好みでどうぞ。
     * ただしループ回数は処理時間に直結しますのでほどほどの数値で。
     */
    private static final String hashAndStretch(String plainPasswd, String salt) {
        int loop = 1000;
        String hashedPasswd = "";
        for (int i = 0; i < loop; i++) {
            hashedPasswd = DigestUtils.sha256Hex(hashedPasswd + plainPasswd + salt);
        }
        return hashedPasswd;
    }

ここのロジックトレースしてみると

凡例

プレーンパスワードPASSWORD

ソルト:SSSSSSSS

トレース

最終的なハッシュパスワードが「XXXXXXXX」とする

XXXXXXXX ←  DigestUtils.sha256Hex("YYYYYYYY" + "PASSWORD" + "SSSSSSSS")

クラッカーがXXXXXXXXXのハッシュ値を解析し、元の文字列が「YYYYYYYYPASSWORDSSSSSSSS"」と判明したとする。

この時点で元文字列の中にプレーンパスワードが含まれていることになる。

また、ハッシュ化された文字列には「0123456789abcdef」の文字しか含まれておらず、

 「それ以外の文字が含まれていた場合容易にプレーンパスワードはないか

と推測可能である

一般的なパスワードには少なからず「0123456789abcdef」以外の文字が含まれているだろうし、

意味のある言葉パスワードに使っていた場合一目瞭然だ。

上記のことをふまえてプログラムを修正すると。。

    /**
     * 平文のパスワードハッシュ&stretchするメソッドです。
     * loop回数は1000としていますが、999でも1001でもお好みでどうぞ。
     * ただしループ回数は処理時間に直結しますのでほどほどの数値で。
     */
    private static final String hashAndStretch(String plainPasswd, String salt) {
        int loop = 1000;
        String hashedPasswd = DigestUtils.sha256Hex(plainPasswd + salt);;
        for (int i = 0; i < loop; i++) {
            hashedPasswd = DigestUtils.sha256Hex(hashedPasswd + DigestUtils.sha256Hex(salt + i));
        }
        return hashedPasswd;
    }

プレーンパスワードループの外でハッシュ化し、

またソルトを毎回違う値にハッシュ変換することにより

元の文字列の推測を行いにくく修正した

2010-04-21

http://anond.hatelabo.jp/20100421184707

loop→何度も同じことを繰り返す

じゃなくて、

loop→回ってる→クルクルパー

ってことだろ

2010-02-25

世界中ネットでキムヨナの不正が疑われている!」というけれど

どこの話なんだろうか?

「Kim Yu-Na」で検索して昨日のことに関するいくつかの記事を探した。次の四つの記事を見つけた。

しかし一番目のサイトでふれられているぐらい。

But at least one veteran skater, former Canadian medallist Elvis Stojko, suggested that Kim's marks were too high. He noted that Asada had successfully landed a triple Axel - she's the only woman who executes them regularly in competition - and got fewer marks than Kim's easier triple Lutz.

The argument is similar to the one over whether American Evan Lysacek should have won the gold medal without having landed a quad like his competitor Evgeni Plushenko.

"Yu-Na Kim is way too far ahead. I don't agree with that," said Stojko. "She skated great. Don't get me wrong, she's awesome. But for Mao to do an awesome triple Axel like that, a triple [Axel] is worth way more than a triple Lutz, triple toe."

http://www.ctvolympics.ca/figure-skating/news/newsid=50985.html

でもコメントでは批判されている。

Stojko is WRONG again! I can't believe how he's embarassing himself with his commentary. Asada's triple Axel-double toe combo is worth LESS than Kim's triple Lutz-triple toe combo. In fact for the GOE(Grade of Execution), Asada only received .60 extra for ther opening combo last night whereas Kim received 2.00 bonus for her's.

cw_pianoman22@yahoo.ca

triple axel itself does have higher score than triple lutz, but Mao combined it with double toe loop while Yuna Kim's combination was triple-triple. And she executed it way better than anyone else. Just doing one difficult jump doesn't make a great skater. How you do it also matters. Yuna Kim's program is higher difficulty overall, therefore has higher basic score than anyone else's program. And she got higher execution mark for the quality. If Stojko wants to see more jump, he can go to Cirque du soleil. Stop insulting a quality program and great effort of other athlets.

hohoho323

まじめに全部読んだ訳じゃないから絶対という訳ではないけど、コメント欄でStojkoの意見に賛成する人はいなかったはず。他の記事では不当に得点が高いと書かれていなかったはず。

ただ外国2ちゃんねるのようなところでは違うかもしれないと思って、4chanを見てみたのだが全く話題になっていなかった。そこでずばり「Kim Yu-Na bribe(=賄賂)」でググってみた。で、見つけたのがこれ。

Korean newspapers report on the internet proxy wars that are going on between Japan and Korea, through Kim Yuna and Asada Mao.

http://www.newdaily.co.kr/html.....41244.html

http://news.chosun.com/site/da.....p;Dep3=top

These describe how Japanese netizens are behaving. Some were noted for their wishing and rambling “fall fall, roll over, fall fall, trip and fall and roll over” during Kim Yuna’s performance. Once Kim’s score was announced, the Japanese internet sites exploded with comments of Koreans bribing the judges and buying the competition. The report in Chosun’s article noted how Korean netizens were taking the high road.

This is why I don’t watch nor care about this sports. Not only is it boring to watch, the overt nationalism on both sides of the sea dirties up the sports.

cm

http://www.rjkoehler.com/2010/02/24/kim-yu-na-scores-world-record/

どちらかというと日本ネチズンを批判するもの。まぁ、韓国系のブログだから不正採点とか騒いでいる人たちには意味がないけど。日本系のだと見つからなかったけど、去年のものがあってそれが興味深かった。去年というか半年ぐらい前にもあったのかという点に驚き。2ちゃんねるも知ってるブログなのだけど、コメント欄ではあきれられてる。

I must agree with you that some of the feuds between Korea/Japan/China indeed stem out of pure hatred and unjustified bias, resulting in posting videos like this that are obviously made of 100% malicious intent.

fracturedcow

Nationalism is a form of brain damage.

William George

個人的には日本の一部のネチズン世界的に迷惑をかけて申し訳ないと感じる。

キムヨナの不正が疑われているってどこの話なの。

2009-08-04

EA Sports Active

http://www.amazon.com/gp/product/B001MBUGLY/

日本版が8/6に出るけど・・・

★☆☆☆☆ Not a More Cardio Wii Fit, Rather a Disaster of a Product, July 16, 2009

The concept is fantastic but the wiimote/sensor interaction is too finicky. It made the workout too frustrating. Specifically:

  • Some of the exercises work great on one side but not the other. Moving the sensor doesn't fix it.
  • If the way you hold the wiimote/nunchuck is off even slightly, the exercise stops and waits for you. You have to guess what it's waiting for.
  • There reps are not timed to the music and there's no consistency to the timing. Instead of getting into the flow of the reps, it waits for you before it does the next rep. There's too much "thinking" time between reps making it hard to get a good flow to your workout.
  • When doing reps, it's normal to anticipate the next rep, but this game does not allow for that. You finish a rep, the program goes back to the top of its do loop and then it does the next rep. It's very choppy - there's no smooth rhythm to the reps.
  • If you move even a little faster than the "follow me" droid it stops completely (like its giving up), puts a note on the screen and waits for you to go back to the top of the rep.
  • The instruction videos take FOREVER to demonstrate a simple exercise. Between that and the delay between reps, there's lots of down time.

Overall, I found it very frustrating because every time my workout started to flow, something interrupted it. I've had the Wii for over a year, and play with it daily so I don't think it's a learning curve issue.

評価の悪かった批評ぐらい訳してみようかな・・・

2008-06-08

ad:tech 11th Annual Awards - Winners

From View the award winners!(汐留通信 Part3)

ad:tech 11th Annual Awards - Winners

http://www.ad-tech.com/awards/winners/

About "ad:tech" - はてな

http://d.hatena.ne.jp/keyword/ad:tech

INTERACTIVE ADS

BEST BANNER AD - Avenue A | Razorfish

WaMu Friendly Banner

http://wamufriendly.razorfishtc.com/banners/Fat/friendly_300x250_fat.html

BEST INTERACTIVE BROADCAST - TBWA/Chiat/Day/Tequila

Nissan Rogue Campaign

http://showcase.tequila.com/folio/Nissan/Awards_2008/adtech_interactive_broadcast.html

BEST LARGE FORMAT OR OVERLAY AD - AKQA

Assassin's Creed Roadblock

http://work.dc.akqa.com/ubisoft/assassinscreed/adtech.html

BEST NEXT GENERATION AD - CCCP

HEMA Rude Goldberg Viral

http://www.cccp.nl/hema/

BEST USE OF RICH MEDIA - Goodby, Silverstein & Partners

HP Gwen Stefani Yahoo Paper Dolls

http://public.yahoo.com/~wwwads/archives/hpq/070921/

INTERACTIVE CAMPAIGNS

BEST WORD OF MOUTH MARKETING CAMPAIGN - EVB & Toy ☆BEST OF SHOW

Elf Yourself (OfficeMax)

http://demo.elfyourself.com/

BEST BUSINESS-TO-BUSINESS CAMPAIGN - EyeWonder

Eye Wonder Client Testimonials (EyeWonder)

http://cdn.eyewonder.com/100125/marketing/AdTech/index.html

BEST DIRECT RESPONSE CAMPAIGN - eStara

Soccer Club Sells Seats with DRC (Sporting CP

http://jp.youtube.com/watch?v=gQ42Kf_SFkE

BEST INTEGRATED CAMPAIGN - Smith Brothers Agency

Heinz Top This TV Challenge Website (Heinz)

http://www.topthistv.com/archive/

BEST MULTI-CULTURAL CAMPAIGN - Media 8 Digital Marketing

Vivemejor ( )

http://www.vivemejor.com/

BEST AFFILIATE MARKETING CAMPAIGN - Schaaf Consulting

Moosejaw - Growth and Profit (Moosejaw)

http://moosejawaffiliates.com/

BEST BRANDING CAMPAIGN - Agency.com

eBay - Renew & Rethink (eBay

http://portfolio.sf.agency.com/clients/eBay/ebay_renewrethink.html

BEST CONSUMER CAMPAIGN - These Days

Nokia Jealous Computers (Nokia

http://www.thesedays.com/Awards2007/nokia%5Fjealouscomputers/

BEST EMAIL MARKETING CAMPAIGN - Acxiom Digital

Sun APAC Re-engagementSun

http://www.177bovet.com/awards/2008/adtech/

BEST MOBILE CAMPAIGN - The Hyperfactory & Ogilvy

Motorola "Say Goodbye" (Motorola

http://210.48.79.8/awards/hkia/index.htm

BEST SOCIAL MEDIA MARKETING CAMPAIGN - Guerilla PR

Banboo on Facebookwacom

http://www.facebook.com/pages/Bamboo-By-Wacom/7616161690

OPTIMIZATION/SEARCH

BEST SEARTH MARKETING STRATEGY/CAMPAIGN - Svripps Networks

HGTV Design Star Marketing Loop (HGTV)

BEST SEARTH ENGINE OPTIMIZATION STRATEGY/CAMPAIGN - eMarketingEye(Pvt)Ltd

Millennium & Copthorne SEO Campaign (Millennium & Copthorne)

BEST CAMPAIGN OPTIMIZATION - iCrossing

Lincoln Educational Services (Lincoln Educational Services)

WEB SITES

BEST BUSINESS-TO-BUSINESS MARKETING WEB SITE - Mullen

Mullen.com (Mullen)

http://www.mullen.com/

BEST BUSINESS-TO-BUSINESS TRANSACTION WEB SITE - The Buddy Group

FurnishedQuarters.com (Mullen)

http://www.furnishedquarters.com/

BEST BUSINESS-TO-CONSUMER MARKETING WEB SITE - Goodby, Silverstein & Partners

HP Serena Williams Site (HP)

http://www.hp.com/united-states/serena/2007/index.html?jumpid=ex_R11260_go/serena

BEST BUSINESS-TO-CONSUMER TRANSACTION WEB SITE - ROKKAN

Virgin America (Virgin)

http://www.virginamerica.com/va/home.do

BEST MICRO SITE - T3

Every journey needs a Journal (THE WALL STREET JOURNAL)

http://journey.wsj.com/

BEST USER DEFINDED EXPERIENCE - andCulture

design my room (design my room)

http://www.designmyroom.com/

2008-05-17

http://anond.hatelabo.jp/20080516052520

感想聞きたがった上に檻をすすめた増田です。「檻の外」の感想までありがとう。うれしいです。

「16になったら…」とか花冠とか、やっぱりグっとくるところは変わらないんだなあ。

「雨の日」は、芝からのはがきが来ているところが個人的に気に入っています。BLとはまったく関係ないところなんだけど、喜多川のことをただ同じ房の中で過ごしただけの人がこうやって気にかけてくれているのだな…と。

なつやすみ」は人生に思いをはせてしまう…。犬とか和風建築とか、なんだか郷愁を誘う。

ところでこの2冊が出たあとにおまけプレゼント企画があって、「すすきのはら」という掌編が書かれています。50代になった彼らが、堂野の母親葬式を迎えて、養子縁組についてあれこれというエピソードなんだけど、これも人生の年輪を感じさせる良い作品でした。「すすきのはら」で検索をかけるともうちょっと詳しく紹介しているブログさんがひっかかるかな。

LOOP」も「恋愛時間」ももう手に入りにくいのか…。とにかくこの業界絶版が早くて残念。絶版になる前に増田に読んでもらえて本当に嬉しかったです。ありがとう

2008-05-16

http://anond.hatelabo.jp/20080514201248

木原音瀬読んでる増田です。

「檻の外」けっきょく買って読みました。これ2冊併せて読んだほうがいいわ、間違いなく。

檻の外

最初はまたホラー来た!と思ったけど、そんな単純じゃないですねコレ。

こんな痛くて昼メロみたいな展開なのに、煽りなしで淡々と、それでいてメリハリつけて語れるのはすごいと思います。

「十六になったら俺にくれ」のところとか、花冠のところとか、ひとつひとつのシーンも、ぐっとくるとこありました。

これは人に勧めたくなるのもわかる気がします。

雨の日

わりと自分のBLに対する先入観に近いタイプの作品ですねー。

正直、よくわからん! けどブリッジとしてはあるべきものなのかな、と思いました。

なつやすみ

このままピュアフル文庫アンソロジーに入っててもいいくらいの清々しさ。

前作とあわせてのチルアウトというかクールダウンというか、そういう感じ?

この作者さん、「痛い」タイプの作品が多いんですよね。

BL以外も書いてくれとは思わないけど、こういう読後感いいやつは書いてほしいなあ。

すごいちゃんと書いてるなーと思ったのは、メインの二人がきちんと年を重ねているのが伝わってくるところ。

イニシエーション的にひとつの事件を超えて成長したり変貌したりっていうのはよくあるけど、

何年もかけていくつもの小さな出来事を超えてきてるっていうのを感じるのはそうそうないので、

やっぱり力のある人なんだな、と思う。

「箱の中」だけで止めてたらしばらくBLに手を出す気にはなれなかったと思うので、

「檻の外」まで読むのを勧めてくれた増田感謝。もちろん最初に木原音瀬を教えてくれた元増田にも。

次はほかの人がすすめてた「LOOP」「恋愛時間」読んでみようかと思ったけど、入手難しそうですね。

2008-03-08

書き手・読み手は、どこまで情報コントロールする権利があるんだ?

Pipes: Rewire the webを使うと他人のサイトが簡単にスクレイピング出来てしまう。これまでスクレイピングするのにはほんのちょっとだけ技術的心理的障壁があった。今はそれすら要らない。loopとfetchだけわかればいい。広告を消すのも全文配信させるのも簡単に出来てしまう。

自前でplagger置いて加工するのはセーフ?

じゃあfeedreaderで読んでてgreasemonkeyで引っ張リ出すのは?

じゃあpipesは?

じゃあそれを公開するのは?

UTF-8ではないフィードを変換するのにwebサービスを使った。そのサービス広告差し込んでくるのは?

RSS広告差し込んであるのはウザい。それを消したものを公開するのは?

pipesフィード広告差し込んできたら?

他人のフィードアフィリエイトIDを全部自分のものに書き換えて公開するのは?

他人のフィード広告差し込んで公開するのは?

一度公開されてる情報だから好きにしていいだろ、これって通じるの?

取捨選択のロジック書いたら編集権が発生するの?

フレームの中に他人のサイトを入れるのと何が違うんだ?

他人様のフィード改ざんして「作った」だのおこがましくね?

出来てしまう事に逆らうべきではないという思考停止

便利だからいいじゃないかという思考停止

考えてもよくわからないから他人に丸投げして思考停止

やってはいけないことのような気がするから触れないという思考停止

フィードって何なのだろう。

webサイトって何なのだろう。

お金の臭いや作為の臭いがするとうわって思うけど判断基準はそれでいいの?それだけなの?

フィードで全文配信しないサイト絶滅すればいいと思ってる。でもそれとこれとは話が別だ。

拒否するにはhttpd.conf(.htaccess)にUA書くかmeta tagに書くかpipesチームにメールを出せってこいつは何様なんだ?Pipes - Frequently Asked Questions

webサイトの書き手は、読み手は、いったいどこまで情報コントロールする権利があるんだ?

サーバ型のFeed Reader過去から未来までフィード無限に全部蓄積して、すべて全文配信してくれれば一切余計なこと考えなくて済むのに。

とりあえずこれは読んだ。

ニュースのRSSを全文配信で読む - ytsuchiyamaの日記

RSSのニュース全文配信は予告なく停止するかも知れません - ytsuchiyamaの日記

ICHINOHE Blog: Yahoo! Pipesによるニュースサイトの「強制全文配信」

2007-09-10

Gauche によるもう少し効率的なバージョン

(define str "Hello world")

(let ((a 0))
  (let1 b (with-input-from-string str
	    (lambda ()
	      (port-fold
	       (lambda (c b)
		 (if (eqv? #\o c) (inc! a))
		 (+ 1 b))
	       0
	       read-char)))
    (print a " " b)))

あるいはこう。

(use srfi-1)

(define (times* e n)
  (map (lambda _ (e)) (iota n)))

(define-macro (with-gensyms var . body)
  `(let ,(map (cut list <> '(gensym)) var)
     ,@body))

(define-macro (with-gensyms* var n . body)
  `(let ((,var (times* gensym ,n)))
     ,@body))

(define-macro (port-vfold proc seed reader)
  (with-gensyms
   (loop %proc v)
   (with-gensyms*
    pr (length seed)
    (with-gensyms*
     npr (length seed)
     `(let ((,%proc ,proc))
	(let ,loop ((,v (,reader)) ,@(map list pr seed))
	     (if (eof-object? ,v)
	       (values ,@pr)
	       (receive ,npr (,%proc ,v ,@pr)
		 (,loop (,reader) ,@npr)))))))))

(receive (a b)
    (with-input-from-string "Hello world"
      (lambda ()		    
	(port-vfold
	 (lambda (c a b)
	   (values
	    (if (eqv? #\o c) (+ a 1) a)
	    (+ 1 b)))
	 (0 0)
	 read-char)))
  (print a " " b))

文字列操作関数って高価じゃね?

2007-08-22

http://anond.hatelabo.jp/20070822165701

@data=(a,b,c);print@data
#!/usr/bin/perl
use strict;
my @data = qw(a b c);

my $cx = scalar @data;
my $si = 0;
my $ax;
LOOP:
    $ax = $data[$si];
    print $ax;
    $si++;
not --$cx or goto LOOP;
#!/usr/bin/perl
use strict;
my @data = qw(a b c);

package AtoH;
use base qw(Tie::Handle);
sub TIEHANDLE {
    my $class = shift;
    return bless {data => [@_]}, $class;
}
sub READLINE {
    return shift @{shift->{data}};
}

package main;
tie *ARGV, 'AtoH', @data;
while (<>) {
    print;
}

2007-07-11

めいろさくせーぷろぐらむつくってみたー

http://anond.hatelabo.jp/20070711013155

人待ちの間暇だったから作ってみたよー。

さっくり作ったから無駄が多い気がするけど、とりあえず動いた。

全体が埋まったかどうかの判定をしないでひたすらまわしまくってるし、なんか綺麗な形じゃないけど、とりあえず投稿しちゃうよ!

これ綺麗な形にするの結構難しいんじゃないかな。面白いね。

class Maze
	class Box
		WALL = 0
		LOAD = 1
		def initialize(state = LOAD)
			@state = state
		end
		def is_wall?
			return true if @state == WALL
			false
		end
		def is_load?
			return true if @state == LOAD
			false
		end
		def set_wall
			@state = WALL
		end
		def set_load
			@state = LOAD
		end
	end
	TOP = 10
	RIGHT = 11
	BOTTOM = 12
	LEFT = 13
	def initialize(height = 100, width = 60)
		@height = height
		@width  = width
		@data = Array.new
		self.fillbox
		@counter = 1000
		@root = Array.new
	end
	def choose_random
		return rand(@width-3)+1, rand(@height-3)+1
	end
	def choose_direct
		t = rand(4)+10
		return t
	end
	def move(x, y, t)
		new_x = x
		new_y = y
		case t
		when TOP
			new_y -= 1
		when RIGHT
			new_x += 1
		when BOTTOM
			new_y += 1
		when LEFT
			new_x -= 1
		end
		return new_x, new_y
	end
	def make_load?(x, y)
		return false if x < 0 or y < 0 or x > @width-1 or y > @height-1
		return false if @data[x][y].is_load?
		true
	end
	def dead_end?(x, y, t)
		case t
		when TOP
			if make_load?(x-1, y) and \
				 make_load?(x-1, y-1) and\
				 make_load?(x, y-1) and\
				 make_load?(x+1, y-1) and\
				 make_load?(x+1, y) then
				 return false
			end
		when RIGHT
			if make_load?(x, y-1) and \
				 make_load?(x+1, y-1) and\
				 make_load?(x+1, y) and\
				 make_load?(x+1, y+1) and\
				 make_load?(x, y+1) then
				 return false
			end
		when BOTTOM
			if make_load?(x-1, y) and \
				 make_load?(x-1, y+1) and\
				 make_load?(x, y+1) and\
				 make_load?(x+1, y+1) and\
				 make_load?(x+1, y) then
				 return false
			end
		when LEFT
			if make_load?(x, y+1) and \
				 make_load?(x-1, y+1) and\
				 make_load?(x-1, y) and\
				 make_load?(x-1, y-1) and\
				 make_load?(x, y-1) then
				 return false
			end
		end
		true
	end
	def check_all?(stack)
		for i in TOP..LEFT do
			return false if !stack.include?(i)
		end
		true
	end
	def extend(x, y)
		@data[x][y].set_load
		check_stack = Array.new
		loop do
			t = choose_direct
			check_stack << t
			new_x, new_y = move(x, y, t)
			if enable_new_point?(new_x, new_y)
				if !dead_end?(new_x, new_y, t) then
					@root << ["ex", new_x, new_y, t]
					extend(new_x, new_y)
					break
				end
			end
			break if check_all?(check_stack)
		end
	end
	def enable_new_point?(x, y)
		return false if x<=0 or y <= 0 or x > @width-1 or y > @height-1
		return false if @data[x][y].is_load?
		true
	end
	def _make
		x = y = 0
		loop do
			x, y = choose_random
			break if @data[x][y].is_load?
		end
		@root << [x,y]
		extend(x, y)
	end
	def make_goal
		x = @width - 2
		y = @height - 1
		for i in 1..@width-3
			if @data[x-i][y-1].is_load? then
				@data[x-i][y].set_load
				break
			end
		end
	end
	def make_start
		for i in 1..@width-3
			if @data[i][1].is_load? then
				@data[i][0].set_load
				break
			end
		end
	end
	def make
		self.fill_all
		x, y = choose_random
		@root << [x,y]
		@data[x][y].set_load
		extend(x,y)
		while(!is_fill?) do
			_make
		end
		make_goal
		make_start
		self
	end
	def is_fill?
		@counter -= 1
		return true if @counter < 0
		false
	end
	def fillbox
		for i in 0...@width do
			@data[i] = Array.new
			for j in 0...@height do
				@data[i][j] = Box.new
			end
		end
	end
	def fill_all
		for i in 0...@width do
			for j in 0...@height do
				@data[i][j].set_wall
			end
		end
	end
	def output
		for i in 0...@height do
			for j in 0...@width do
				if @data[j][i].is_wall? then
					print "#" 
				else
					print " "
				end
			end
			print "\n"
		end
	end
end

Maze.new(30, 30).make.output

## output

# ############################
#  ##    # #     ##    #     #
##    ##   ## ## #  ##   ### #
### #  ###  #  #   #### ###  #
#   # ## ## ## ### #  #  #  ##
### #  #  #  #   #### ## # ###
##  ## ## ## ###   #  ## #   #
#  ### #  #   #### # ##  ## ##
# ## #   ####    #    # ###  #
#  # ###  # #### # ## # #   ##
##     ## #      #  ### ######
######  ### #######   ###    #
#    ##   ###   # # #   ## # #
# #######  #  # # # ###  ### #
#   # # ##   ##   #   ##   # #
### #    ######## ########   #
#   # ## ##     #    #     ###
# ### ##  ## ##   ##   ##### #
#      ##  # #  #  ###  #    #
# ######## # #####   ## # # ##
#       ## #  #  #####  # #  #
####### #  ## # ## #   ## ## #
##    ### ###   ##   ####### #
#  ##  ##   ## ##  ###    ## #
# ####  ###  # #  ## # ##    #
#  # ##   ## # # ###    ######
## #  # #  # # #   ## #    ###
#    ## ## #   # #  # # ##  ##
# # ##  ##   # # ##   #  ##  #
########################### ##

2007-05-11

fizzbuzz.com

http://anond.hatelabo.jp/20070508170219 こいつをアセンブラで書こうとしていたが、

すでに

http://anond.hatelabo.jp/20070510170511 にそれっぽいものが書かれていた。

しかしデクリメントした直後に判定するならフラグですむがそうじゃないときtest命令入れないといけないのでうまくいかんと思った。

とりあえず8086アセンブラで書いてみたが長くなったので実行ファイル(fizzbuzz.com)をBase64で下に書いておくよ。

~) ls -al fizzbuzz.com
-a--rwx       98 May 11 03:28 fizzbuzz.com*

~) base64 < fizzbuzz.com
uwUDuQoJvl0B/s91ErcD/st1BrpSAesOkLpLAesWkP7LdQi6VgGzBesKkLg6OivBiQSL1rQJzSH+
zXXNtQr+yXXHulYBzSG0TM0hRml6eg0KJEZpenpCdXp6DQokVU0NCiQ=

数字の表示の処理で10で割った余りを使っていたのでまずいと思って修正した。ついでに98バイトまで縮めてみた。

こんなことに時間を使っている俺はバカだ。

ソースも載せとこう。8086なんてほとんど初めてに等しいので汚いだろうけど。


CODE	SEGMENT
	ASSUME	CS:CODE,DS:CODE
	ORG 100H
START:
	mov bx, 0305h
	mov cx, 090Ah
	mov si, OFFSET NUM
LOOP:
	dec bh
	jnz skip1
; 3の倍数だった
	mov bh, 3
	dec bl
	jnz skip2
; 3の倍数で5の倍数だった
	mov dx, OFFSET FIZZBUZZ
	jmp loop5
skip2:
; 3の倍数で5の倍数じゃなかった
	mov dx, OFFSET FIZZ
	jmp loopend
skip1:	
; 3の倍数じゃないとき
	dec bl
	jnz skip3
; 3の倍数じゃなくて5の倍数だった
	mov dx, OFFSET BUZZ
loop5:	mov bl, 5
	jmp loopend
skip3:	
; 3の倍数じゃなくて5の倍数でもなかった
; 数字を表示する。2桁でいい
	mov ax, 3A3Ah
	sub ax, cx
	mov [si],ax
	mov dx, si
	
loopend:
	mov ah,9
	int 21h

	dec ch
	jne loop
	mov ch,10
	dec cl
	jne loop

; 最後のBuzzを表示する
	mov dx, OFFSET BUZZ
	int 21h

	mov ax, 4c00H
	int 21h

	
FIZZ:		DB	'Fizz', 0dh, 0ah, '$'
FIZZBUZZ:	DB	'Fizz'
BUZZ:		DB	'Buzz', 0dh, 0ah, '$'
NUM:		DB	'UM', 0dh, 0ah, '$'
CODE	ENDS

	END START

2007-02-21

YouTube memo

[最終更新:2007/02/21(水)]

GO!GO!7188

official

http://www.breast.co.jp/gogo7188/

浮舟(live)

http://www.youtube.com/watch?v=ys_UWxNjFsc

浮舟 - ギタドラ大辞典

http://ryuujin.k.fiw-web.net/gd_dic/dr.cgi?key=332

青い亀裂(PV)

http://www.youtube.com/watch?v=RL_lbLap2uM

Jake Shimabukuro

Jake Shimabukuro plays "While My Guitar Gently Weeps"

http://www.youtube.com/watch?v=O9mEKMz2Pvo

HOLSTEIN

official

http://www.holsteinweb.com/

Gently, the rain sings for me

http://www.youtube.com/watch?v=ovTeyrRRyyY

Gently, the rain sings for me - ギタドラ大辞典

http://ryuujin.k.fiw-web.net/gd_dic/dr.cgi?key=1824

デーモン小暮周辺

聖飢魔II - Wikipedia

http://ja.wikipedia.org/wiki/%E8%81%96%E9%A3%A2%E9%AD%94II

Burn <Japanese instrument ensemble>

http://www.youtube.com/watch?v=-_2nV_g_bWw

JACK THE RIPPER(live)

http://www.youtube.com/watch?v=n441gF-sU-Y

上原ひろみ

Return of Kung-Fu World Champion

http://www.youtube.com/watch?v=00fKuTD52gQ

2004-11-26 at Yokohama BLITZ

http://www.youtube.com/watch?v=okWg_6mhxWY

音ゲー

Micro fin(movie only)

http://www.youtube.com/watch?v=alnYKQMRRec

Micro fin(曲紹介)

http://www.konami.jp/bemani/gfdm/gfdmv3/music/031.html

Micro fin - ギタドラ大辞典

http://ryuujin.k.fiw-web.net/gd_dic/dr.cgi?key=2957

ミラージュ・レジデンス(movie only)

http://www.youtube.com/watch?v=8jHCQDnnzUw

ミラージュ・レジデンス(曲紹介)

http://www.konami.jp/bemani/gfdm/gfdmv3/music/101.html

ミラージュ・レジデンス - ギタドラ大辞典

http://ryuujin.k.fiw-web.net/gd_dic/dr.cgi?key=3093


So Fabulous !!(movie only)

http://www.youtube.com/watch?v=_p_qs3P6nSw

So Fabulous !!(曲紹介)

http://www.konami.jp/am/bm2dx/bm2dx13/song/so_fabulous.html

■その他

ロックマン2  思い出は億千万 full ver.

http://www.youtube.com/watch?v=2uvuQZCgWkQ

user

ハムスターの人

http://www.youtube.com/profile?user=teamwakaba

Opening & Demo loop

http://www.youtube.com/profile?user=iMp95

ログイン ユーザー登録
ようこそ ゲスト さん