3 minute read

Another productive project day means, not much to talk about! I got through all the tests that I needed to for my Tic-Tac-Toe with AI project. I started trying to build out my “AI” but didn’t get very far. I know I need to start simple so I decided to just attempt the computer making random moves. I tried to implement the following work flow: 1. Get the current board array (although this should be passed in by default). 2. Set an array equal to all the possible moves as strings, 1-9. 3. Set a new empty array to collect open squares. 4. Loop over the current board array and if a square is empty = " " shovel to the array collecting open squares. I will do this by utilizing the possible moves array as the index numbers. I’ll just turn each array value into an integer and subtract one. 5. If the board square is empty shovel the possible move string to the empty array collecting open squares. 6. Return a random string from the possible moves array.

This should get my computer playing only random open squares. However, my code created an infinite loop and I decided I could call it a day after that. I’m hoping I can pair with someone just for the AI part and get it done. If you’re interested in the project you can find it on my GitHub here. My current computer logic (although it might be hard to understand without looking at all the files) is this:

module Players
  class Computer < Player
    def move(board)
      possible_moves = ["1", "2", "3", "4", "5", "6", "7", "8", "9"]
      valid_moves = []
      possible_moves.each do |move|
        valid_moves << move if board.cells[move.to_i-1] = " "
      end
      valid_moves.sample
    end
  end
end

I’m sure I’ll get at least this little bit of logic working tomorrow even if on my own. Other than that the game works for 2 humans to play!

So day by day I’m enjoying my new OS even more. Today I setup workspaces which just made all of life easier.

My workspaces overview:
Ubuntu Desktop Workspaces
I have one with Atom and the Terminal (I’ve since changed to “Solarized Light” themes on both because I was getting glare during the day):
Coding Workspace
One with Slack:
Slack Workspace
Finally, one with Chrome:
Web Workspace

I also got f.lux installed today which is one the things on my must have list when it comes to apps on my computers. I even have installed it at shared work computers in the past and freaked some coworkers out the first time they use the computer afterwards. I’ll write a post about my biohacks here sometime soon. Maybe when I’m done with this set of projects and before I move to the next section. I have more than a few things that I do to keep my mind running in top form. From nootropics to meditation.

Time spent today: 7:02
Time spent total: 99:50
Lessons completed today: 0
Lessons completed total: 283

comments powered by Disqus