Unary minus: unary means it takes a single argument, written to the right of the operator. Unary minus negates and returns the value of the argument. int x = 5; cout << -x << endl; This prints -5. The priority of unary minus--I believe--is roughly that of binary minus. -x*y...i think the x*y is evaluated first, and then minus is applied. In BASIC, what is -5^2? Does exponentiation take precedence or does unary minus? Unary plus, is thing. It returns the unchanged value of its argument. I never the purpose of it, unless it was to clarify code or something. In APL, it made a little more sense. The unary minus meant negate. There was also a raised minus sign, used only in numeric constants. So that -2 meant take the value of 2, negate and return it. But 2 specifically to negative 2 without applying a function to it. 5*6 gives -30, but the only operator is the *. In APL, the unary + meant complex conjugate, so x was 5J3, then +x was 5J3. In the notes way back when, I defined cond = Le1.Le2.Lc.((c e1) e2) Now, in this defintion, the comparison is the last argument. So, (((cond ) ) ) would evaluate to is were true and if were false. However, after that first day, I implicitly used THIS definition: cond = Lc.Le1.Le2.((c e1) e2) So, cond now looks like (((cond ) ) ) It works the same either way. OTHELLO 8x8 grid (like checkers and chess). Unlike checkers and chess, you don't have "your own pieces." You have stones/discs/tokens, white on one side, black on the other. If you play a stone with your color, and after playing it, there a line emanating from that stone in any of the eight directions, horizontal, vertical, or diagonal, such that it is a row of your opponent's stones with your stone on either end of it (one is the stone you just played) and the other is a stone of yours that was already there), then your opponent's stone in between are flipped and they become your stones. This is called outflanking. The one rule: On your turn, you MUST outflank at least one of your opponent's stones. If you can't outflank, you lose your turn. The game ends when neither player has a legal move. Usually this is due to the board being full, but it doesn't have to be. At the end of the game, the player with the most stones wins. It's a tie if there are an equal number of white and black stones. The game is intriguing because it's much simpler than chess, and yet we don't have it solved. _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ B _ _ _ _ _ _ _ B B _ _ W _ _ W B W W W W _ _ _ W _ W _ W _ _ _ _ W _ B _ _ _ _ _ _ W _ B Black goes first. Eventually, we'll reach a point when neither player can move, and that is the only way a game ends. Now, one obvious and stupid strategy for a computer to use is to place a stone that outflanks as many stones as possible on its next move. Try that strategy! If you're playing against someone with even the slightest experience...or brains...you will lose very fast. 1 Field Marshall (1) 2 General (1) 3 Major (2) 4 Colonel (3) 5 Captain (4) 6 Lieutenant (4) 7 Sergeant (4) 8 Miner (5) can attack and destroy bombs 9 Scout (8) can advance more than one square per turn S Spy (1) can defeat a field marshall, but only if it attacks first Bomb (6) Flag (1) X _ O O _ _ X _ X What is AI? Good question, AI means different things to be different people. At its most basic, AI tries to solve problems or make headway on certain problems that normally or historically would be solved by human beings. You might think of WebMD as a form of AI. You type in your symptoms and you get back your illness (for entertainment purposes only). The idea is that if AI works correctly, the human being saves a lot of time by having the AI look at the most likely possibilities. Think of an auto mechanic. A proper AI could tell the likely causes of a car's failure (a human being making the proper determination). People think of AI as Mr. Data on Star Trek. But we mostly use AI to help us solve real life problems--even if the AI solution isn't mathematically perfect. For example, AI might not give us a perfect game of Othello, but it might give us an opponent that's tough to beat. So, let's say we want to program a perfect game of Tic-Tac-Toe. How might we do it with very little code and making use of recursion. If it's my turn, I have k possible moves. I try each one of these moves, and recursively run the same method, but with it being my opponent's turn. X _ _ _ _ _ _ _ _ My turn: I'm O. X O _ The method might return: X wins O wins or tie. _ _ _ _ _ _ X _ O _ _ _ _ _ _ X _ _ O _ _ _ _ _ and so on. So after trying all possible moves, I look at the answers. If any of them has O wins, I conclude that O wins because if O CAN win, of course, O is going to move so that O will win. If none of have O winning, but at least one of them has a tie as the result, I will return that the game in a tie, because if I can't win, I'd rather tie than lose. Only if every single choice results in X winning, will I return that X wins. Now when I do this, I go a little further. If I have more than one winning move, I choose the move that will make me win faster (in the fewest number of moves). If I have to lose, I choose a losing move that will have me lose in the largest possible number of moves. This strategy is called the minimax algorithm. A popular version is this is called "alpha-beta pruning". We will get into that on Wednesday. And, guess what, it's a good example of functional programming. After you get your Othello program working, the next step is to apply alpha-beta pruning to it.