Suche senden
Hochladen
貪食蛇
•
20 gefällt mir
•
5,388 views
Weizhong Yang
Folgen
Technologie
Unterhaltung & Humor
Melden
Teilen
Melden
Teilen
1 von 29
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
MOPCON 2017
苦集滅道:透過開發客製 Sketch Plug-in 改善產品設計流程
苦集滅道:透過開發客製 Sketch Plug-in 改善產品設計流程
Weizhong Yang
Html 5 native drag
Html 5 native drag
Weizhong Yang
Retina mac
Retina mac
Weizhong Yang
創異數位Inspire Digital網路技術分享-Flash actionscritp class
Inspire dgt 網路技術分享_flash actionscritp class
Inspire dgt 網路技術分享_flash actionscritp class
inspire digital
a utility-belt library for JavaScript By zfcao@corp.netease.com at 2012-09-07
Underscore
Underscore
cazhfe
如何攻破大型副本 大型專案的開發與團隊合作經驗 聊天室 - Sky
如何攻破大型副本 大型專案的開發與團隊合作經驗 聊天室
如何攻破大型副本 大型專案的開發與團隊合作經驗 聊天室
Study4TW
在 Javascript 的世界中,最重要的事情之一就是如何處理非同步的程式碼,從早期的 Callback function 和 Promise ,一直到最近的 Generator 和 Async/ Await 都各有其優缺點,這次將向大家從頭開始回顧在 Javascript 非同步的原理,以及撰寫非同步程式的各種方式! • Javascript 與非同步 • callback, promise 的基本介紹與回顧 • genertor 的出現及設計精神 • 使用 async/ await 讓非同步程式更簡潔
關於 Javascript 非同步的那些事兒 公開版
關於 Javascript 非同步的那些事兒 公開版
Kirk Chen
要将 Angular 写好,必须搭配观念与开发技巧,观念让你头脑清楚,知道下一步要做什么。开发技巧则帮助你更容易进入编程的心流模式。本次演说将分享多个 Angular 实战现场常见的开发技巧,搭配 Angular CLI 与 Schematics,以及 Visual Studio Code 与 Angular Extension Pack 扩充套件,通过演示让大家看见极速开发的可能性。
Angular 开发技巧 (2018 ngChina 开发者大会)
Angular 开发技巧 (2018 ngChina 开发者大会)
Will Huang
Empfohlen
MOPCON 2017
苦集滅道:透過開發客製 Sketch Plug-in 改善產品設計流程
苦集滅道:透過開發客製 Sketch Plug-in 改善產品設計流程
Weizhong Yang
Html 5 native drag
Html 5 native drag
Weizhong Yang
Retina mac
Retina mac
Weizhong Yang
創異數位Inspire Digital網路技術分享-Flash actionscritp class
Inspire dgt 網路技術分享_flash actionscritp class
Inspire dgt 網路技術分享_flash actionscritp class
inspire digital
a utility-belt library for JavaScript By zfcao@corp.netease.com at 2012-09-07
Underscore
Underscore
cazhfe
如何攻破大型副本 大型專案的開發與團隊合作經驗 聊天室 - Sky
如何攻破大型副本 大型專案的開發與團隊合作經驗 聊天室
如何攻破大型副本 大型專案的開發與團隊合作經驗 聊天室
Study4TW
在 Javascript 的世界中,最重要的事情之一就是如何處理非同步的程式碼,從早期的 Callback function 和 Promise ,一直到最近的 Generator 和 Async/ Await 都各有其優缺點,這次將向大家從頭開始回顧在 Javascript 非同步的原理,以及撰寫非同步程式的各種方式! • Javascript 與非同步 • callback, promise 的基本介紹與回顧 • genertor 的出現及設計精神 • 使用 async/ await 讓非同步程式更簡潔
關於 Javascript 非同步的那些事兒 公開版
關於 Javascript 非同步的那些事兒 公開版
Kirk Chen
要将 Angular 写好,必须搭配观念与开发技巧,观念让你头脑清楚,知道下一步要做什么。开发技巧则帮助你更容易进入编程的心流模式。本次演说将分享多个 Angular 实战现场常见的开发技巧,搭配 Angular CLI 与 Schematics,以及 Visual Studio Code 与 Angular Extension Pack 扩充套件,通过演示让大家看见极速开发的可能性。
Angular 开发技巧 (2018 ngChina 开发者大会)
Angular 开发技巧 (2018 ngChina 开发者大会)
Will Huang
產出物管理與 Continue Integration & Continue Deployment 的進化之路
Artifacts management with CI and CD
Artifacts management with CI and CD
Chen-Tien Tsai
WEIC 2015 Docker Introduction TA: Student
Weic2015 docker
Weic2015 docker
Ray Lin
SITCON 6/13 雲林聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
Lorex L. Yang
Pytorch 架構介紹
[students AI workshop] Pytorch
[students AI workshop] Pytorch
Tzu-Wei Huang
构建可维护的Javascript 小米网
构建可维护的Javascript 小米网
yang alex
Introducing the cutting-edge stuffs every F2E developers should aware of in 2016.
2016 前端潮玩意兒
2016 前端潮玩意兒
Maxis Kao
node js 入门,by展烨
Node分享 展烨
Node分享 展烨
tb-vertical-guide
与Python一路走来
与Python一路走来
leejd
採用 RESTful Web API 架構可以大幅節省網路傳輸,與使用者更新頁面的時間。但是該從何開始呢?我們將以分別示範與說明前端與後端的程式碼,透過 AJAX 與 Post 呼叫後端 RESTful API,從範例中分享實作經驗。
以Code igniter為基礎的網頁前端程式設計
以Code igniter為基礎的網頁前端程式設計
Amigo 陳兆祥
COSCUP 2016 Keynote speech - Talking about how to write high performance application and service from hardware, operation system to application level.
寫出高性能的服務與應用 那些你沒想過的事
寫出高性能的服務與應用 那些你沒想過的事
Chieh (Jack) Yu
The concept of cloud computing has been introduced for several years. Many of us may be able to roughly imagine what it is, some of us may know how to describe it, but only a few do know how to implement it. Does NoSQL, MapReduce or Big Data equal to cloud computing? Can a service be said that it is cloud-based if it is using any of those tools? Many companies and groups have declared that their online services are cloud-based or they are using cloud computing, but are those all true? Except for the questions above, where should we start if we would like to establish a cloud-based service which is distributed, flexible, reliable, available, scalable and stable? This session intends to lead you through the gate of mysteries and head to the beautiful realm of cloud computing by using powerful tools, like Hazelcast. Welcome to journey with us to the core of cloud computing application! https://cyberjos.blog/java/seminar/jcconf-2014-establish-the-core-of-cloud-computing-application-by-using-hazelcast/
Establish The Core of Cloud Computing Application by Using Hazelcast (Chinese)
Establish The Core of Cloud Computing Application by Using Hazelcast (Chinese)
Joseph Kuo
Introduction to big data
Introduction to big data
Introduction to big data
邦宇 叶
Efficient Content Authoring Tools and Pipeline for Inter-Studio Asset Development With the complexity of today's video games and their associated tight timelines, it is paramount for video game studios to have a highly efficient content authoring process and production workflow. With a trend towards outsourced development of game assets, there are additional considerations that are important for achieving optimal workflow between studios that are co-developing or sharing assets. This lecture gives valuable insight into how to create new content authoring tools and data transformation pipelines that promote efficient work flow for both internal and remote production teams. Specific considerations for outsourcing and worldwide development are made along the way.
Maximize Your Production Effort (Chinese)
Maximize Your Production Effort (Chinese)
slantsixgames
Explain why Go is also suitable for building large website with actual example.
Go for web
Go for web
Weng Wei
使用Dsl改善软件设计
使用Dsl改善软件设计
mingjin
我離開前公司前,對三個 Android 工程師做的 iOS 入門教學投影片
iOS 入門教學
iOS 入門教學
Steven Shen
對一個完全沒有接觸過 Kubernetes 的開發人員來說,要憑空想像這個全新架構,經常鴨子聽雷,摸不著頭緒。多奇數位創意在導入 Kubernetes 的過程中,就遇到了這個問題。 以至於在開發人員與 IT 人員溝通的過程中,產生了極大落差。保哥將在本次演說分享,多奇數位創意如何在實際導入 Kubernetes 架構的過程中,如何有效跟開發人員溝通,讓大家了解這個全新的平台跟開發人員之間的關係為何。 講者的話: 讓開發人員也能了解 Kubernetes 為他們帶來的效益,以及在 DevOps 的過程中如何有效溝通。 https://summit.ithome.com.tw/kubernetes/
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
Will Huang
Kubernetes 是時下最流行的自動化容器操作平台,它可以幫助我們在彈指之前把 Docker 容易輕易的部署到大規模的系統服務上,很輕鬆的做到 Rolling Update 或是自動擴展等功能,本次的分享將會向大家介紹 Kubernetes 這套平台的各種特色與如何在 Google Cloud Platform 上架設使用自己的 Kubernetes 服務!
Kubernetes on gcp
Kubernetes on gcp
Tech Podcast Night
什麼是智慧檯燈呢?快和凱文一起打造屬於你的智慧檯燈吧!
【1110ROS社群開講】如何打造與人一起學習的機器檯燈_鄭凱文
【1110ROS社群開講】如何打造與人一起學習的機器檯燈_鄭凱文
MAKERPRO.cc
1. 當 Bot 無法滿足顧客時,客服可接手Bot與顧客互動 2. 結合 QnA Maker 快速處理常見問題 3. 結合 KM (知識管理),打造智能小幫手
智能 Bot 應用情境分享
智能 Bot 應用情境分享
Tech Podcast Night
使用 Flutter 開發藍芽應用
Flutter BLE
Flutter BLE
Weizhong Yang
放置地圖 Widget 新增 Marker 新增 Polyline 計算 zoom level 顯示 information window 移動地圖、設定樣式 其他…
怎樣在 Flutter app 中使用 Google Maps
怎樣在 Flutter app 中使用 Google Maps
Weizhong Yang
Weitere ähnliche Inhalte
Ähnlich wie 貪食蛇
產出物管理與 Continue Integration & Continue Deployment 的進化之路
Artifacts management with CI and CD
Artifacts management with CI and CD
Chen-Tien Tsai
WEIC 2015 Docker Introduction TA: Student
Weic2015 docker
Weic2015 docker
Ray Lin
SITCON 6/13 雲林聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
Lorex L. Yang
Pytorch 架構介紹
[students AI workshop] Pytorch
[students AI workshop] Pytorch
Tzu-Wei Huang
构建可维护的Javascript 小米网
构建可维护的Javascript 小米网
yang alex
Introducing the cutting-edge stuffs every F2E developers should aware of in 2016.
2016 前端潮玩意兒
2016 前端潮玩意兒
Maxis Kao
node js 入门,by展烨
Node分享 展烨
Node分享 展烨
tb-vertical-guide
与Python一路走来
与Python一路走来
leejd
採用 RESTful Web API 架構可以大幅節省網路傳輸,與使用者更新頁面的時間。但是該從何開始呢?我們將以分別示範與說明前端與後端的程式碼,透過 AJAX 與 Post 呼叫後端 RESTful API,從範例中分享實作經驗。
以Code igniter為基礎的網頁前端程式設計
以Code igniter為基礎的網頁前端程式設計
Amigo 陳兆祥
COSCUP 2016 Keynote speech - Talking about how to write high performance application and service from hardware, operation system to application level.
寫出高性能的服務與應用 那些你沒想過的事
寫出高性能的服務與應用 那些你沒想過的事
Chieh (Jack) Yu
The concept of cloud computing has been introduced for several years. Many of us may be able to roughly imagine what it is, some of us may know how to describe it, but only a few do know how to implement it. Does NoSQL, MapReduce or Big Data equal to cloud computing? Can a service be said that it is cloud-based if it is using any of those tools? Many companies and groups have declared that their online services are cloud-based or they are using cloud computing, but are those all true? Except for the questions above, where should we start if we would like to establish a cloud-based service which is distributed, flexible, reliable, available, scalable and stable? This session intends to lead you through the gate of mysteries and head to the beautiful realm of cloud computing by using powerful tools, like Hazelcast. Welcome to journey with us to the core of cloud computing application! https://cyberjos.blog/java/seminar/jcconf-2014-establish-the-core-of-cloud-computing-application-by-using-hazelcast/
Establish The Core of Cloud Computing Application by Using Hazelcast (Chinese)
Establish The Core of Cloud Computing Application by Using Hazelcast (Chinese)
Joseph Kuo
Introduction to big data
Introduction to big data
Introduction to big data
邦宇 叶
Efficient Content Authoring Tools and Pipeline for Inter-Studio Asset Development With the complexity of today's video games and their associated tight timelines, it is paramount for video game studios to have a highly efficient content authoring process and production workflow. With a trend towards outsourced development of game assets, there are additional considerations that are important for achieving optimal workflow between studios that are co-developing or sharing assets. This lecture gives valuable insight into how to create new content authoring tools and data transformation pipelines that promote efficient work flow for both internal and remote production teams. Specific considerations for outsourcing and worldwide development are made along the way.
Maximize Your Production Effort (Chinese)
Maximize Your Production Effort (Chinese)
slantsixgames
Explain why Go is also suitable for building large website with actual example.
Go for web
Go for web
Weng Wei
使用Dsl改善软件设计
使用Dsl改善软件设计
mingjin
我離開前公司前,對三個 Android 工程師做的 iOS 入門教學投影片
iOS 入門教學
iOS 入門教學
Steven Shen
對一個完全沒有接觸過 Kubernetes 的開發人員來說,要憑空想像這個全新架構,經常鴨子聽雷,摸不著頭緒。多奇數位創意在導入 Kubernetes 的過程中,就遇到了這個問題。 以至於在開發人員與 IT 人員溝通的過程中,產生了極大落差。保哥將在本次演說分享,多奇數位創意如何在實際導入 Kubernetes 架構的過程中,如何有效跟開發人員溝通,讓大家了解這個全新的平台跟開發人員之間的關係為何。 講者的話: 讓開發人員也能了解 Kubernetes 為他們帶來的效益,以及在 DevOps 的過程中如何有效溝通。 https://summit.ithome.com.tw/kubernetes/
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
Will Huang
Kubernetes 是時下最流行的自動化容器操作平台,它可以幫助我們在彈指之前把 Docker 容易輕易的部署到大規模的系統服務上,很輕鬆的做到 Rolling Update 或是自動擴展等功能,本次的分享將會向大家介紹 Kubernetes 這套平台的各種特色與如何在 Google Cloud Platform 上架設使用自己的 Kubernetes 服務!
Kubernetes on gcp
Kubernetes on gcp
Tech Podcast Night
什麼是智慧檯燈呢?快和凱文一起打造屬於你的智慧檯燈吧!
【1110ROS社群開講】如何打造與人一起學習的機器檯燈_鄭凱文
【1110ROS社群開講】如何打造與人一起學習的機器檯燈_鄭凱文
MAKERPRO.cc
1. 當 Bot 無法滿足顧客時,客服可接手Bot與顧客互動 2. 結合 QnA Maker 快速處理常見問題 3. 結合 KM (知識管理),打造智能小幫手
智能 Bot 應用情境分享
智能 Bot 應用情境分享
Tech Podcast Night
Ähnlich wie 貪食蛇
(20)
Artifacts management with CI and CD
Artifacts management with CI and CD
Weic2015 docker
Weic2015 docker
快速入坑 Node.js - 0613 SITCON 雲林定期聚
快速入坑 Node.js - 0613 SITCON 雲林定期聚
[students AI workshop] Pytorch
[students AI workshop] Pytorch
构建可维护的Javascript 小米网
构建可维护的Javascript 小米网
2016 前端潮玩意兒
2016 前端潮玩意兒
Node分享 展烨
Node分享 展烨
与Python一路走来
与Python一路走来
以Code igniter為基礎的網頁前端程式設計
以Code igniter為基礎的網頁前端程式設計
寫出高性能的服務與應用 那些你沒想過的事
寫出高性能的服務與應用 那些你沒想過的事
Establish The Core of Cloud Computing Application by Using Hazelcast (Chinese)
Establish The Core of Cloud Computing Application by Using Hazelcast (Chinese)
Introduction to big data
Introduction to big data
Maximize Your Production Effort (Chinese)
Maximize Your Production Effort (Chinese)
Go for web
Go for web
使用Dsl改善软件设计
使用Dsl改善软件设计
iOS 入門教學
iOS 入門教學
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
開發人員必須知道的 Kubernetes 核心技術 - Kubernetes Summit 2018
Kubernetes on gcp
Kubernetes on gcp
【1110ROS社群開講】如何打造與人一起學習的機器檯燈_鄭凱文
【1110ROS社群開講】如何打造與人一起學習的機器檯燈_鄭凱文
智能 Bot 應用情境分享
智能 Bot 應用情境分享
Mehr von Weizhong Yang
使用 Flutter 開發藍芽應用
Flutter BLE
Flutter BLE
Weizhong Yang
放置地圖 Widget 新增 Marker 新增 Polyline 計算 zoom level 顯示 information window 移動地圖、設定樣式 其他…
怎樣在 Flutter app 中使用 Google Maps
怎樣在 Flutter app 中使用 Google Maps
Weizhong Yang
我對於義務役役期的想法
關於延長役期這件事情
關於延長役期這件事情
Weizhong Yang
Cocoaheads Taipei March 2021
Dart null safety
Dart null safety
Weizhong Yang
GDG DevFest 2019
導入 Flutter 前你應該知道的事
導入 Flutter 前你應該知道的事
Weizhong Yang
Oct 17 2019. Cocoaheads Taipei.
Github Actions
Github Actions
Weizhong Yang
iPlayground: CarPlay and MFI Hearing Aids
iPlayground: CarPlay and MFI Hearing Aids
iPlayground: CarPlay and MFI Hearing Aids
Weizhong Yang
2018/12/13 Cocoaheads Taipei
CocoaPods private repo
CocoaPods private repo
Weizhong Yang
Flutter 踩雷心得
Flutter 踩雷心得
Flutter 踩雷心得
Weizhong Yang
2018 iPlayground Keynote
那些年被蘋果 Ban 掉的 API
那些年被蘋果 Ban 掉的 API
Weizhong Yang
給 iOS 工程師的 Flutter 開發
給 iOS 工程師的 Flutter 開發
給 iOS 工程師的 Flutter 開發
Weizhong Yang
App 工程師有時候也得要點一下前端開發技能。
給 iOS 工程師的 Vue.js 開發
給 iOS 工程師的 Vue.js 開發
Weizhong Yang
KKBOX 內部分享
使用 switch/case 重構程式碼
使用 switch/case 重構程式碼
Weizhong Yang
不要寫 if。如果非要寫 if,不要亂寫 if。
怎樣寫出比較沒有問題的 Code
怎樣寫出比較沒有問題的 Code
Weizhong Yang
Aspect Oriented Programming
Aspect Oriented Programming
Weizhong Yang
AVFoundation 與 Core Audio 簡介
Mac OS X 與 iOS 的 Audio API
Mac OS X 與 iOS 的 Audio API
Weizhong Yang
Python 的文件系統
Python 的文件系統
Weizhong Yang
Input Method Kit
Input Method Kit
Weizhong Yang
我所知道的 Refactoring 小技巧 :)
Refactoring
Refactoring
Weizhong Yang
Core animation
Core animation
Weizhong Yang
Mehr von Weizhong Yang
(20)
Flutter BLE
Flutter BLE
怎樣在 Flutter app 中使用 Google Maps
怎樣在 Flutter app 中使用 Google Maps
關於延長役期這件事情
關於延長役期這件事情
Dart null safety
Dart null safety
導入 Flutter 前你應該知道的事
導入 Flutter 前你應該知道的事
Github Actions
Github Actions
iPlayground: CarPlay and MFI Hearing Aids
iPlayground: CarPlay and MFI Hearing Aids
CocoaPods private repo
CocoaPods private repo
Flutter 踩雷心得
Flutter 踩雷心得
那些年被蘋果 Ban 掉的 API
那些年被蘋果 Ban 掉的 API
給 iOS 工程師的 Flutter 開發
給 iOS 工程師的 Flutter 開發
給 iOS 工程師的 Vue.js 開發
給 iOS 工程師的 Vue.js 開發
使用 switch/case 重構程式碼
使用 switch/case 重構程式碼
怎樣寫出比較沒有問題的 Code
怎樣寫出比較沒有問題的 Code
Aspect Oriented Programming
Aspect Oriented Programming
Mac OS X 與 iOS 的 Audio API
Mac OS X 與 iOS 的 Audio API
Python 的文件系統
Python 的文件系統
Input Method Kit
Input Method Kit
Refactoring
Refactoring
Core animation
Core animation
貪食蛇
1.
⼤大家來寫 貪⻝⾷食蛇!
2.
About me
3.
About me • Lead
iOS/Mac Developer at KKBOX • Mac developer since2005, iOS developer since2008 • Other projects:Yahoo KeyKey! Boshiamy X1, Hami Music for iOS, and so on. • I do C, Objective-C, and Python
4.
5.
我覺得是不錯的練習 • MVC架構 • DTO
(Data Transfer Objects) • Quartz 2D 平⾯面繪圖 • Delegate/Protocol 設計 • Queue資料結構 • NSTimer
6.
應該三個多⼩小時可以 寫出來… (我⾃自⼰己寫過⼀一遍) 還是⼀一邊看環法賽⼀一邊很不專⼼心的寫
7.
8.
KKBOX的iOS訓練 • Selector⇢⼩小算盤 • ⼿手動記憶體管理 •
Category⇢字串反轉 • Delegate⇢API包裝/Unit Test • Block⇢API包裝 • OperationQueue⇢API包裝 • Quartz 2D與Notification⇢填字遊戲 • NSCoder/Sqlite/Localization…⇢看書練習 • CoreAnimation⇢動態歌詞 • UIAutomation 與 Accessibility • Audio API⇢Audio Player ⼤大概是在 這個地⽅方
9.
貪⻝⾷食蛇? • 蛇的⾝身體所在位置 • 蛇現在的⻑⾧長度?吃到⽔水 果之後,往那邊變⻑⾧長? •
蛇的現在的移動⽅方向? 怎麼改變⽅方向? • 蛇超出邊界該怎麼辦? 邊界有多⼤大? • ⽔水果的位置 • 是不是吃到了⽔水果 • 吃到⽔水果之後,下⼀一個 ⽔水果在哪裡? • 該怎麼畫蛇跟⽔水果? • 頭撞到⾝身體了嗎? 我們應該如何妥當處理這些東⻄西?
10.
物件封裝 • 我們在畫⾯面中有⼀一條蛇 • 屬性:⾝身體的位置、蛇的⽅方向 •
⽅方法:改變⽅方向、移動⼀一格
11.
MVC架構 • Model:我們的蛇與⽔水果的Point • View:繪製蛇與⽔水果的View •
Controller: • 分派⽔水果的位置 • 使⽤用 Timer更新蛇的狀態、檢查是否吃 到⽔水果與撞到⾝身體 • 接收改變蛇的⽅方向的Touch事件
12.
實作流程 • 撰寫蛇的Model • 對蛇的Model做單元測試 •
撰寫繪製蛇與⽔水果的View • 撰寫Controller • 整合!
13.
Model
14.
我們應該如何描述蛇 與⽔水果的位置? • 我們可以使⽤用CGPoint • 不過不是很好,CGPoint的x與y是float •
我們希望x與y是整數
15.
Data Transfer Objects •
只有屬性,沒有⽅方法的物件 • 當成 Structure 來⽤用 • 在Cocoa裡頭,我們也可以將 Structure 包進NSValue裡頭就是了… • [NSValue valueWithBytes: objCType:];
16.
蛇的⾝身體的資料結構 • 不要想得太複雜,蛇的移動並不是⾝身體 的每個點都在移動 • 其實就只是,在頭的地⽅方增加⼀一個點, 然後把尾巴那個點去掉 •
先進先出⇢Queue
17.
18.
蛇的⽅方向 • 蛇應該要知道⾃自⼰己的⽅方向 • 改變⽅方向只能90度: •
往左右⾛走,只能改成上下 • 往上下⾛走,只能改成左右
19.
單元測試
20.
3A原則 • Arrange • Act •
Assert
21.
單元測試 • 我們的DTO裡頭的屬性是否正確? • 建⽴立蛇之後,⻑⾧長度位置是否正確? •
移動蛇之後,位置是否正確? • 把蛇的⾝身體加⻑⾧長之後,是否有加對? • 蛇是否會正確撞到⾃自⼰己⾝身體?
22.
View
23.
View • View 要跟Controller詢問蛇與⽔水果在哪裡 •
我們可以把蛇與⽔水果變成View的屬性, 從Controller設過去,但是這樣Controller 就要定時更新View,這樣很醜 • ⽐比較好的作法是,把Controller變成View 的delegate
24.
View • Subclass ⼀一個UIView •
實作drawRect: • 在drawRect:裡頭問delegate蛇與⽔水果在哪 • ⽤用UIBezierPath畫就好 • 所以我們要設計⼀一個詢問蛇與⽔水果在哪 的protocol
25.
Delegation/Protocol • @property (weak)
id <Protocol> delegate; • 然後設計⼀一組 Protocol • 例 -(Snake *)viewDidRequestSnake:(View *)v; • Controller要去實作delegate methods
26.
Controller
27.
Controller • 成員變數 • 蛇的Model •
⽔水果的Model • 繪製蛇與⽔水果View • 遊戲歡迎與結束畫⾯面 • Timer
28.
Controller • 如何接收Swipe事件? • ⽤用UIGestureRecognizer
29.
Let’s Do It!
Jetzt herunterladen