* sample/drb/README.rd.ja:

* sample/drb/dhasenc.rb:
* sample/mine.rb:
Change encoding from EUC-JP to UTF-8


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
ayumin 2011-09-08 16:24:43 +00:00
parent 05558e04b8
commit d53e9c1e84
4 changed files with 54 additions and 47 deletions

View File

@ -1,3 +1,10 @@
Thu Sep 9 01:14:00 2011 NARUSE, Yui <naruse@ruby-lang.org>
* sample/drb/README.rd.ja:
* sample/drb/dhasenc.rb:
* sample/mine.rb:
Change encoding from EUC-JP to UTF-8
Thu Sep 8 21:03:22 2011 NARUSE, Yui <naruse@ruby-lang.org> Thu Sep 8 21:03:22 2011 NARUSE, Yui <naruse@ruby-lang.org>
* ext/nkf/nkf-utf8/nkf.c: import nkf 2.1.2 (be9c280) * ext/nkf/nkf-utf8/nkf.c: import nkf 2.1.2 (be9c280)

View File

@ -1,59 +1,59 @@
= サンプルスクリプト = サンプルスクリプト
* Arrayをリモートから利用してイテレータを試す。 * Arrayをリモートから利用してイテレータを試す。
* darray.rb --- server * darray.rb --- server
* darrayc.rb --- client * darrayc.rb --- client
* 簡易チャット * 簡易チャット
* dchats.rb --- server * dchats.rb --- server
* dchatc.rb --- client * dchatc.rb --- client
* 分散chasen * 分散chasen
* dhasen.rb --- server * dhasen.rb --- server
* dhasenc.rb --- client * dhasenc.rb --- client
* 簡易ログサーバ * 簡易ログサーバ
* dlogd.rb --- server * dlogd.rb --- server
* dlogc.rb --- client * dlogc.rb --- client
* Queueサーバ。 * Queueサーバ。
クライアントdqin.rbはQueueサーバの知らないオブジェクト(DQEntry)を クライアントdqin.rbはQueueサーバの知らないオブジェクト(DQEntry)を
pushするがDRbUnknownによりクライアントdqout.rbがpopできる。 pushするがDRbUnknownによりクライアントdqout.rbがpopできる。
* dqueue.rb --- server * dqueue.rb --- server
* dqin.rb --- client。DQEntryオブジェクトをpushする * dqin.rb --- client。DQEntryオブジェクトをpushする
* dqout.rb --- client。DQEntryオブジェクトをpopする * dqout.rb --- client。DQEntryオブジェクトをpopする
* dqlib.rb --- DQEntryを定義したライブラリ * dqlib.rb --- DQEntryを定義したライブラリ
* 名前による参照 * 名前による参照
IdConvをカスタマイズしてidでなく名前で参照する例 IdConvをカスタマイズしてidでなく名前で参照する例
* name.rb --- server * name.rb --- server
* namec.rb --- client * namec.rb --- client
* extservのサンプル * extservのサンプル
* extserv_test.rb * extserv_test.rb
* TimerIdConvの使用例 * TimerIdConvの使用例
* holders.rb --- server。ruby -d hodlers.rbとするとTimerIdConvを使用する。 * holders.rb --- server。ruby -d hodlers.rbとするとTimerIdConvを使用する。
* holderc.rb --- client * holderc.rb --- client
* rinda.rbの使用例 * rinda.rbの使用例
* rinda_ts.rb --- TupleSpaceサーバ。 * rinda_ts.rb --- TupleSpaceサーバ。
* rindac.rb --- TupleSpaceのclientでアプリケーションのclient * rindac.rb --- TupleSpaceのclientでアプリケーションのclient
* rindas.rb --- TupleSpaceのclientでアプリケーションのserver * rindas.rb --- TupleSpaceのclientでアプリケーションのserver
* observerの使用例 * observerの使用例
cdbiff - ((<URI:http://namazu.org/~satoru/cdbiff/>)) cdbiff - ((<URI:http://namazu.org/~satoru/cdbiff/>))
* dbiff.rb --- dcdbiff server * dbiff.rb --- dcdbiff server
* dcdbiff.rb --- dcdbiff client * dcdbiff.rb --- dcdbiff client
* drbsslの使用例 * drbsslの使用例
* drbssl_s.rb * drbssl_s.rb
* drbssl_c.rb * drbssl_c.rb
* DRbProtoclの追加例 * DRbProtoclの追加例
* http0.rb * http0.rb
* http0serv.rb * http0serv.rb
* ringの使用例 * ringの使用例
* ring_place.rb * ring_place.rb
* ring_echo.rb * ring_echo.rb

View File

@ -1,4 +1,4 @@
# -*- encoding: euc-jp -*- # -*- encoding: utf-8 -*-
=begin =begin
distributed Ruby --- dRuby Sample Client -- chasen client distributed Ruby --- dRuby Sample Client -- chasen client
Copyright (c) 1999-2001 Masatoshi SEKI Copyright (c) 1999-2001 Masatoshi SEKI
@ -10,5 +10,5 @@ there = ARGV.shift || raise("usage: #{$0} <server_uri>")
DRb.start_service DRb.start_service
dhasen = DRbObject.new(nil, there) dhasen = DRbObject.new(nil, there)
print dhasen.sparse("本日は、晴天なり。", "-F", '(%BB %m %M)\n', "-j") print dhasen.sparse("本日は、晴天なり。", "-F", '(%BB %m %M)\n', "-j")
print dhasen.sparse("本日は、晴天なり。", "-F", '(%m %M)\n') print dhasen.sparse("本日は、晴天なり。", "-F", '(%m %M)\n')

View File

@ -1,5 +1,5 @@
#! /usr/bin/ruby -Ke #! /usr/bin/ruby -Ku
# -*- encoding: euc-jp -*- # -*- encoding: utf-8 -*-
class Board class Board
def clr def clr
@ -13,19 +13,19 @@ class Board
end end
def put(x, y, col, str) def put(x, y, col, str)
pos(x,y); colorstr(43,str) pos(x,y); colorstr(43,str)
pos(0,@hi); print "残り:",@mc,"/",@total," " pos(0,@hi); print "残り:",@mc,"/",@total," "
pos(x,y) pos(x,y)
end end
private :clr, :pos, :colorstr, :put private :clr, :pos, :colorstr, :put
CHR=["","","","","","","","","","","","@@"] CHR=["","","","","","","","","","","","@@"]
COL=[46,43,45] # default,opened,over COL=[46,43,45] # default,opened,over
def initialize(h,w,m) def initialize(h,w,m)
# ゲーム盤の生成(h:縦w:横m:爆弾の数) # ゲーム盤の生成(h:縦w:横m:爆弾の数)
@hi=h; @wi=w; @m=m @hi=h; @wi=w; @m=m
reset reset
end end
def reset def reset
# ゲーム盤を(再)初期化する # ゲーム盤を(再)初期化する
srand() srand()
@cx=0; @cy=0; @mc=@m @cx=0; @cy=0; @mc=@m
@over=false @over=false
@ -47,7 +47,7 @@ class Board
pos(@cx,@cy) pos(@cx,@cy)
end end
def mark def mark
# 現在のカーソル位置にマークをつける # 現在のカーソル位置にマークをつける
if @state[@wi*@cy+@cx] != nil then return end if @state[@wi*@cy+@cx] != nil then return end
@state[@wi*@cy+@cx] = "MARK" @state[@wi*@cy+@cx] = "MARK"
@mc=@mc-1; @mc=@mc-1;
@ -55,8 +55,8 @@ class Board
put(@cx, @cy, COL[1], CHR[9]) put(@cx, @cy, COL[1], CHR[9])
end end
def open(x=@cx,y=@cy) def open(x=@cx,y=@cy)
# 現在のカーソル位置をオープンにする # 現在のカーソル位置をオープンにする
# 爆弾があればゲームオーバー # 爆弾があればゲームオーバー
if @state[@wi*y+x] =="OPEN" then return 0 end if @state[@wi*y+x] =="OPEN" then return 0 end
if @state[@wi*y+x] == nil then @total=@total-1 end if @state[@wi*y+x] == nil then @total=@total-1 end
if @state[@wi*y+x] =="MARK" then @mc=@mc+1 end if @state[@wi*y+x] =="MARK" then @mc=@mc+1 end
@ -76,7 +76,7 @@ class Board
pos(@cx,@cy) pos(@cx,@cy)
end end
def fetch(x,y) def fetch(x,y)
# (x,y)の位置の爆弾の数(0 or 1)を返す # (x,y)の位置の爆弾の数(0 or 1)を返す
if x < 0 then 0 if x < 0 then 0
elsif x >= @wi then 0 elsif x >= @wi then 0
elsif y < 0 then 0 elsif y < 0 then 0
@ -86,13 +86,13 @@ class Board
end end
end end
def count(x,y) def count(x,y)
# (x,y)に隣接する爆弾の数を返す # (x,y)に隣接する爆弾の数を返す
fetch(x-1,y-1)+fetch(x,y-1)+fetch(x+1,y-1)+ fetch(x-1,y-1)+fetch(x,y-1)+fetch(x+1,y-1)+
fetch(x-1,y) + fetch(x+1,y)+ fetch(x-1,y) + fetch(x+1,y)+
fetch(x-1,y+1)+fetch(x,y+1)+fetch(x+1,y+1) fetch(x-1,y+1)+fetch(x,y+1)+fetch(x+1,y+1)
end end
def over(win) def over(win)
# ゲームの終了 # ゲームの終了
quit quit
unless win unless win
pos(@cx,@cy); print CHR[11] pos(@cx,@cy); print CHR[11]
@ -103,8 +103,8 @@ class Board
end end
end end
def over? def over?
# ゲームの終了チェック # ゲームの終了チェック
# 終了処理も呼び出す # 終了処理も呼び出す
remain = (@mc+@total == 0) remain = (@mc+@total == 0)
if @over || remain if @over || remain
over(remain) over(remain)
@ -114,8 +114,8 @@ class Board
end end
end end
def quit def quit
# ゲームの中断(または終了) # ゲームの中断(または終了)
# 盤面を全て見せる # 盤面を全て見せる
@hi.times do|y| @hi.times do|y|
pos(0,y) pos(0,y)
@wi.times do|x| @wi.times do|x|
@ -125,19 +125,19 @@ class Board
end end
end end
def down def down
# カーソルを下に # カーソルを下に
if @cy < @hi-1 then @cy=@cy+1; pos(@cx, @cy) end if @cy < @hi-1 then @cy=@cy+1; pos(@cx, @cy) end
end end
def up def up
# カーソルを上に # カーソルを上に
if @cy > 0 then @cy=@cy-1; pos(@cx, @cy) end if @cy > 0 then @cy=@cy-1; pos(@cx, @cy) end
end end
def left def left
# カーソルを左に # カーソルを左に
if @cx > 0 then @cx=@cx-1; pos(@cx, @cy) end if @cx > 0 then @cx=@cx-1; pos(@cx, @cy) end
end end
def right def right
# カーソルを右に # カーソルを右に
if @cx < @wi-1 then @cx=@cx+1; pos(@cx, @cy) end if @cx < @wi-1 then @cx=@cx+1; pos(@cx, @cy) end
end end
end end