Posts in 2022
-
2048 Design
Thursday, May 19, 2022 in Game of 2048
The first step is to make a playable game of 2048. This makes sure we have correctly implemented all of the internal logic. Representation I suggest you use a list of 16 numbers: [0]*16 to start out. So that everyone in the class talks about the same …
-
MM Phase II
Tuesday, May 03, 2022 in Mastermind
In this phase we implement the strategy from Knuth’s 1977 paper “The Computer as Master Mind” (J. Recreational Mathematics, Vol 9(1), 1976-77). This strategy is to choose a guess that minimizes the “worst case” outcome. …
-
MM Phase I
Tuesday, May 03, 2022 in Mastermind
Make sure you know the rules of the game. You could play online with one of several Mastermind web sites. Representation There are two logical representations to use for your game state (code). In each, each of the six colored peg available for use …
-
Minimax Sketch
Friday, March 04, 2022 in Minimax
You are with “tic-tac-dum”: two players try to get 3 marks in a row on a one-dimensional board. Board: an array of integers. Legal moves are any unoccupied square. Move A Move is a player and a position. Game State A GameState contains: …
-
Tiny Steps
Saturday, February 12, 2022 in 02-01 Solver
(This is an experimental section to help people who are not able to make progress based on the original description and class discussion.) All questions depend on a given SolverData file being loaded. Everything happens with the information from that …
-
Data Structures
Wednesday, February 02, 2022 in 02-01 Solver
Show me your flowcharts and conceal your tables, and I shall continue to be mystified. Show me your tables, and I won’t usually won’t usually need your flowcharts; they’ll be obvious. Fred Brooks Traits Strings representing particular parts of the …
-
Topological Sort
Wednesday, January 19, 2022 in Daily
Dangers and Annoyances: Make sure you have a way of reading in directed graphs. In a directed graph, when you encounter an edge from a to b, you should not automatically create an edge from b to a. Graph data. Example 1, 7 vertices. Example 2, 23 …
-
01-19 Topo Writeup
Wednesday, January 19, 2022 in Daily
Requirements Implementations of topological sort: fast, slow Verifier: checks for a valid order Timing: time and produce a graph. For small size graphs you may need a relatively large number of repetitions to get repeatable measurements. Code cleanup …
-
01-14 Minimum Distance
Friday, January 14, 2022 in Daily
Implementing Dijkstra’s algorithm to find the minimum cost path from a starting vertex. Test cases: Example 1 (6 vertices) Shortest distance from 0 to 5 is 50. Example 2 (10 vertices) Shortest distance from 0 to 9 is 80. Example 3 (20 vertices) …
Posts in 2021
-
Kruskal Guide
Tuesday, December 14, 2021 in 12-14 Kruskal
Common pitfalls A visited set is not enough Far and away the most common pitfall in implementing Kruskal’s algorithm is believing that a “visited” set can help you figure out whether or not to use an edge. Make sure your …