Swift Slowly: Day 39 - Hacking Swift 25

Today is a consolidation and challenge day! I’m a quarter of the way through this and I’m pretty excited and grateful to have made it this far. With that comes a little more stress as I’m venturing out on my own to do small challenges along the way.

Which brings me to the challenge!

Challenge

You have a basic understanding of arrays, state, views, images, text, and more, so let’s put them together: your challenge is to make a brain training game that challenges players to win or lose at rock, paper, scissors.

The first thing I did was take some time to sketch out what I want the application to look like.

Rough Sketch with my rubber duck partner.

It really didn’t take that long to get something on screen.

Barebones of an application ui.

I’m taking a lot of the lessons and code from the Guess the flag game that I created earlier in order to move forward with this. I was fun to put the application together and I even spent some time doing some customization.

Application at the end.

What took me the most time, was actually coming up with the logic to the game. Apparently, working on something complex after many days of not getting enough sleep can wear you down. Luckily, there is pen and paper and the ability to forgive myself and move on.

My note book explaining the logic to myself

I’m just happy to be done!

Categories: SwiftSlowly

Published:

Debug

Site Properties

		&hugolib.SiteInfo{Authors:page.AuthorList(nil), Social:hugolib.SiteSocial(nil), hugoInfo:hugo.Info{CommitHash:"1798bd3f", BuildDate:"2021-12-23T15:33:34Z", Environment:"production"}, title:"Mandaris", RSSLink:"https://mandarismoore.com/feed.xml", Author:map[string]interface {}{"avatar":"https://micro.blog/mandaris/avatar.jpg", "name":"Mandaris Moore", "username":"mandaris"}, LanguageCode:"en", Copyright:"", permalinks:map[string]string{}, LanguagePrefix:"", Languages:langs.Languages{(*langs.Language)(0xc00036edd0)}, BuildDrafts:false, canonifyURLs:false, relativeURLs:false, uglyURLs:(func(page.Page) bool)(0x163ea20), owner:(*hugolib.HugoSites)(0xc00043d6b0), s:(*hugolib.Site)(0xc000113b00), language:(*langs.Language)(0xc00036edd0), defaultContentLanguageInSubdir:false, sectionPagesMenu:""} 

		

site.Params Properties

		maps.Params{"description":"Follow <a href=\"https://micro.blog/mandaris\">@mandaris on Micro.blog</a>.", "feeds":maps.Params{"bookmarks_json":"https://micro.blog/feeds/mandaris/bookmarks/08117195b525afe4a55f.json"}, "github_username":"mandaris", "include_conversation":true, "instagram_username":"mandaris", "itunes_author":"Mandaris", "itunes_category":"Society & Culture", "itunes_cover":"https://micro.blog/mandaris/podcast.png", "itunes_description":"A High-quality stranger. I've considered myself a digital gofer. Y'know, go for this and go for that. I'm using micro.blog now to par down my technical projects and be part of an outstanding community.  Apple Game Center: MrMandaris  Email: Infor@MandarisMoore.com", "itunes_email":"podcast@mandarismoore.com", "itunes_subcategory":"Personal Journals", "mainSections":[]string{"replies"}, "mainsections":[]string{"replies"}, "paginate_categories":true, "paginate_home":true, "paginate_replies":true, "plugins_css":[]interface {}{}, "plugins_html":[]interface {}{}, "plugins_js":[]interface {}{}, "site_id":"661", "theme_seconds":"1685484083", "transcripts_audio_link":true, "transcripts_enable":true, "twitter_username":"mandaris"}
		

Permalink

		"https://mandarismoore.com/2021/02/05/swift-slowly-day.html" 

		

Params

		map[categories:[SwiftSlowly] date:2021-02-05 01:02:20 -0700 -0700 draft:%!s(bool=false) guid:http://mandaris.micro.blog/2021/02/05/swift-slowly-day.html images:[https://cdn.uploads.micro.blog/661/2021/ccf2b61346.jpg https://cdn.uploads.micro.blog/661/2021/cfe689623e.png https://cdn.uploads.micro.blog/661/2021/be4cafb23a.png https://cdn.uploads.micro.blog/661/2021/d99a02de4f.jpg] iscjklanguage:%!s(bool=false) lastmod:2021-02-05 01:02:20 -0700 -0700 layout:post microblog:%!s(bool=false) photos:[https://cdn.uploads.micro.blog/661/2021/ccf2b61346.jpg https://cdn.uploads.micro.blog/661/2021/d99a02de4f.jpg] photos_with_metadata:[map[url:https://cdn.uploads.micro.blog/661/2021/ccf2b61346.jpg] map[url:https://cdn.uploads.micro.blog/661/2021/d99a02de4f.jpg]] post_id:%!s(int=1260473) publishdate:2021-02-05 01:02:20 -0700 -0700 title:Swift Slowly: Day 39 - Hacking Swift 25 type:post url:/2021/02/05/swift-slowly-day.html]
		

All variables scoped to the current context

		&hugolib.pageState{pageOutputs:[]*hugolib.pageOutput{(*hugolib.pageOutput)(0xc002648d80), (*hugolib.pageOutput)(0xc002648ea0), (*hugolib.pageOutput)(0xc002648fc0), (*hugolib.pageOutput)(0xc0026490e0), (*hugolib.pageOutput)(0xc002649200), (*hugolib.pageOutput)(0xc002649320), (*hugolib.pageOutput)(0xc002649440), (*hugolib.pageOutput)(0xc002649560)}, pageOutput:(*hugolib.pageOutput)(0xc002648d80), pageCommon:(*hugolib.pageCommon)(0xc00144f400)}