Cognitive Class: Game-playing AI with Swift for TensorFlow (S4TF) Final Exam Answers 2021

Cognitive Class: Game-playing AI with Swift for TensorFlow (S4TF) Final Exam Answers 2021

TensorFlow is a machine learning software library that is free and open-source. It can be used for a variety of activities, but it focuses on deep neural network training and inference. Tensorflow is a dataflow and differentiable programming-based symbolic math library. At Google, it’s used for both research and development. The Google Brain team created TensorFlow for internal Google use. In 2015, it was published under the Apache License 2.0. Its adaptable architecture enables computation to be deployed across a wide range of platforms (CPUs, GPUs, TPUs), from desktops to server clusters to mobile and edge devices.

 1. The implementation of the 2048 game logic is made fast by:

  1. Using bitboards
  2. Pre-calculating moves and scores for rows
  3. Multi-threading

2. Which framework did we use to enable Swift to host HTTP servers?

  1. Kitura

3. Monte Carlo Tree Search is…

  1. Stochastic
  2. Guaranteed to always give the correct answer

4. Which swift file defines dependencies and other package details?

  1. Package.swift

5. Which tier(s) of IBM Cloud require payment information on file?

  1. Lite
  2. Trial
  3. Pay-as-you-go

6. Why would you want to use a single language, Swift, over many languages, each specialized for a certain task?

  1. It’s easier to maintain a codebase written in a single language.
  2. Swift is an expressive, performant, and open source language backed by a large company (Apple).
  3. It’s slow to facilitate communication between components in different languages.
  4. It reduces the amount of “reinventing the wheel” required across a codebase.

7. Does Minimax plays perfectly all the time? If so, why?

  1. It’s trained on a lot of game data and learns how to play perfectly.
  2. It brute forces a solution based off of the rules of the game, and all possible future situations.
  3. It’s provided optimal heuristics.
  4. It doesn’t always play perfectly.

8. Classes are passed by reference, and structs are always, indiscriminately passed by value.

  1. True
  2. False

9. A computed property is…

  1. A variable within a struct/class/enum.
  2. A function within a struct/class/enum that’s accessed like a property.

10. Why is Minimax penalized for looking at moves deeper into the game tree?

  1. To improve performance by looking at a more shallow game tree.
  2. So Minimax takes into account how straightforward a move is.
  3. To make Minimax more accurate.

11. Why is Reinforcement Learning important?

  1. It’s more accurate than other training methods.
  2. It can learn by trial and error.
  3. It doesn’t require as much data to learn from.
  4. It can play games.

12. Swift for TensorFlow is interoperable with Python, because Python’s written in C

  1. True
  2. False

13. What are some reasons Swift for TensorFlow is special?

  1. Swift now has a wrapper around TensorFlow, enabling machine learning development.
  2. Swift for TensorFlow can automatically differentiate complex functions.
  3. Swift for TensorFlow can optimize complex tensor operations.

14. For what reasons did we implement monte carlo tree search in a time-bounded manner?

  1. To reduce the amount of time the algorithm takes to search.
  2. To search game states more if they’re closer to the end of a game.
  3. To make MCTS more accurate.
  4. To distribute the algorithm across threads.

15. What kind of IBM Cloud account doesn’t require payment information and doesn’t expire?

  1. Trial
  2. Lite
  3. Pay-as-you-go

16. Which of the following platforms does Swift NOT run natively on?

  1. Linux
  2. Darwin
  3. Windows
  4. None of the above

17. Which of the following companies did Chris Lattner work at after Apple?

  1. IBM
  2. Microsoft
  3. Google
  4. Amazon
  5. Tesla

18. For how many years was Swift in development before it was released to the public?

  1. 4

19. What kind of programming language is Swift?

  1. Interpreted
  2. Compiled to machine code
  3. Compiled to byte code
  4. Transpiled

20. Which HTTP server for Swift will this course use?

  1. Perfect
  2. Kitura
  3. Swifter
  4. Vapor

21. Why does our implementation of Minimax keep track of the depth of the tree?

  1. Stop at a certain depth
  2. Memoize game states
  3. Take into account the “straightforwardness” of moves

22. How is the tic-tac-toe board stored?

  1. Row-major format
  2. Column-major format

23. If minimax started from a blank board and had to calculate the best possible move, how many board states would it evaluate? For the sake of mathematical simplicity, assume the board must be filled completely to be considered “over” – players cannot win.

  1. 9!
  2. 9^2
  3. 9^9
  4. 9*9

24. The “minimax” function returns the best move to take for a board state.

  1. True
  2. False

25. The cartpole game is what kind of problem?

  1. Inverted Pendulum

26. The @differentiable function decorator is an example of an implementation of what technology/technique?

  1. Data Structure

27. Why do we only train the network with the top 30% of episodes?

  1. To reduce training time with fewer samples
  2. To improve network performance with better samples

28. OpenAI Gym…

  1. Provides easy-to-use game enviroments to test RL agents
  2. Ships with RL algorithms to use as agents

Decisions are made using reinforcement learning. It becomes possible for an intelligent system to evaluate new behaviour or approaches, change direction when mistakes occur (or negative reinforcement), and build on successes by developing a simulation of an entire company or system (or positive reinforcement). While remarkable, reinforcement learning has yet to see mainstream acceptance or real-world success outside of video games and mazes. Even for relatively simple issues, reinforcement learning necessitates extensive preparation, which can take anything from hours to days or even weeks.

Leave a Reply

Your email address will not be published. Required fields are marked *