Codevember 2019 — days 1 to 10

Pedro Cacique
phcacique
Published in
7 min readNov 10, 2019
CODEVEMBER 2019

What is Codevember?

Codevember is a challenge for developers to sharpen their creativity and improve their skills. The goal is to build a creative piece of code every day of November. We give you daily hints to inspire you but you can do unrelated sketches.

In Codevember's page and also on Twitter, you can find the prompts for each day.

My experiments

This year I am trying to complete the 30 days challenge. I started with the idea of implementing a different version of Conway's Game of Life each day, but it was getting to restrict, so moved on and started doing visual experiments.

As an iOS mentor, I gave my students the same challenge. Some of them are following the path and soon I will post their results here too.

So, let's take a look on my results so far. All of the experiments are available in my github page. Feel free to fork it and use it as you wish.

Day 1: Contrast

Contrast

First day: Contrast

As I was working on the Conway'’ Game of Life (CGOL), my goal this day was to learn how to create Swift Packages, so I could reuse the code in future applications. So I decided to create a simple 3D viewer of the game using contrasting colours. Even if the result was too simple, it was very productive to learn abou the packages. The package is about the CGOL's logic and not about the visuals, so I can use it in different contexts. This time, I used SceneKit, to practice the framework.

Swift Package source: SwiftGameOfLife

Source: codevember2019_01_contrast

Video: https://www.instagram.com/p/B4VnKYlpcT-/

Day 2: Geometric

Geometric

On the second day, I was hoping to use well the swift package I created on the day before. So I worked with SpriteKit to prove that the logic is not linked to the visual information.

As I was creating the experiment, I tried different shapes and colours until I found the color palette I liked the most. I also tried something different for the CGOL: what if every new born cell assume their neighbour shape? I tried, and really enjoyed the results. Seems like different groups of shapes fighting for some space in the screen.

I also created a template for Sketch to export my app icon in all the sizes XCode requires. If you want, you can download it here.

Source: codevember2019_02_geometric

Video: https://www.instagram.com/p/B4XjNFwJk6L/

Day 3: Deep

Deep

What can I create with this prompt? It was hard to think in a visual representation of this, so I decided to work on a different code. Instead of using the CGOL as a square matrix of cells, what if I create a circular one where the last cells are neighbours to the first one?

I was not creative enough to think on a great visual representation, so I created a well and the circular matrix is represented by the rain pattern around it. I also generated a second Swift Package for this.

Swift Package Source: SwiftGameOfLifeCircular

Source: codevember2019_03_deep

Video: https://www.instagram.com/p/B4aaw0aJhgy/

Day 4: Big

Big

At this point I realised how much I like flat colors! I was using this site very often to choose colors in a fast way, so I decided to change it and make a soft app, using lighter colors, chosen by myself.

As the concept was BIG, I tried to use the circular matrix of the CGOL and vary the sizes of the shapes randomly. The result was beautiful (even if I believe it is more related to the DEEP prompt than the precious one)

Source: codevember2019_04_big

Video: https://www.instagram.com/p/B4cVPpTpjMZ/

Day 5: Light

Light

Ok! Now we have a good prompt! And we could create anything using light on SceneKit! But, of course, I didn't want to create a regular app, so I went to a different path!

I was thinking in the word LIGHT and how it is beautiful in different languages. So I decided to use the CGOL in SpriteKit, but limiting the space of the cells by masking it with the letters. So I created an algorithm that reads an image and generated it's pixel matrix. So I used it as a mask for CGOL's matrix.

Source: codevember2019_05_light

Video: https://www.instagram.com/p/B4fSIjdpEzN/

Day 6: Music

Music

OMG! I was so excited with this prompt that a decided I will launch an app later this year with something similar to this day's result.

I was inspired in a beat sequencer and how it could sound if we apply the CGOL rules to autogenerate music. So I created this app where you can draw your pattern and play it.

My challenge this day was: AVFoundation. How could I play several audioclips at once without loosing quality? My solution: let's merge audio files from a column and then concatenate it from rows and than play the music generation by genration. It worked! But of course still needs some work on efficiency.

Source: codevember2019_06_music

Video: https://www.instagram.com/p/B4iQYW-JbX6/

Day 7: Shape

Shape

This is my favorite so far!

The tricky question was: how can I use shapes without having the same visuals I have so far?

So, I decided to use the day 5 algorithm that generates pixel matrices to obtain colors from an image and recreate it using shapes. At first this was the only thing I knew I wanted to do. So I tried different combinations and the one I like the most is using arcs with different radius and alpha values.

Source: codevember2019_07_Shape

Video: https://www.instagram.com/p/B4lxXUTpWQp/

Day 8: Data

Data

Ok! This was a lazy one!

And probably the last one I use the CGOL. I decided to show the data behind the game. Instead of showing shapes, for each cell I'’ showing the number of live neighbours. The colors represent the state changing:

  • green — the cell survives for next generation
  • yellow — the cell will be born
  • red — the cell will die

Source: codevember2019_08_data

Video: https://www.instagram.com/p/B4oEt38pvGw/

Day 9: Game

Game

Now that I'm free from the CGOL, I decided to revisit some old algorithms and create a controller for a circular game.

This is not a full game. The main goals of this day are:

  • Create a joystick — I wanted to create a joystick component in SpriteKit that could be placed wherever the user touches the screen. For this app, it controls the movement direction (CW or CCW). You can also tap on screen to jump.
  • Study gravity fields — How can we create gravity fields that attracts other rigid bodies to it in SpriteKit?

Source: codevember2019_09_game

Video: https://www.instagram.com/p/B4qDrtVp_d7/

Day 10: Old

Old

Do you remember the Etch Sketch? It was so fun when we were kids at the 90's!

This is my iOS version. I's still terrible at drawing on it, by the way.

Source: codevember2019_10_old

Video: https://www.instagram.com/p/B4taXHZF5Jl/

Reflections so far

This is hard! When you have a lot of work responsibilities it is not easy to code everyday (even if it is about simple applications). But is so rewarding!

I am having a fun time with this project and learning a lot with it. I believe we all have to recycle ourselves and this month I'm doing this. I teach iOS development everyday, but that doesn't mean I know everything about it. It is important to practice to keep it fresh.

Another good point is: as I gave the students the same challenge, we are pushing each other to create something great everyday.

Everyone can code! Everyone can create!

Working together make us stronger! We are all learners!

--

--

Pedro Cacique
phcacique

Coordinator at Apple Developer Academy | Mackenzie