SlideShare a Scribd company logo
Soumettre la recherche
Mettre en ligne
ライフゲーム最後まで作ってみました
Signaler
Keisuke Oohata
Suivre
•
0 j'aime
•
925 vues
1
sur
21
ライフゲーム最後まで作ってみました
•
0 j'aime
•
925 vues
Télécharger maintenant
Télécharger pour lire hors ligne
Signaler
Technologie
Game of Life and I tried to make the last minute
Lire la suite
Keisuke Oohata
Suivre
Recommandé
ES2015のカバレッジ計測
sinsoku listy
2.7K vues
•
27 diapositives
Socket.ioを使ってライフゲームで遊ぶ
孝平 高田
6K vues
•
12 diapositives
Shellを書こう 02 shUnit2を使おう
Keisuke Oohata
1.6K vues
•
28 diapositives
Shellを書こう 01 Shellcheckを使おう
Keisuke Oohata
759 vues
•
14 diapositives
Google SpreadSheetでtwitter bot作ったよ
Keisuke Oohata
1.5K vues
•
18 diapositives
今更だけどSqLite触ってみたよ
Keisuke Oohata
602 vues
•
22 diapositives
Contenu connexe
Dernier
pgvectorを使ってChatGPTとPostgreSQLを連携してみよう!(PostgreSQL Conference Japan 2023 発表資料)
NTT DATA Technology & Innovation
157 vues
•
63 diapositives
テストコードってすごい.pptx
cistb220msudou
72 vues
•
16 diapositives
「概念モデリング自動化に向けた第一歩」 ~ ChatGPT・Open AI 活用による開発対象のモデル化
Knowledge & Experience
6 vues
•
34 diapositives
01Booster Studio ご紹介資料
ssusere7a2172
209 vues
•
19 diapositives
マネージドPostgreSQLの実現に向けたPostgreSQL機能向上(PostgreSQL Conference Japan 2023 発表資料)
NTT DATA Technology & Innovation
208 vues
•
33 diapositives
DLゼミ: MobileOne: An Improved One millisecond Mobile Backbone
harmonylab
41 vues
•
30 diapositives
Dernier
(10)
pgvectorを使ってChatGPTとPostgreSQLを連携してみよう!(PostgreSQL Conference Japan 2023 発表資料)
NTT DATA Technology & Innovation
•
157 vues
テストコードってすごい.pptx
cistb220msudou
•
72 vues
「概念モデリング自動化に向けた第一歩」 ~ ChatGPT・Open AI 活用による開発対象のモデル化
Knowledge & Experience
•
6 vues
01Booster Studio ご紹介資料
ssusere7a2172
•
209 vues
マネージドPostgreSQLの実現に向けたPostgreSQL機能向上(PostgreSQL Conference Japan 2023 発表資料)
NTT DATA Technology & Innovation
•
208 vues
DLゼミ: MobileOne: An Improved One millisecond Mobile Backbone
harmonylab
•
41 vues
概念モデリングワークショップ 基礎編
Knowledge & Experience
•
19 vues
概念モデリングワークショップ 設計編
Knowledge & Experience
•
10 vues
JJUG CCC.pptx
Kanta Sasaki
•
6 vues
さくらのひやおろし2023
法林浩之
•
76 vues
En vedette
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
19.3K vues
•
69 diapositives
Getting into the tech field. what next
Tessa Mero
4.8K vues
•
22 diapositives
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
5.6K vues
•
99 diapositives
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
4.1K vues
•
19 diapositives
Introduction to Data Science
Christy Abraham Joy
82.1K vues
•
51 diapositives
Time Management & Productivity - Best Practices
Vit Horky
169.6K vues
•
42 diapositives
En vedette
(20)
ChatGPT and the Future of Work - Clark Boyd
Clark Boyd
•
19.3K vues
Getting into the tech field. what next
Tessa Mero
•
4.8K vues
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Lily Ray
•
5.6K vues
How to have difficult conversations
Rajiv Jayarajah, MAppComm, ACC
•
4.1K vues
Introduction to Data Science
Christy Abraham Joy
•
82.1K vues
Time Management & Productivity - Best Practices
Vit Horky
•
169.6K vues
The six step guide to practical project management
MindGenius
•
36.6K vues
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
RachelPearson36
•
12.5K vues
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Applitools
•
55.4K vues
12 Ways to Increase Your Influence at Work
GetSmarter
•
401.6K vues
ChatGPT webinar slides
Alireza Esmikhani
•
30.3K vues
More than Just Lines on a Map: Best Practices for U.S Bike Routes
Project for Public Spaces & National Center for Biking and Walking
•
6.9K vues
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
DevGAMM Conference
•
3.6K vues
Barbie - Brand Strategy Presentation
Erica Santiago
•
25.1K vues
Good Stuff Happens in 1:1 Meetings: Why you need them and how to do them well
Saba Software
•
25.2K vues
Introduction to C Programming Language
Simplilearn
•
8.4K vues
The Pixar Way: 37 Quotes on Developing and Maintaining a Creative Company (fr...
Palo Alto Software
•
88.3K vues
9 Tips for a Work-free Vacation
Weekdone.com
•
7.2K vues
I Rock Therefore I Am. 20 Legendary Quotes from Prince
Empowered Presentations
•
142.8K vues
How to Map Your Future
SlideShop.com
•
275.1K vues
ライフゲーム最後まで作ってみました
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.
ご静聴ありがとうございました