SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Y-Tiles
iPhone Application
Chris Yunker
STL Mobile Dev Meeting
June 24, 2010
Why Y-Tiles?
• Simple, enjoyable game everyone understands
• Development touches a lot areas (graphics, touch
screen, camera, accelerometer, etc.)
Why The Name “Y-Tiles”?
• When I started development, there were already
over 25 implementations of this game
• I had to find a unique name so I added the first letter
of my last name
Development Details
• Hardware: iPhone 3G (16G)
• SDK: 2.2.1
• Development Time: 2-3 months
• Submitted to App Store: March 4, 2009
• Downloads: +2000 in last 26 weeks (according
to iTunes Connect App)
Fifteen Puzzle Game
The n-puzzle is known in various versions,
including the 8 puzzle, the 15 puzzle, and with
various names (Gem Puzzle, Boss Puzzle, Game of
Fifteen, Mystic Square and many others). It is a
sliding puzzle that consists of a frame of numbered
square tiles in random order with one tile missing.
If the size is 3×3, the puzzle is called the 8-puzzle
or 9-puzzle, and if 4×4, the puzzle is called the 15-
puzzle or 16-puzzle. The object of the puzzle is to
place the tiles in order (see diagram) by making
sliding moves that use the empty space.
http://en.wikipedia.org/wiki/Fifteen_puzzle
Top Level Views
Board Tab Photo Selection Tab Settings Tab
Board Types
Photo With NumbersPhotoTiles
Photo Selector
Camera PhotoDefault Photos
• Application contains 4 default photos
• User can take a new photo or use an existing photo
Settings
Settings Tab
•Board size: 3-6 rows / 3-6 columns
•Photo or numbered tiles
•Enable number tags on photo tiles
•Enable sound
Note: Changing the photo (from the Photo
Selector Tab) or the board size will trigger
a restart of game
Object Diagram
Board Controller
(UIViewController)
Photo Controller
(UIViewController)
Settings Controller
(UIViewController)
Tab Bar Controller
(UITabBarController)
Board
(UIView)
Tile (0-N)
(UIImageView
)
(Rows × Columns – 1) Tiles
Create Photo Tiles
Tile frame size is calculated from number of
rows/columns
Foreach Row/Column Coordinate
{
Image = CGImageCreateWithImageInRect
Create Tile object
}
Remove last Tile (bottom right)
Create Rounded Tile Image
Define the fill area with a CGMutablePathRef using two concentric polygons
• Create rectangle path with CGPathAddLineToPoint
• Create rounded path with CGPathAddLineToPoint and CGPathAddArcToPoint
Fill in area between the two polygons with CGContextEOFillPath (Even/Odd Fill)
Rectangle Path Rounded Path Filled In PathPhoto Image
Board Object
• Extends UIView object
• 2D array contains board state with pointers to all
tiles
• Emits a tick sound for each tile move
• Pauses board with a transparent overlay and
setting UserInteractionEnabled:NO
1 2 3 N
Tile Object
• Extends UIImageView object
• Numeric ID (Numeric Tile or Numeric Photo Tag)
• Home coordinate
• Movable State (Up/Down/Left/Right/None)
• Pointer to adjacent push tile (if applicable)
• Pointer to board object
1
Game Algorithm 1
N N N N
N N N N
N N N
N N N N
Iterate through all tiles in board
Foreach Tile in Board
{
Set MovableState:None
Is Tile solved?
}
Is Board solved?
Game Algorithm 2
N D N N
N D N N
R L L
N U N N
Start at empty spot and iterate through
tiles in same row and column
Foreach Tile Row/Column
{
Set MovableState:Up/Down/Left/Right
Set PushTile pointer (if applicable)
}
Game Algorithm 3
N D N N
N D N N
R L L
N U N N
• The Tile class can receive touches since it extends
UIImageView which extends UIResponder
• The Tile class implements these methods to
handle touches
touchesBegan(NSSet *, UIEvent *)
touchesMoved(NSSet *, UIEvent *)
touchesEnded(NSSet *, UIEvent *)
touchesCancelled(NSSet *, UIEvent *)
• To prevent multiple tiles from moving, an NSLock
object is used
Game Algorithm 4
When a Tile receives a touchesBegan event, it will respond if it’s in a movable
state and can acquire the lock.
The Tile will slide with the relative location provided by the touchesMoved
event. Its movement will be constrained by the empty area. If the Tile is pushing
another Tile, it will slide it the same distance via its PushTile pointer.
When the touch is done, the Tile will receive a touchesEnded event. If the Tile
has moved less than half the distance, it will snap to its original location. If it has
moved more than half the distance, it will snap to the empty location.
When a Tile moves, it communicates this back to the Board so it can update.
15 9 15 9
Accelerometer
Restart Menu
The Accelerometer is used so users can
restart/reshuffle the board
• Accelerometer provides a 3D g-force
vector at a configured interval (1/30 sec)
• A valid shake is when the g-force vector
delta exceeds a configured threshold in 2
of the 3 dimensions
• Shake counter is incremented for valid
shake
• Shake counter is reset for invalid shake
• Restart menu is triggered when counter
equals 3 shakes
Performance
• Coded application with an “Optimize Later”
philosophy
• Great game performance; Tiles are very
responsive
• Camera Photo Selector can cause memory
warnings
• Board generation can take 4-8 seconds
depending on size
Version 2.0
• Save game state
• Improve board generation time
• iAd
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...
ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...
ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...Oluwasegun Oluwaseun Onibudo
 
Image classification-in-idrisi-and-ilwis
Image classification-in-idrisi-and-ilwisImage classification-in-idrisi-and-ilwis
Image classification-in-idrisi-and-ilwisFemi Opaleye
 
Advanced techniques for development of 2D Windows 8 games
Advanced techniques for development of 2D Windows 8 gamesAdvanced techniques for development of 2D Windows 8 games
Advanced techniques for development of 2D Windows 8 gamesMicrosoft Schweiz
 
spatial anaylisi using ilwis
spatial anaylisi using ilwisspatial anaylisi using ilwis
spatial anaylisi using ilwisAsri Renggo
 
ARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityGilbert Guerrero
 
Quantum Computing - Are We There Yet?
Quantum Computing - Are We There Yet?Quantum Computing - Are We There Yet?
Quantum Computing - Are We There Yet?Ciprian Jichici
 

Was ist angesagt? (9)

ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...
ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...
ILWIS Manual, ILWIS Practical, ILWIS Guide, Onidex Geo-Spatial Solutions (ilw...
 
Image classification-in-idrisi-and-ilwis
Image classification-in-idrisi-and-ilwisImage classification-in-idrisi-and-ilwis
Image classification-in-idrisi-and-ilwis
 
Advanced techniques for development of 2D Windows 8 games
Advanced techniques for development of 2D Windows 8 gamesAdvanced techniques for development of 2D Windows 8 games
Advanced techniques for development of 2D Windows 8 games
 
spatial anaylisi using ilwis
spatial anaylisi using ilwisspatial anaylisi using ilwis
spatial anaylisi using ilwis
 
3d game engine
3d game engine3d game engine
3d game engine
 
LarsDu_Final
LarsDu_FinalLarsDu_Final
LarsDu_Final
 
ARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting InteractivityARTDM 170, Week 7: Scripting Interactivity
ARTDM 170, Week 7: Scripting Interactivity
 
Python GUI
Python GUIPython GUI
Python GUI
 
Quantum Computing - Are We There Yet?
Quantum Computing - Are We There Yet?Quantum Computing - Are We There Yet?
Quantum Computing - Are We There Yet?
 

Ähnlich wie Y Tiles

libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationJussi Pohjolainen
 
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)Karel Van Isacker
 
4.4 advanced games
4.4   advanced games4.4   advanced games
4.4 advanced gamesallenbailey
 
Presentatie Willem En Kevin
Presentatie Willem En KevinPresentatie Willem En Kevin
Presentatie Willem En Kevingueste26e85
 
Run and jump tutorial (part 2) scenes
Run and jump tutorial (part 2)   scenesRun and jump tutorial (part 2)   scenes
Run and jump tutorial (part 2) scenesMuhd Basheer
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platformgoodfriday
 
Galactic Wars XNA Game
Galactic Wars XNA GameGalactic Wars XNA Game
Galactic Wars XNA GameSohil Gupta
 
Lecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingLecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingKobkrit Viriyayudhakorn
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac ToeSarthak Srivastava
 
Unity introduction for programmers
Unity introduction for programmersUnity introduction for programmers
Unity introduction for programmersNoam Gat
 
Hi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdfHi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdffonecomp
 
Academy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. EnvironmentAcademy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. EnvironmentBinary Studio
 
The Ring programming language version 1.7 book - Part 53 of 196
The Ring programming language version 1.7 book - Part 53 of 196The Ring programming language version 1.7 book - Part 53 of 196
The Ring programming language version 1.7 book - Part 53 of 196Mahmoud Samir Fayed
 
Project report 393_395
Project report 393_395Project report 393_395
Project report 393_395VishruthKhare
 
Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2Marlon Luz
 
Monogame and xna
Monogame and xnaMonogame and xna
Monogame and xnaLee Stott
 

Ähnlich wie Y Tiles (20)

libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
Gui programming
Gui programmingGui programming
Gui programming
 
TIC-TAC-TOE IN C
TIC-TAC-TOE IN CTIC-TAC-TOE IN C
TIC-TAC-TOE IN C
 
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)
iPlayset: Tangible Interface that brings Toys to life (Eiman Kanjo)
 
libGDX: User Input
libGDX: User InputlibGDX: User Input
libGDX: User Input
 
4.4 advanced games
4.4   advanced games4.4   advanced games
4.4 advanced games
 
Presentatie Willem En Kevin
Presentatie Willem En KevinPresentatie Willem En Kevin
Presentatie Willem En Kevin
 
Run and jump tutorial (part 2) scenes
Run and jump tutorial (part 2)   scenesRun and jump tutorial (part 2)   scenes
Run and jump tutorial (part 2) scenes
 
Silverlight as a Gaming Platform
Silverlight as a Gaming PlatformSilverlight as a Gaming Platform
Silverlight as a Gaming Platform
 
Galactic Wars XNA Game
Galactic Wars XNA GameGalactic Wars XNA Game
Galactic Wars XNA Game
 
Lecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR ProgrammingLecture 1 Introduction to VR Programming
Lecture 1 Introduction to VR Programming
 
Android application - Tic Tac Toe
Android application - Tic Tac ToeAndroid application - Tic Tac Toe
Android application - Tic Tac Toe
 
Unity introduction for programmers
Unity introduction for programmersUnity introduction for programmers
Unity introduction for programmers
 
Hi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdfHi there I am having difficulty in finalizing my Tetris game , below.pdf
Hi there I am having difficulty in finalizing my Tetris game , below.pdf
 
Academy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. EnvironmentAcademy PRO: Unity 3D. Environment
Academy PRO: Unity 3D. Environment
 
The Ring programming language version 1.7 book - Part 53 of 196
The Ring programming language version 1.7 book - Part 53 of 196The Ring programming language version 1.7 book - Part 53 of 196
The Ring programming language version 1.7 book - Part 53 of 196
 
Project report 393_395
Project report 393_395Project report 393_395
Project report 393_395
 
Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2Game Development for Nokia Asha Devices with Java ME #2
Game Development for Nokia Asha Devices with Java ME #2
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
Monogame and xna
Monogame and xnaMonogame and xna
Monogame and xna
 

Kürzlich hochgeladen

📞 Contact Number 8617370543VIP diu Call Girls
📞 Contact Number 8617370543VIP diu Call Girls📞 Contact Number 8617370543VIP diu Call Girls
📞 Contact Number 8617370543VIP diu Call GirlsNitya salvi
 
Call Girls Moradabad Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Moradabad Just Call 8617370543 Top Class Call Girl Service AvailableCall Girls Moradabad Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Moradabad Just Call 8617370543 Top Class Call Girl Service AvailableNitya salvi
 
Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...
Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...
Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...DipikaDelhi
 
Ghansoli Escorts Services 09167354423 Ghansoli Call Girls,Call Girls In Ghan...
Ghansoli Escorts Services 09167354423  Ghansoli Call Girls,Call Girls In Ghan...Ghansoli Escorts Services 09167354423  Ghansoli Call Girls,Call Girls In Ghan...
Ghansoli Escorts Services 09167354423 Ghansoli Call Girls,Call Girls In Ghan...Priya Reddy
 
Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...
Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...
Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...HyderabadDolls
 
Tapi Escorts | 8617370543 call girls service for all Users
Tapi Escorts | 8617370543 call girls service for all UsersTapi Escorts | 8617370543 call girls service for all Users
Tapi Escorts | 8617370543 call girls service for all UsersNitya salvi
 
Book ☎️ 8617370543 Call Girls in Bharuch and escort services 24x7
Book ☎️ 8617370543 Call Girls in Bharuch and escort services 24x7Book ☎️ 8617370543 Call Girls in Bharuch and escort services 24x7
Book ☎️ 8617370543 Call Girls in Bharuch and escort services 24x7Nitya salvi
 
Bhubaneswar🌹Call Girls Patia ❤Komal 9777949614 💟 Full Trusted CALL GIRLS IN b...
Bhubaneswar🌹Call Girls Patia ❤Komal 9777949614 💟 Full Trusted CALL GIRLS IN b...Bhubaneswar🌹Call Girls Patia ❤Komal 9777949614 💟 Full Trusted CALL GIRLS IN b...
Bhubaneswar🌹Call Girls Patia ❤Komal 9777949614 💟 Full Trusted CALL GIRLS IN b...Call Girls Mumbai
 
Hire 💕 8617370543 Mirzapur Call Girls Service Call Girls Agency
Hire 💕 8617370543 Mirzapur Call Girls Service Call Girls AgencyHire 💕 8617370543 Mirzapur Call Girls Service Call Girls Agency
Hire 💕 8617370543 Mirzapur Call Girls Service Call Girls AgencyNitya salvi
 
Hire 💕 8617370543 Kushinagar Call Girls Service Call Girls Agency
Hire 💕 8617370543 Kushinagar Call Girls Service Call Girls AgencyHire 💕 8617370543 Kushinagar Call Girls Service Call Girls Agency
Hire 💕 8617370543 Kushinagar Call Girls Service Call Girls AgencyNitya salvi
 
Dahod Call Girl 📞 8617370543 Low Price Genuine Service
Dahod Call Girl 📞 8617370543 Low Price Genuine ServiceDahod Call Girl 📞 8617370543 Low Price Genuine Service
Dahod Call Girl 📞 8617370543 Low Price Genuine ServiceNitya salvi
 
Unnao 💋 Call Girl 8617370543 Call Girls in unnao Escort service book now
Unnao 💋 Call Girl 8617370543 Call Girls in unnao Escort service book nowUnnao 💋 Call Girl 8617370543 Call Girls in unnao Escort service book now
Unnao 💋 Call Girl 8617370543 Call Girls in unnao Escort service book nowNitya salvi
 
Hire 💕 8617370543 Auraiya Call Girls Service Call Girls Agency
Hire 💕 8617370543 Auraiya Call Girls Service Call Girls AgencyHire 💕 8617370543 Auraiya Call Girls Service Call Girls Agency
Hire 💕 8617370543 Auraiya Call Girls Service Call Girls AgencyNitya salvi
 
Call Girls In Gorakhpur Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Gorakhpur Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...Call Girls In Gorakhpur Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Gorakhpur Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...Nitya salvi
 
Call Girls Bhubaneswar 9777949614 call me Independent Escort Service Bhubaneswar
Call Girls Bhubaneswar 9777949614 call me Independent Escort Service BhubaneswarCall Girls Bhubaneswar 9777949614 call me Independent Escort Service Bhubaneswar
Call Girls Bhubaneswar 9777949614 call me Independent Escort Service BhubaneswarCall Girls Mumbai
 
Ambassa Escorts | 8617370543 call girls service for all Users
Ambassa Escorts | 8617370543 call girls service for all UsersAmbassa Escorts | 8617370543 call girls service for all Users
Ambassa Escorts | 8617370543 call girls service for all UsersNitya salvi
 
Call Girls Kozhikode - 9332606886 Our call girls are sure to provide you with...
Call Girls Kozhikode - 9332606886 Our call girls are sure to provide you with...Call Girls Kozhikode - 9332606886 Our call girls are sure to provide you with...
Call Girls Kozhikode - 9332606886 Our call girls are sure to provide you with...call girls kolkata
 
Genuine 8617370543 Hot and Beautiful 💕 Gomati Escorts call Girls
Genuine 8617370543 Hot and Beautiful 💕 Gomati Escorts call GirlsGenuine 8617370543 Hot and Beautiful 💕 Gomati Escorts call Girls
Genuine 8617370543 Hot and Beautiful 💕 Gomati Escorts call GirlsNitya salvi
 
Call Girls South Tripura Just Call 8617370543 Top Class Call Girl Service Ava...
Call Girls South Tripura Just Call 8617370543 Top Class Call Girl Service Ava...Call Girls South Tripura Just Call 8617370543 Top Class Call Girl Service Ava...
Call Girls South Tripura Just Call 8617370543 Top Class Call Girl Service Ava...Nitya salvi
 
Banda call girls 📞 8617370543At Low Cost Cash Payment Booking
Banda call girls 📞 8617370543At Low Cost Cash Payment BookingBanda call girls 📞 8617370543At Low Cost Cash Payment Booking
Banda call girls 📞 8617370543At Low Cost Cash Payment BookingNitya salvi
 

Kürzlich hochgeladen (20)

📞 Contact Number 8617370543VIP diu Call Girls
📞 Contact Number 8617370543VIP diu Call Girls📞 Contact Number 8617370543VIP diu Call Girls
📞 Contact Number 8617370543VIP diu Call Girls
 
Call Girls Moradabad Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Moradabad Just Call 8617370543 Top Class Call Girl Service AvailableCall Girls Moradabad Just Call 8617370543 Top Class Call Girl Service Available
Call Girls Moradabad Just Call 8617370543 Top Class Call Girl Service Available
 
Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...
Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...
Call girls Service Bellary - 9332606886 Rs 3000 Free Pickup & Drop Services 2...
 
Ghansoli Escorts Services 09167354423 Ghansoli Call Girls,Call Girls In Ghan...
Ghansoli Escorts Services 09167354423  Ghansoli Call Girls,Call Girls In Ghan...Ghansoli Escorts Services 09167354423  Ghansoli Call Girls,Call Girls In Ghan...
Ghansoli Escorts Services 09167354423 Ghansoli Call Girls,Call Girls In Ghan...
 
Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...
Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...
Badshah Nagar ] Call Girls Service Lucknow | Starting ₹,5K To @25k with A/C 9...
 
Tapi Escorts | 8617370543 call girls service for all Users
Tapi Escorts | 8617370543 call girls service for all UsersTapi Escorts | 8617370543 call girls service for all Users
Tapi Escorts | 8617370543 call girls service for all Users
 
Book ☎️ 8617370543 Call Girls in Bharuch and escort services 24x7
Book ☎️ 8617370543 Call Girls in Bharuch and escort services 24x7Book ☎️ 8617370543 Call Girls in Bharuch and escort services 24x7
Book ☎️ 8617370543 Call Girls in Bharuch and escort services 24x7
 
Bhubaneswar🌹Call Girls Patia ❤Komal 9777949614 💟 Full Trusted CALL GIRLS IN b...
Bhubaneswar🌹Call Girls Patia ❤Komal 9777949614 💟 Full Trusted CALL GIRLS IN b...Bhubaneswar🌹Call Girls Patia ❤Komal 9777949614 💟 Full Trusted CALL GIRLS IN b...
Bhubaneswar🌹Call Girls Patia ❤Komal 9777949614 💟 Full Trusted CALL GIRLS IN b...
 
Hire 💕 8617370543 Mirzapur Call Girls Service Call Girls Agency
Hire 💕 8617370543 Mirzapur Call Girls Service Call Girls AgencyHire 💕 8617370543 Mirzapur Call Girls Service Call Girls Agency
Hire 💕 8617370543 Mirzapur Call Girls Service Call Girls Agency
 
Hire 💕 8617370543 Kushinagar Call Girls Service Call Girls Agency
Hire 💕 8617370543 Kushinagar Call Girls Service Call Girls AgencyHire 💕 8617370543 Kushinagar Call Girls Service Call Girls Agency
Hire 💕 8617370543 Kushinagar Call Girls Service Call Girls Agency
 
Dahod Call Girl 📞 8617370543 Low Price Genuine Service
Dahod Call Girl 📞 8617370543 Low Price Genuine ServiceDahod Call Girl 📞 8617370543 Low Price Genuine Service
Dahod Call Girl 📞 8617370543 Low Price Genuine Service
 
Unnao 💋 Call Girl 8617370543 Call Girls in unnao Escort service book now
Unnao 💋 Call Girl 8617370543 Call Girls in unnao Escort service book nowUnnao 💋 Call Girl 8617370543 Call Girls in unnao Escort service book now
Unnao 💋 Call Girl 8617370543 Call Girls in unnao Escort service book now
 
Hire 💕 8617370543 Auraiya Call Girls Service Call Girls Agency
Hire 💕 8617370543 Auraiya Call Girls Service Call Girls AgencyHire 💕 8617370543 Auraiya Call Girls Service Call Girls Agency
Hire 💕 8617370543 Auraiya Call Girls Service Call Girls Agency
 
Call Girls In Gorakhpur Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Gorakhpur Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...Call Girls In Gorakhpur Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
Call Girls In Gorakhpur Escorts ☎️8617370543 🔝 💃 Enjoy 24/7 Escort Service En...
 
Call Girls Bhubaneswar 9777949614 call me Independent Escort Service Bhubaneswar
Call Girls Bhubaneswar 9777949614 call me Independent Escort Service BhubaneswarCall Girls Bhubaneswar 9777949614 call me Independent Escort Service Bhubaneswar
Call Girls Bhubaneswar 9777949614 call me Independent Escort Service Bhubaneswar
 
Ambassa Escorts | 8617370543 call girls service for all Users
Ambassa Escorts | 8617370543 call girls service for all UsersAmbassa Escorts | 8617370543 call girls service for all Users
Ambassa Escorts | 8617370543 call girls service for all Users
 
Call Girls Kozhikode - 9332606886 Our call girls are sure to provide you with...
Call Girls Kozhikode - 9332606886 Our call girls are sure to provide you with...Call Girls Kozhikode - 9332606886 Our call girls are sure to provide you with...
Call Girls Kozhikode - 9332606886 Our call girls are sure to provide you with...
 
Genuine 8617370543 Hot and Beautiful 💕 Gomati Escorts call Girls
Genuine 8617370543 Hot and Beautiful 💕 Gomati Escorts call GirlsGenuine 8617370543 Hot and Beautiful 💕 Gomati Escorts call Girls
Genuine 8617370543 Hot and Beautiful 💕 Gomati Escorts call Girls
 
Call Girls South Tripura Just Call 8617370543 Top Class Call Girl Service Ava...
Call Girls South Tripura Just Call 8617370543 Top Class Call Girl Service Ava...Call Girls South Tripura Just Call 8617370543 Top Class Call Girl Service Ava...
Call Girls South Tripura Just Call 8617370543 Top Class Call Girl Service Ava...
 
Banda call girls 📞 8617370543At Low Cost Cash Payment Booking
Banda call girls 📞 8617370543At Low Cost Cash Payment BookingBanda call girls 📞 8617370543At Low Cost Cash Payment Booking
Banda call girls 📞 8617370543At Low Cost Cash Payment Booking
 

Y Tiles

  • 1. Y-Tiles iPhone Application Chris Yunker STL Mobile Dev Meeting June 24, 2010
  • 2. Why Y-Tiles? • Simple, enjoyable game everyone understands • Development touches a lot areas (graphics, touch screen, camera, accelerometer, etc.) Why The Name “Y-Tiles”? • When I started development, there were already over 25 implementations of this game • I had to find a unique name so I added the first letter of my last name
  • 3. Development Details • Hardware: iPhone 3G (16G) • SDK: 2.2.1 • Development Time: 2-3 months • Submitted to App Store: March 4, 2009 • Downloads: +2000 in last 26 weeks (according to iTunes Connect App)
  • 4. Fifteen Puzzle Game The n-puzzle is known in various versions, including the 8 puzzle, the 15 puzzle, and with various names (Gem Puzzle, Boss Puzzle, Game of Fifteen, Mystic Square and many others). It is a sliding puzzle that consists of a frame of numbered square tiles in random order with one tile missing. If the size is 3×3, the puzzle is called the 8-puzzle or 9-puzzle, and if 4×4, the puzzle is called the 15- puzzle or 16-puzzle. The object of the puzzle is to place the tiles in order (see diagram) by making sliding moves that use the empty space. http://en.wikipedia.org/wiki/Fifteen_puzzle
  • 5. Top Level Views Board Tab Photo Selection Tab Settings Tab
  • 6. Board Types Photo With NumbersPhotoTiles
  • 7. Photo Selector Camera PhotoDefault Photos • Application contains 4 default photos • User can take a new photo or use an existing photo
  • 8. Settings Settings Tab •Board size: 3-6 rows / 3-6 columns •Photo or numbered tiles •Enable number tags on photo tiles •Enable sound Note: Changing the photo (from the Photo Selector Tab) or the board size will trigger a restart of game
  • 9. Object Diagram Board Controller (UIViewController) Photo Controller (UIViewController) Settings Controller (UIViewController) Tab Bar Controller (UITabBarController) Board (UIView) Tile (0-N) (UIImageView ) (Rows × Columns – 1) Tiles
  • 10. Create Photo Tiles Tile frame size is calculated from number of rows/columns Foreach Row/Column Coordinate { Image = CGImageCreateWithImageInRect Create Tile object } Remove last Tile (bottom right)
  • 11. Create Rounded Tile Image Define the fill area with a CGMutablePathRef using two concentric polygons • Create rectangle path with CGPathAddLineToPoint • Create rounded path with CGPathAddLineToPoint and CGPathAddArcToPoint Fill in area between the two polygons with CGContextEOFillPath (Even/Odd Fill) Rectangle Path Rounded Path Filled In PathPhoto Image
  • 12. Board Object • Extends UIView object • 2D array contains board state with pointers to all tiles • Emits a tick sound for each tile move • Pauses board with a transparent overlay and setting UserInteractionEnabled:NO 1 2 3 N
  • 13. Tile Object • Extends UIImageView object • Numeric ID (Numeric Tile or Numeric Photo Tag) • Home coordinate • Movable State (Up/Down/Left/Right/None) • Pointer to adjacent push tile (if applicable) • Pointer to board object 1
  • 14. Game Algorithm 1 N N N N N N N N N N N N N N N Iterate through all tiles in board Foreach Tile in Board { Set MovableState:None Is Tile solved? } Is Board solved?
  • 15. Game Algorithm 2 N D N N N D N N R L L N U N N Start at empty spot and iterate through tiles in same row and column Foreach Tile Row/Column { Set MovableState:Up/Down/Left/Right Set PushTile pointer (if applicable) }
  • 16. Game Algorithm 3 N D N N N D N N R L L N U N N • The Tile class can receive touches since it extends UIImageView which extends UIResponder • The Tile class implements these methods to handle touches touchesBegan(NSSet *, UIEvent *) touchesMoved(NSSet *, UIEvent *) touchesEnded(NSSet *, UIEvent *) touchesCancelled(NSSet *, UIEvent *) • To prevent multiple tiles from moving, an NSLock object is used
  • 17. Game Algorithm 4 When a Tile receives a touchesBegan event, it will respond if it’s in a movable state and can acquire the lock. The Tile will slide with the relative location provided by the touchesMoved event. Its movement will be constrained by the empty area. If the Tile is pushing another Tile, it will slide it the same distance via its PushTile pointer. When the touch is done, the Tile will receive a touchesEnded event. If the Tile has moved less than half the distance, it will snap to its original location. If it has moved more than half the distance, it will snap to the empty location. When a Tile moves, it communicates this back to the Board so it can update. 15 9 15 9
  • 18. Accelerometer Restart Menu The Accelerometer is used so users can restart/reshuffle the board • Accelerometer provides a 3D g-force vector at a configured interval (1/30 sec) • A valid shake is when the g-force vector delta exceeds a configured threshold in 2 of the 3 dimensions • Shake counter is incremented for valid shake • Shake counter is reset for invalid shake • Restart menu is triggered when counter equals 3 shakes
  • 19. Performance • Coded application with an “Optimize Later” philosophy • Great game performance; Tiles are very responsive • Camera Photo Selector can cause memory warnings • Board generation can take 4-8 seconds depending on size
  • 20. Version 2.0 • Save game state • Improve board generation time • iAd