[#14715] HTTP Client with Ruby — TAKAHASHI Masayoshi <maki@...>

高橋征義です。

32 messages 1999/06/01
[#14834] Re: HTTP Client with Ruby — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/06/05

なひです.

[#14836] Re: HTTP Client with Ruby — TAKAHASHI Masayoshi <maki@...> 1999/06/05

高橋征義です。

[#14858] Re: HTTP Client with Ruby — gotoken@... (GOTO Kentaro) 1999/06/07

ごとけんです

[#14896] Re: HTTP Client with Ruby — TAKAHASHI Masayoshi <maki@...> 1999/06/07

高橋です。みなさまどうもありがとうございます。

[#14907] Re: HTTP Client with Ruby — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/06/08

なひです.

[#14766] ruby 1.3.4 on BSD/OS 3.1 — Yasunari Momoi <momo@...>

BSD/OS 3.1 (with kame) で ruby-1.3.4 を作ろうとしているんで

18 messages 1999/06/03
[#14770] Re: ruby 1.3.4 on BSD/OS 3.1 — matz@... (Yukihiro Matsumoto) 1999/06/03

まつもと ゆきひろです

[#15012] ext ML の過去ログはいずこ? — 中村暁史 <anakamur@...>

22 messages 1999/06/16
[#15013] Re: ext ML の過去ログはいずこ? — Shin-ichiro Hara <sinara@...> 1999/06/16

原です。

[#15014] Re: ext ML の過去ログはいずこ? — 中村暁史 <anakamur@...> 1999/06/16

[#15015] Re: ext ML の過去ログはいずこ? — Kazunori Akaishi <akaishi@...> 1999/06/16

akaishi です。

[#15016] Re: ext ML の過去ログはいずこ? — 中村暁史 <anakamur@...> 1999/06/16

[#15045] mail library — Minero Aoki <aamine@...>

あおきです。

96 messages 1999/06/20
[#15075] Re: mail library — Minero Aoki <aamine@...> 1999/06/22

あおきです。

[#15122] Re: mail library — Minero Aoki <aamine@...> 1999/06/28

あおきです。

[#15123] Re: mail library — matz@... (Yukihiro Matsumoto) 1999/06/28

まつもと ゆきひろです

[#15125] Re: mail library — WATANABE Hirofumi <watanabe@...> 1999/06/28

わたなべです.

[#15126] Re: mail library — matz@... (Yukihiro Matsumoto) 1999/06/28

まつもと ゆきひろです

[#15146] Re: mail library — Minero Aoki <aamine@...> 1999/06/29

あおきです。

[#15148] Re: mail library — matz@... (Yukihiro Matsumoto) 1999/06/29

まつもと ゆきひろです

[#15161] Re: mail library — Minero Aoki <aamine@...> 1999/06/30

あおきです。

[#15165] Re: mail library — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/06/30

なひです.

[#15167] Re: mail library — Minero Aoki <aamine@...> 1999/06/30

あおきです。

[#15219] Re: mail library — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/07/03

なひです.

[#15228] Re: mail library — hisanori@... 1999/07/05

松尾です。

[#15279] Re: mail library — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/07/07

なひです.

[#15172] Re:mail library — Takeo Iwama <iwamat@...> 1999/07/01

はじめまして、岩間です。

[#15218] JUS workshop ( was Re:mail library ) — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/07/03

なひです.mod_rubyと格闘中です.

[#15220] Mod_ruby server does not respond when POST request. — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/07/03

なひです.mod_rubyネタはruby-listでよいでしょうか?

[#15226] Re: Mod_ruby server does not respond when POST request. — Shugo Maeda <shugo@...> 1999/07/05

前田です。

[#15240] mod_ruby/0.1.2 with Apache/1.3.6 on Solaris/2.5.1 ( was Re: Mod_ruby server does not respond when POST request. ) — "NAKAMURA, Hiroshi" <nakahiro@...> 1999/07/05

なひです.

[#15242] Re: mod_ruby/0.1.2 with Apache/1.3.6 on Solaris/2.5.1 ( was Re: Mod_ruby server does not respond when POST request. ) — Shugo Maeda <shugo@...> 1999/07/05

前田です。

[#15308] Re: mod_ruby/0.1.2 with Apache/1.3.6 on Solaris/2.5.1 — Katsuyuki Komatsu <komatsu@...> 1999/07/08

小松です。

[#15310] Re: mod_ruby/0.1.2 with Apache/1.3.6 on Solaris/2.5.1 — Shugo Maeda <shugo@...> 1999/07/08

前田です。

[#15313] Re: mod_ruby/0.1.2 with Apache/1.3.6 on Solaris/2.5.1 — Katsuyuki Komatsu <komatsu@...> 1999/07/08

小松です。

[#15057] 複雑?な構造体の定義方法 — Koichi Shigematsu <shige@...>

しげまつ と申します。  とっても久しぶりの投稿です。

18 messages 1999/06/21
[#15058] Re: 複雑?な構造体の定義方法 — matz@... (Yukihiro Matsumoto) 1999/06/21

まつもと ゆきひろです

[#15059] Re: 複雑?な構造体の定義方法 — Koichi Shigematsu <shige@...> 1999/06/21

しげまつ です。

[#15061] Re: 複雑?な構造体の定義方法 — matz@... (Yukihiro Matsumoto) 1999/06/21

まつもと ゆきひろです

[#15065] pattern (Re: 複雑?な構造体の定義方法) — gotoken@... (GOTO Kentaro) 1999/06/21

ごとけんです

[#15076] Re: pattern (Re: 複雑?な構造体の定義方法) — matz@... (Yukihiro Matsumoto) 1999/06/22

まつもと ゆきひろです

[#15077] Re: pattern (Re: 複雑?な構造体の定義方法) — gotoken@... (GOTO Kentaro) 1999/06/22

ごとけんです

[ruby-list:15064] hako-iri

From: Masatoshi SEKI <m_seki@...>
Date: 1999-06-21 10:33:53 UTC
List: ruby-list #15064
咳@Rubyリハビリ中です。

同僚が Windows で遊んでいた 箱入り娘 を見てたらなつかしくて
はじめて tk 使って作ってみました。

tkむずかしいっす。

# こういうの投稿しても良いのかな?



require 'tk'

class House
  def initialize(parent=nil, unit=32)
    @w = 4
    @h = 5
    @unit_size = unit
    @widget = TkFrame.new(parent,
			  'width' => @unit_size * @w,
			  'height' => @unit_size * @h).pack
    @chips = []
  end
  attr :widget
  attr :unit_size
  attr :chips

  def enter(chip)
    @chips.push chip
  end

  def wall
    hash = {}
    (-1..@w).each do |i|
      hash[[i, -1]] = true
      hash[[i, @h]] = true
    end
    (-1..@h).each do |i|
      hash[[-1, i]] = true
      hash[[@w, i]] = true
    end
    hash
  end

  def move?(chip, dx, dy)
    field = self.wall
    @chips.each do |c|
      unless c == chip
	c.area.each do |a|
	  field[a] = chip
	end
      end
    end

    chip.area(dx, dy).each do |a|
      return false if field[a]
    end
    return true
  end
end

$house = house = House.new(nil, 64)

class Chip
  def initialize(house, name, x, y, w=1, h=1)
    @name = name
    @w = w
    @h = h
    @widget = TkLabel.new(house.widget,
			  'text' => name,
			  'relief' => 'raised')
    @house = house
    @unit = @house.unit_size
    moveto(x, y)
    @house = house.enter(self)
    @widget.bind('1', proc{|e| do_press e.x, e.y})
    @widget.bind('B1-Motion', proc{|x, y| do_motion x, y}, "%x %y")
    @widget.bind('ButtonRelease-1', 
		 proc{|x, y| do_release x, y}, "%x %y")
  end
  attr :name

  def area(dx=0, dy=0)
    v = []
    for i in (1..@h)
      for j in (1..@w)
	v.push([dx + @x + j - 1, dy + @y + i - 1])
      end
    end
    v
  end

  def moveto(x, y)
    @x = x
    @y = y
    @widget.place('x' => @unit * x,
		  'y' => @unit * y,
		  'width' => @unit * @w,
		  'height' => @unit * @h)
  end

  def move(dx, dy)
    x = @x + dx
    y = @y + dy
    moveto(x, y)
  end
  
  def do_press(x, y)
  end

  def do_motion(x, y)
    if x >= @unit * @w
      dx = 1
    elsif x < 0
      dx = -1
    else
      dx = 0
    end

    if y >= @unit * @h
      dy = 1
    elsif y < 0
      dy = -1
    else
      dy = 0
    end

    if (dx != 0)
      dy = 0
    end

    return if (dx == 0) and (dy == 0)

    try_move(dx, dy)
  end

  def do_release(x, y)
  end
  
  def try_move(dx, dy)
    if $house.move?(self, dx, dy)
      move(dx, dy)
    end
  end
end

she = Chip.new(house, '娘', 1, 0, 2, 2)
father = Chip.new(house, "父\n親", 0, 0, 1, 2)
mother = Chip.new(house, "母\n親", 3, 0, 1, 2)
kozou = []
(0..3).each do |i|
  kozou.push Chip.new(house, "小僧", i, 2)
end
genan = []
(0..1).each do |i|
  genan.push Chip.new(house, "下\n男", i * 3, 3, 1, 2)
end
bantou = Chip.new(house, "番頭", 1, 3, 2, 1)

Tk.mainloop

	    



In This Thread

Prev Next