Submit Search
Upload
ライフゲーム最後まで作ってみました
•
0 likes
•
925 views
Keisuke Oohata
Follow
Game of Life and I tried to make the last minute
Read less
Read more
Technology
Slideshow view
Report
Share
Slideshow view
Report
Share
1 of 21
Download now
Download to read offline
Recommended
ES2015のカバレッジ計測
ES2015のカバレッジ計測
sinsoku listy
Socket.ioを使ってライフゲームで遊ぶ
Socket.ioを使ってライフゲームで遊ぶ
孝平 高田
Shellを書こう 02 shUnit2を使おう
Shellを書こう 02 shUnit2を使おう
Keisuke Oohata
Shellを書こう 01 Shellcheckを使おう
Shellを書こう 01 Shellcheckを使おう
Keisuke Oohata
Google SpreadSheetでtwitter bot作ったよ
Google SpreadSheetでtwitter bot作ったよ
Keisuke Oohata
今更だけどSqLite触ってみたよ
今更だけどSqLite触ってみたよ
Keisuke Oohata
Kanazawa.rb 3周年KPT
Kanazawa.rb 3周年KPT
Keisuke Oohata
イベント継続のコツ
イベント継続のコツ
Keisuke Oohata
Recommended
ES2015のカバレッジ計測
ES2015のカバレッジ計測
sinsoku listy
Socket.ioを使ってライフゲームで遊ぶ
Socket.ioを使ってライフゲームで遊ぶ
孝平 高田
Shellを書こう 02 shUnit2を使おう
Shellを書こう 02 shUnit2を使おう
Keisuke Oohata
Shellを書こう 01 Shellcheckを使おう
Shellを書こう 01 Shellcheckを使おう
Keisuke Oohata
Google SpreadSheetでtwitter bot作ったよ
Google SpreadSheetでtwitter bot作ったよ
Keisuke Oohata
今更だけどSqLite触ってみたよ
今更だけどSqLite触ってみたよ
Keisuke Oohata
Kanazawa.rb 3周年KPT
Kanazawa.rb 3周年KPT
Keisuke Oohata
イベント継続のコツ
イベント継続のコツ
Keisuke Oohata
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
FumieNakayama
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
Hiroshi Tomioka
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
Yuki Kikuchi
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
akihisamiyanaga1
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
UEHARA, Tetsutaro
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NTT DATA Technology & Innovation
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
FumieNakayama
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
博三 太田
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
More Related Content
Recently uploaded
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
FumieNakayama
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
Hiroshi Tomioka
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
Yuki Kikuchi
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
akihisamiyanaga1
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
UEHARA, Tetsutaro
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NTT DATA Technology & Innovation
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
FumieNakayama
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
博三 太田
Recently uploaded
(8)
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
クラウドネイティブなサーバー仮想化基盤 - OpenShift Virtualization.pdf
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
業務で生成AIを活用したい人のための生成AI入門講座(社外公開版:キンドリルジャパン社内勉強会:2024年4月発表)
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
自分史上一番早い2024振り返り〜コロナ後、仕事は通常ペースに戻ったか〜 by IoT fullstack engineer
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
CTO, VPoE, テックリードなどリーダーポジションに登用したくなるのはどんな人材か?
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
デジタル・フォレンジックの最新動向(2024年4月27日情洛会総会特別講演スライド)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
NewSQLの可用性構成パターン(OCHaCafe Season 8 #4 発表資料)
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
AWS の OpenShift サービス (ROSA) を使った OpenShift Virtualizationの始め方.pdf
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
モーダル間の変換後の一致性とジャンル表を用いた解釈可能性の考察 ~Text-to-MusicとText-To-ImageかつImage-to-Music...
Featured
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Marius Sescu
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Expeed Software
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
Pixeldarts
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
marketingartwork
Skeleton Culture Code
Skeleton Culture Code
Skeleton Technologies
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Neil Kimberley
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
contently
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Albert Qian
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
Search Engine Journal
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
SpeakerHub
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
How to have difficult conversations
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
Introduction to Data Science
Introduction to Data Science
Christy Abraham Joy
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
Vit Horky
The six step guide to practical project management
The six step guide to practical project management
MindGenius
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
Featured
(20)
2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
Skeleton Culture Code
Skeleton Culture Code
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
Getting into the tech field. what next
Getting into the tech field. what next
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
How to have difficult conversations
How to have difficult conversations
Introduction to Data Science
Introduction to Data Science
Time Management & Productivity - Best Practices
Time Management & Productivity - Best Practices
The six step guide to practical project management
The six step guide to practical project management
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
ライフゲーム最後まで作ってみました
1.
ライフゲーム最後まで 作ってみました kanazawa.rb meetup28 2014/12/20
2.
ライフゲームとは
3.
http://ja.wikipedia.org/wiki/ライフゲーム
4.
設計
5.
meetup26 Coderetreat mini in
Kanazawa.rb
6.
設計ポイント どのセルにおいても周囲に8つのセル が存在するようにし、判定処理を共 通にする
7.
例えば
8.
隅のセルの場合、隣接するセルは3つ ① ②③ ① ②③④ ⑤ 隅以外の1行目セルの場合、隣接するセルは5つ
9.
1つのセルに隣接するセルの数によって 処理が 異なるのは複雑になるため、好 ましくない
10.
状態が変動しない2行2列を追加することに よって常にセルに対して隣接するセルは8つ ① ②③④ ⑤ ⑥ ⑦ ⑧
11.
実装
12.
実装ポイント 状態が変更される前のセル配列で判定 処理を行う為、状態が変更された配列 とは別に保持しておく必要がある
13.
どツボに嵌っちゃいました
14.
変更前の配列がコピーできない
15.
私のRubyでの勘違い cloneやdupはディープコピーではない ディープコピーを使い場合はMarshal
16.
変更前の配列がコピー出来たと持って、 コピー元配列の値を変更すると、コピー 先配列まで値が変わってしまう。
17.
[1] pry(main)> a
= Array.new(3).map { Array.new(3) { Object.new} } => [[#<Object:0x007fdd19c595d8>, #<Object:0x007fdd19c595b0>, #<Object:0x007fdd19c59588>], [#<Object:0x007fdd19c59538>, #<Object:0x007fdd19c59510>, #<Object:0x007fdd19c594e8>], [#<Object:0x007fdd19c59498>, #<Object:0x007fdd19c59470>, #<Object:0x007fdd19c59448>]] [2] pry(main)> b = a.clone => [[#<Object:0x007fdd19c595d8>, #<Object:0x007fdd19c595b0>, #<Object:0x007fdd19c59588>], [#<Object:0x007fdd19c59538>, #<Object:0x007fdd19c59510>, #<Object:0x007fdd19c594e8>], [#<Object:0x007fdd19c59498>, #<Object:0x007fdd19c59470>, #<Object:0x007fdd19c59448>]] 上記のようにcloneだと、コピー元とコピー先 のオブジェクトが同じになってしまう
18.
[1] pry(main)> a
= Array.new(3).map { Array.new(3) { Object.new} } => [[#<Object:0x007fdd19c595d8>, #<Object:0x007fdd19c595b0>, #<Object:0x007fdd19c59588>], [#<Object:0x007fdd19c59538>, #<Object:0x007fdd19c59510>, #<Object:0x007fdd19c594e8>], [#<Object:0x007fdd19c59498>, #<Object:0x007fdd19c59470>, #<Object:0x007fdd19c59448>]] [6] pry(main)> b = Marshal.load(Marshal.dump(a)) => [[#<Object:0x007fdd1d2d5eb8>, #<Object:0x007fdd1d2d5e90>, #<Object:0x007fdd1d2d5e68>], [#<Object:0x007fdd1d2d5e18>, #<Object:0x007fdd1d2d5df0>, #<Object:0x007fdd1d2d5dc8>], [#<Object:0x007fdd1d2d5d78>, #<Object:0x007fdd1d2d5d50>, #<Object:0x007fdd1d2d5d28>]] Marshalを使うことによって、コピー元とコ ピー先のオブジェクトが別物になる
19.
Demo
20.
まとめ 私には45分で設計・実装は無理だと思 い知った。実装だけで90分かかった。 ライフゲーム最後まで作って もやもやがすっきりした。 少しだけRubyの理解が深まった
21.
ご静聴ありがとうございました
Download now