Lab 6 This lab can be done with one partner or it may be done alone. It is due in two weeks (Tuesday, May 13)
|
|
- Caren Kennedy
- 6 years ago
- Views:
Transcription
1 Lab 6 This lab can be done with one partner or it may be done alone. It is due in two weeks (Tuesday, May 13) Problem 1: Interfaces: ( 10 pts) I m giving you an addobjects interface that has a total of one method signature: public interface addobjects { int addit(int x); Your job: Create 2 new classes: one for an OnLineBook, that implements the addobjects interface. This method has two fields: a price and a title. I made the price be an int because I was lazy. The title should be a string. The constructor takes as input the name of the book (a String) and an int representing the price. The method addit adds the price of the book to the input parameter and retuns that number.the other method in the class definition is a method called printbook that takes no input and returns a string representing the book s title and its cost (you make it look nice). The second class is for an ElectricBill. This class also implements the addobjects interface. The fields for an ElectricBill are (I made everything an int-again-just laziness) watts (or number of watts used), costperwatt, and then bill, which is calculated as watts * costperwatt. The constructor takes 2 input parameters the watts and the costperwatts, and sets all three fields. The addit method adds the input parameter to the bill field and returns that. This method also has a PrintBill() method that returns a string representing the bill (you format to make it look nice. Now write a main method that creates two new objects: addobjects k = new OnLineBook(32,"Java Programming"); addobjects l = new ElectricBill(300, 2); In your main method create a totalmonthlybill variable (an int) initialized to 0. Use OnLineBook s addit method to add the cost of the book to the totalmonthlybill. Use the ElectricBill s addit method to add the bill to the totalmonthlybill. Now you want to print out each individual item, and then the totalmonthlybill. Use the following: System.out.println(((OnLineBook)k).printbook()); System.out.println(((ElectricBill)l).PrintBill()); System.out.println("Total monthly bills: " + totalmonthlybill); Notice what I did to be able to access the methods belonging to the OnLineBook class and the EectricBill class.
2 Problem 2: TreeSets Modified: (15 pts) TreeSets are type of set that infer from the collection interface. As you know, a TreeSet is ordered in the sense that the nodes are placed in the tree in order of least to greatest (as opposed to ArrayList ordering, which is based on indices in the array). TreeSets allow us to add, remove, and check for inclusion (contains) relatively quickly. TreeSets work by incorporating nodes into a tree-like structure. The node class has 3 fields: the data field (this can be any type of object or simple type), the left child, which is of type node, and the right child, which is also of type node. In each tree, there is a head node. New nodes are inserted into the tree as follows: the new node is compared to the head node. If the new node s data is less than the head node s data, the new node is compared to the head node s left child. If the new node s data is greater than the head node s data, the new node is then compared to the head node s right child. The new node is then compared to the child node s left node or right node, depending on whether the new node is greater than or less than the child node. This continues until a child node is null. The new node is inserted there in the tree. (We discussed this in class). I have included code for a Node class and a simple TreeSet class, with add, find, and print already defined for you. Try running the code as it stands now and see how it works. Your job is to change both classes so that we now allow for duplicates. We will allow for duplicates by adding a clone field to the node class, which will link to a Node with duplicate data as the original Node. You will then need to modify the addnode method so that if the node is already in the tree, we add the new node as a clone child of the node in the tree (Note: there can be more than one duplicate). You will also need to modify the findnode method so that if a node with matching data is found in the Tree, you will print out all of the duplicate nodes. So given this main: public static void main(string[] args) { Tree thetree = new Tree(); thetree.addnode(50); thetree.addnode(30); thetree.addnode(25); thetree.addnode(15); thetree.addnode(30); thetree.addnode(75); thetree.addnode(85); thetree.addnode(30); thetree.addnode(50); thetree.addnode(25); thetree.addnode(25); thetree.printtree(thetree.root); // Find the Node2 with key 75 System.out.println("\nNode with the key 75"); System.out.println(theTree.findNode(75)); System.out.println("\nNode with the key 30"); System.out.println(theTree.findNode(30)); System.out.println("\nNode with the key 15");
3 System.out.println(theTree.findNode(15)); System.out.println("\nNode with the key 12"); System.out.println(theTree.findNode(12)); System.out.println("\nNode with the key 82"); System.out.println(theTree.findNode(82)); You should get this output from the original code I ve included below: 30 is already in the tree. 30 is already in the tree. 50 is already in the tree. 25 is already in the tree. 25 is already in the tree Node with the key 75 Found! Node with the key 30 Found! Node with the key 15 Found! Node with the key not in tree null Node with the key not in tree Null And you should get this from your modified code: 30 is already in the Tree2. 30 is already in the Tree2. 50 is already in the Tree2. 25 is already in the Tree2. 25 is already in the Tree Node2 with the key 75 Found! Node2 with the key 30 Found! 30 Found! 30 Found! 30
4 30 Node2 with the key 15 Found! Node2 with the key not in Tree2 null Node2 with the key not in Tree2 Null Note: In order to include duplicates, the total number of lines of code you need to add to the original code is 10 lines (and you could probably get away with less). Note2: I am including the PrintTree2 method for your new code. It requires that you name the new field in your new node class clone. Use the PrintTree2 method in place of the PrintTree method after you have modified the TreeSet code to include duplicates. Here is the code: public class Tree { Node root; public void addnode(int key) { // Create a new Node and initialize it Node newnode = new Node(key); // If there is no root this becomes root if (root == null) { root = newnode; else { // Set root as the Node we will start with as we traverse the tree Node focusnode = root; // Future parent for our new Node Node parent; while (true) { // root is the top parent so we start there parent = focusnode; // Check if the new node should go on the left side of the parent node if (key < focusnode.key) { // Switch focus to the left child focusnode = focusnode.leftchild; // If the left child has no children if (focusnode == null) { // then place the new node on the left of it parent.leftchild = newnode; return; // All Done else if (key > focusnode.key){
5 tree."); // If we get here put the node on the right focusnode = focusnode.rightchild; // If the right child has no children if (focusnode == null) { // then place the new node on the right of it parent.rightchild = newnode; return; // All Done else { //already in tree System.out.println(key + " is already in the return; //All nodes are visited in ascending order. Recursion is used to go to // one node and then go to its child nodes and so forth public void PrintTree(Node focusnode) { if (focusnode!= null) { // Traverse the left node PrintTree(focusNode.leftChild); // Visit the currently focused on node System.out.print(focusNode + " "); // Traverse the right node PrintTree(focusNode.rightChild); public Node findnode(int key) { // Start at the top of the tree Node focusnode = root; // While we haven't found the Node keep looking while (focusnode.key!= key) { // If we should search to the left if (key < focusnode.key) { // Shift the focus Node to the left child focusnode = focusnode.leftchild; else { // Shift the focus Node to the right child focusnode = focusnode.rightchild; // The node wasn't found if (focusnode == null) { System.out.println(key + " not in tree"); return null; System.out.println("Found! "+ focusnode); return focusnode; public static void main(string[] args) { Tree thetree = new Tree(); thetree.addnode(50); thetree.addnode(30);
6 thetree.addnode(25); thetree.addnode(15); thetree.addnode(30); thetree.addnode(75); thetree.addnode(85); thetree.addnode(30); thetree.addnode(50); thetree.addnode(25); thetree.addnode(25); thetree.printtree(thetree.root); // Find the Node2 with key 75 System.out.println("\nNode with the key 75"); System.out.println(theTree.findNode(75)); System.out.println("\nNode with the key 30"); System.out.println(theTree.findNode(30)); System.out.println("\nNode with the key 15"); System.out.println(theTree.findNode(15)); System.out.println("\nNode with the key 12"); System.out.println(theTree.findNode(12)); System.out.println("\nNode with the key 82"); System.out.println(theTree.findNode(82)); Here s the node class: public class Node { int key; Node leftchild; Node rightchild; public Node(int key) { this.key = key; public String tostring() { String str = ""; str += key + " "; return str; Here is the new PrintTree2 method: public void PrintTree2(Node focusnode) { if (focusnode!= null) { // Traverse the left Node PrintTree2(focusNode.leftChild); // Visit the currently focused on Node2 System.out.print(focusNode + " "); Node tempnode = focusnode; while (tempnode.clone!= null) { System.out.print(tempnode.clone + " "); tempnode = tempnode.clone; // Traverse the right Node2 PrintTree2(focusNode.rightChild);
7 Problem 3: HashMaps (25 pts) We re starting to write programs that write code (or write essays, or speak) automatically. In order to do this, we need to teach the system rules for what can legally follow what. The computer can learn this (at least in part) through observation of what has already been written (or spoken). So, for example, if a computer wants to learn legal rules for what words can follow other words, it might read in a number of documents and keep track of which words follow which words. With a large enough set of documents, it should have a pretty good idea of at the very least what is unlikely to follow other words. For instance, the word I may have as a set of words that follow it that include want, am, like, could, will, have, etc. The set of words would most likely not include words like, house, purple, cat, etc. We can do the same with computer programs. For this problem you will use a map. The key will be an individual string read in from a program (e.g., in a program that starts out, public class Tree { Node root; public void addnode(int key) {... Keys would be: public, class, Tree, {, Node, root;, void, addnode(int, key) The values will be an ArrayList of strings. The list will include every string in the file that follows the key word. So, for instance, the key public would have a value arraylist of [ class, void ]. The value is the set of valid options that can follow the key in a program. (If we really wanted to do this right, we d make the values be an ArrayList of objects, and the objects would have two fields, a string and a count. The count would keep track of how often a particular string followed the key. This would allow us to eliminate strings that only occurred once as anomalies). So your job is to read in the TreeSet.java file and place the strings in the file into a hashmap. Note that each string you read in is both a value (of the previous string) and a key. The last string in the TreeSet.java file should have a null value as a value in its arraylist. When you are done, print out the hashmap and look at the map. Does it look like it s learning properly or do we still need to add more rules? Part 2: Use the hashmap to generate a random program. Start with the key word, public and print that string to a new file. Choose a random string from the list of values that follow public. Print that string into your file. That string now becomes your key. Choose randomly from the list of values following the new key and print that. That value now becomes the key. Continue for, oh, say, 500 key/value pairs, or until you get the null value. Does this look anything like viable code? ************************************************** Game Learning (Project 2a, 50 pts): (Note: The game description is long, but the actual code is fairly straightforward to write)
8 In the game of sticks there is a heap of sticks on a board. On their turn, each player picks up 1 to 3 sticks. The one who has to pick the final stick will be the loser. Sample game The following is an example of the game of sticks. The game starts with 20 sticks on the board. Marvin takes 3 sticks, there are 17 sticks remaining. Hal takes 2 sticks, there are 15 sticks remaining. Marvin takes 1 stick, there are 14 sticks remaining. Hal takes 3 sticks, there are 11 sticks remaining. Marvin takes 2 sticks, there are 9 sticks remaining. Hal takes 2 sticks, there are 7 sticks remaining. Marvin takes 3 sticks, there are 4 sticks remaining. Hal takes 1 stick, there are 3 sticks remaining. Marvin takes 2 sticks, there is 1 stick remaining. Hal has to take the final stick and loses. This assignment is split into three parts: 1. Implementing the game as a two-player game. 2. Adding an AI that can be played against. 3. Adding an option for training the AI against another AI. Part one: Human vs. Human First, create a game where two players can play against each other. The two examples below demonstrate how the game should behave. Example 1 Welcome to the game of sticks! How many sticks are there on the table initially (10-100)? 10 There are 10 sticks on the board. There are 7 sticks on the board. Player 2: How many sticks do you take (1-3)? 3 There are 4 sticks on the board. There is 1 stick on the board. Player 2: How many sticks do you take (1-3)? 1 Player 2, you lose.
9 Example 2 Welcome to the game of sticks! How many sticks are there on the table initially (10-100)? 500 Please enter a number between 10 and 100 How many sticks are there on the table initially (10-100)? 3 Please enter a number between 10 and 100 How many sticks are there on the table initially (10-100)? 50 There are 50 sticks on the board. There are 47 sticks on the board. Player 2: How many sticks do you take (1-3)? 55 Please enter a number between 1 and 3 Player 2: How many sticks do you take (1-3)? 3 There are 44 sticks on the board.... There is 1 stick on the board. Player 1: How many sticks do you take (1-3)? 1 Player 1, you lose. Implement a game with the functionality described above. Part two: Human vs. AI Playing against your friends is nice, but you're studying computer science for a reason. We can learn to do some pretty cool stuff. So can the computers -- when taught. Let's create an AI for our game. One way to create an AI for the game of sticks is to mathematically analyze the game and craft an AI based on the analysis. However, we now do the opposite. We create a learning AI that is able to learn a good strategy for the game of sticks by playing the game against us. After this, the mathematical analysis is easier to do because we already know how to play the game optimally. Consider the functionality of the AI using the following description: An AI has a number of hats, one hat for each possible amount of sticks on the table. Initially, each hat contains three balls that are numbered from 1 to 3. If there are 10 sticks, there are 10 hats, each with 3 balls. At every step of the game that the AI plays, the AI takes a random ball out of the hat that matches the amount of sticks currently on the board. (So if the first player took 2 sticks, there are 8 sticks on the board. The AI takes a random ball (ball 1, 2, or 3), places it next to hat 8, and then reduces the number of sticks on the board by that random ball s amount. If the AI wins the game, it puts two balls of the type to each hat that has a ball next to it. Both balls have the same number. If the AI loses, it will throw away the balls that are
10 next to the hats (note: A hat must always have at least one ball of each number, hence the last ball of a specific number cannot be thrown away and must be put back to the hat). As more and more games are played, there will be more balls that indicate a good number of sticks to take. This means that as balls are taken at random, it becomes more likely that the AI is able to play well. Example Here s an example where there are 10 sticks at the beginning. The hat contents for the AI are as follows: hat content 1,2,3 1,2,3 1,2,3 1,2,3 1,2,3 1,2,3 1,2,3 1,2,3 1,2,3 1,2,3 The game may proceed as follows: 1. Player takes 3 sticks, there are 7 sticks remaining. 2. AI randomly picks up ball 2 from the hat 7. This means that the AI takes 2 sticks, and there are 5 sticks remaining. 3. Player takes 1 stick, there are 4 sticks remaining. 4. AI randomly picks up ball 3 from hat 4. This means that AI takes 3 sticks, and there is 1 stick remaining. 5. Player has to take the final stick and loses. Now, the situation with the AI is as follows: hat content 1,2,3 1,2,3 1,2,3 1,2 1,2,3 1,2,3 1,3 1,2,3 1,2,3 1,2,3 beside 3 2 As the AI wins the game, it will put the balls that are next to the hats back to the hats with extra balls. The situation is now as follows: hat content 1,2,3 1,2,3 1,2,3 1,2,3,3 1,2,3 1,2,3 1,2,2,3 1,2,3 1,2,3 1,2,3 Note: for the content of the hat, you should have some form of collection. The collection must allow doubles, and it must easily expand and contract in size. You will either be adding to the end of the collection, or removing from somewhere in the collection. Which collection most likely makes the most sense? Now the AI will more likely take 3 sticks in the case of four sticks remaining on the board, and 2 sticks in case there are 7 sticks remaining on the board.
11 Your task is to modify the human vs. human version of the game so that the player can choose to play against an AI that works as described above. After each game, the AI will update the contents of its hats. The AI will play relatively randomly at first, but you will notice that it will start to learn a strategy as you play against it. The following example displays how the program should behave after you have finished this step. Welcome to the game of sticks! How many sticks are there on the table initially (10-100)? 10 Options: Play against a friend (1) Play against the computer (2) Which option do you take (1-2)? 2 There are 10 sticks on the board. There are 7 sticks on the board. AI selects 2 There are 5 sticks on the board. There are 2 sticks on the board. AI selects 2 AI loses. Play again (1 = yes, 0 = no)? 1 There are 10 sticks on the board. Player 1: How many sticks do you take (1-3)? 1 There are 9 sticks on the board. AI selects 1 There are 8 sticks on the board. There are 5 sticks on the board. AI selects 3 There are 2 sticks on the board. Player 1: How many sticks do you take (1-3)? 2 You lose. Play again (1 = yes, 0 = no)? 1 There are 10 sticks on the board. There are 7 sticks on the board. AI selects 2 There are 5 sticks on the board.
12 There are 2 sticks on the board. AI selects 2 AI loses. Play again (1 = yes, 0 = no)? 0 Part three: AI vs. AI In the previous part we created an AI that is able to learn from playing against the player. As we play against it, we notice that it takes a considerable amount of time before the AI is able to perform against a human player. In this assignment, you need to modify the program so that the player can choose to play either against a naive AI or a pre-trained AI. In order to pre-train an AI, you need to create a program that allows two AIs to battle against each others -- say a hundred thousand times (after the training is working, try out different numbers as well!) -- and after that the player will be set to play against the AI that is ready to battle the player. The following example shows how the game would work with the trained AI option. Welcome to the game of sticks! How many sticks are there on the table initially (10-100)? 10 Options: Play against a friend (1) Play against the computer (2) Play against the trained computer (3) Which option do you take (1-3)? 3 Training AI, please wait... There are 10 sticks on the board. There are 7 sticks on the board. AI selects 2 There are 5 sticks on the board. Player 1: How many sticks do you take (1-3)? 1 There are 4 sticks on the board. AI selects 3 There is 1 stick on the board. Player 1: How many sticks do you take (1-3)? 1 You lose. Play again (1 = yes, 0 = no)? 1 There are 10 sticks on the board. Player 1: How many sticks do you take (1-3)? 2 There are 8 sticks on the board. AI selects 3 There are 5 sticks on the board. Player 1: How many sticks do you take (1-3)? 2
13 There are 3 sticks on the board. AI selects 2 There is 1 stick on the board. Player 1: How many sticks do you take (1-3)? 1 You lose. Play again (1 = yes, 0 = no)? 0 Congratulations! You ve just taught the computer to learn.
Project 2 - Blackjack Due 7/1/12 by Midnight
Project 2 - Blackjack Due 7//2 by Midnight In this project we will be writing a program to play blackjack (or 2). For those of you who are unfamiliar with the game, Blackjack is a card game where each
More informationARTIFICIAL INTELLIGENCE (CS 370D)
Princess Nora University Faculty of Computer & Information Systems ARTIFICIAL INTELLIGENCE (CS 370D) (CHAPTER-5) ADVERSARIAL SEARCH ADVERSARIAL SEARCH Optimal decisions Min algorithm α-β pruning Imperfect,
More informationBegin this assignment by first creating a new Java Project called Assignment 5.There is only one part to this assignment.
CSCI 2311, Spring 2013 Programming Assignment 5 The program is due Sunday, March 3 by midnight. Overview of Assignment Begin this assignment by first creating a new Java Project called Assignment 5.There
More informationBalanced Trees. Balanced Trees Tree. 2-3 Tree. 2 Node. Binary search trees are not guaranteed to be balanced given random inserts and deletes
Balanced Trees Balanced Trees 23 Tree Binary search trees are not guaranteed to be balanced given random inserts and deletes! Tree could degrade to O(n) operations Balanced search trees! Operations maintain
More informationTo use one-dimensional arrays and implement a collection class.
Lab 8 Handout 10 CSCI 134: Spring, 2015 Concentration Objective To use one-dimensional arrays and implement a collection class. Your lab assignment this week is to implement the memory game Concentration.
More informationWeb-CAT submission URL: CAT.woa/wa/assignments/eclipse
King Saud University College of Computer & Information Science CSC111 Lab05 Loops All Sections ------------------------------------------------------------------- Instructions Web-CAT submission URL: http://10.131.240.28:8080/web-cat/webobjects/web-
More informationCONCEPTS EXPLAINED CONCEPTS (IN ORDER)
CONCEPTS EXPLAINED This reference is a companion to the Tutorials for the purpose of providing deeper explanations of concepts related to game designing and building. This reference will be updated with
More informationMITOCW watch?v=fp7usgx_cvm
MITOCW watch?v=fp7usgx_cvm Let's get started. So today, we're going to look at one of my favorite puzzles. I'll say right at the beginning, that the coding associated with the puzzle is fairly straightforward.
More informationMITOCW Project: Backgammon tutor MIT Multicore Programming Primer, IAP 2007
MITOCW Project: Backgammon tutor MIT 6.189 Multicore Programming Primer, IAP 2007 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue
More informationCSC/MTH 231 Discrete Structures II Spring, Homework 5
CSC/MTH 231 Discrete Structures II Spring, 2010 Homework 5 Name 1. A six sided die D (with sides numbered 1, 2, 3, 4, 5, 6) is thrown once. a. What is the probability that a 3 is thrown? b. What is the
More informationSelf-Adjusting Binary Search Trees. Andrei Pârvu
Self-Adjusting Binary Search Trees Andrei Pârvu Andrei Pârvu 13-05-2015 1 Motivation Andrei Pârvu 13-05-2015 2 Motivation: Find Andrei Pârvu 13-05-2015 3 Motivation: Insert Andrei Pârvu 13-05-2015 4 Motivation:
More informationCSE 100: RED-BLACK TREES
1 CSE 100: RED-BLACK TREES 2 Red-Black Trees 1 70 10 20 60 8 6 80 90 40 1. Nodes are either red or black 2. Root is always black 3. If a node is red, all it s children must be black 4. For every node X,
More informationFinal Project: NOTE: The final project will be due on the last day of class, Friday, Dec 9 at midnight.
Final Project: NOTE: The final project will be due on the last day of class, Friday, Dec 9 at midnight. For this project, you may work with a partner, or you may choose to work alone. If you choose to
More informationOptimal Yahtzee performance in multi-player games
Optimal Yahtzee performance in multi-player games Andreas Serra aserra@kth.se Kai Widell Niigata kaiwn@kth.se April 12, 2013 Abstract Yahtzee is a game with a moderately large search space, dependent on
More information(Provisional) Lecture 31: Games, Round 2
CS17 Integrated Introduction to Computer Science Hughes (Provisional) Lecture 31: Games, Round 2 10:00 AM, Nov 17, 2017 Contents 1 Review from Last Class 1 2 Finishing the Code for Yucky Chocolate 2 3
More informationProblem A Rearranging a Sequence
Problem A Rearranging a Sequence Input: Standard Input Time Limit: seconds You are given an ordered sequence of integers, (,,,...,n). Then, a number of requests will be given. Each request specifies an
More informationComputer Science. Using neural networks and genetic algorithms in a Pac-man game
Computer Science Using neural networks and genetic algorithms in a Pac-man game Jaroslav Klíma Candidate D 0771 008 Gymnázium Jura Hronca 2003 Word count: 3959 Jaroslav Klíma D 0771 008 Page 1 Abstract:
More informationLESSON 2. Opening Leads Against Suit Contracts. General Concepts. General Introduction. Group Activities. Sample Deals
LESSON 2 Opening Leads Against Suit Contracts General Concepts General Introduction Group Activities Sample Deals 40 Defense in the 21st Century General Concepts Defense The opening lead against trump
More informationCOS 126 Atomic Theory of Matter
COS 126 Atomic Theory of Matter Goal of the Assignment Calculate Avogadro s number Using Einstein s equations Using fluorescent imaging Input data Sequence of images Each image is a rectangle of pixels
More informationAdversary Search. Ref: Chapter 5
Adversary Search Ref: Chapter 5 1 Games & A.I. Easy to measure success Easy to represent states Small number of operators Comparison against humans is possible. Many games can be modeled very easily, although
More informationProgramming Problems 14 th Annual Computer Science Programming Contest
Programming Problems 14 th Annual Computer Science Programming Contest Department of Mathematics and Computer Science Western Carolina University April 8, 2003 Criteria for Determining Team Scores Each
More informationSTATION 1: ROULETTE. Name of Guesser Tally of Wins Tally of Losses # of Wins #1 #2
Casino Lab 2017 -- ICM The House Always Wins! Casinos rely on the laws of probability and expected values of random variables to guarantee them profits on a daily basis. Some individuals will walk away
More informationExperiments on Alternatives to Minimax
Experiments on Alternatives to Minimax Dana Nau University of Maryland Paul Purdom Indiana University April 23, 1993 Chun-Hung Tzeng Ball State University Abstract In the field of Artificial Intelligence,
More informationTactics Time. Interviews w/ Chess Gurus John Herron Interview Tim Brennan
Tactics Time Interviews w/ Chess Gurus John Herron Interview Tim Brennan 12 John Herron Interview Timothy Brennan: Hello, this is Tim with http://tacticstime.com and today I have a very special guest,
More informationCS 229 Final Project: Using Reinforcement Learning to Play Othello
CS 229 Final Project: Using Reinforcement Learning to Play Othello Kevin Fry Frank Zheng Xianming Li ID: kfry ID: fzheng ID: xmli 16 December 2016 Abstract We built an AI that learned to play Othello.
More informationPROSPERITY TRANSFORM DEVELOP SOLID MANAGERS
PATH TO STRONG At Nature s Sunshine we are in the business of transforming lives. Effecting significant and positive changes in your life and in the lives of those around you is how we measure success.
More informationCSS 343 Data Structures, Algorithms, and Discrete Math II. Balanced Search Trees. Yusuf Pisan
CSS 343 Data Structures, Algorithms, and Discrete Math II Balanced Search Trees Yusuf Pisan Height Height of a tree impacts how long it takes to find an item Balanced tree O(log n) vs Degenerate tree O(n)
More informationIntroduction to Turtle Art
Introduction to Turtle Art The Turtle Art interface has three basic menu options: New: Creates a new Turtle Art project Open: Allows you to open a Turtle Art project which has been saved onto the computer
More information1 Introduction. 1.1 Game play. CSC 261 Lab 4: Adversarial Search Fall Assigned: Tuesday 24 September 2013
CSC 261 Lab 4: Adversarial Search Fall 2013 Assigned: Tuesday 24 September 2013 Due: Monday 30 September 2011, 11:59 p.m. Objectives: Understand adversarial search implementations Explore performance implications
More informationProbability Paradoxes
Probability Paradoxes Washington University Math Circle February 20, 2011 1 Introduction We re all familiar with the idea of probability, even if we haven t studied it. That is what makes probability so
More informationV. Adamchik Data Structures. Game Trees. Lecture 1. Apr. 05, Plan: 1. Introduction. 2. Game of NIM. 3. Minimax
Game Trees Lecture 1 Apr. 05, 2005 Plan: 1. Introduction 2. Game of NIM 3. Minimax V. Adamchik 2 ü Introduction The search problems we have studied so far assume that the situation is not going to change.
More informationPRIORITY QUEUES AND HEAPS. Lecture 19 CS2110 Spring 2014
1 PRIORITY QUEUES AND HEAPS Lecture 19 CS2110 Spring 2014 Readings and Homework 2 Read Chapter 2 to learn about heaps Salespeople often make matrices that show all the great features of their product that
More informationTopic 23 Red Black Trees
Topic 23 "People in every direction No words exchanged No time to exchange And all the little ants are marching Red and Black antennas waving" -Ants Marching, Dave Matthew's Band "Welcome to L.A.'s Automated
More informationMITOCW 6. AVL Trees, AVL Sort
MITOCW 6. AVL Trees, AVL Sort The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free.
More informationSummer Camp Curriculum
Day 1: Introduction Summer Camp Curriculum While shuffling a deck of playing cards, announce to the class that today they will begin learning a game that is played with a set of cards like the one you
More informationNeon Genesis Evangelion The Card Game. Official Rule Book - Version 2.0 English Edition
Neon Genesis Evangelion The Card Game Official Rule Book - Version 2.0 English Edition Introduction The Carddass Masters G Neon Genesis Evangelion Card Game is a trading card game set in the world of the
More informationCS510 \ Lecture Ariel Stolerman
CS510 \ Lecture04 2012-10-15 1 Ariel Stolerman Administration Assignment 2: just a programming assignment. Midterm: posted by next week (5), will cover: o Lectures o Readings A midterm review sheet will
More informationDesign Cycle Project Example
Design Cycle Project Example What is the problem? Investigate Your paragraph/writing for this section should include an explanation about your assignment. You should focus your writing around the topic
More informationChord Reference Cheat Sheets For 5 Popular Keys
Chord Reference Cheat Sheets For 5 Popular Keys Copyright 2017 RiffNinja.com Helpful Tips To Get Started Welcome! This short booklet is designed to be a quick reference for you, to give you all of the
More informationModule 5: How To Explain Your Coaching
Module 5: How To Explain Your Coaching This is where you explain your coaching, consulting, healing or whatever it is that you re going to do to help them. You want to explain it in a way that makes sense,
More informationCheckpoint Questions Due Monday, October 7 at 2:15 PM Remaining Questions Due Friday, October 11 at 2:15 PM
CS13 Handout 8 Fall 13 October 4, 13 Problem Set This second problem set is all about induction and the sheer breadth of applications it entails. By the time you're done with this problem set, you will
More informationLESSON 4. Second-Hand Play. General Concepts. General Introduction. Group Activities. Sample Deals
LESSON 4 Second-Hand Play General Concepts General Introduction Group Activities Sample Deals 110 Defense in the 21st Century General Concepts Defense Second-hand play Second hand plays low to: Conserve
More informationGame-playing AIs: Games and Adversarial Search I AIMA
Game-playing AIs: Games and Adversarial Search I AIMA 5.1-5.2 Games: Outline of Unit Part I: Games as Search Motivation Game-playing AI successes Game Trees Evaluation Functions Part II: Adversarial Search
More informationMITOCW R11. Principles of Algorithm Design
MITOCW R11. Principles of Algorithm Design The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources
More informationCato s Hike Quick Start
Cato s Hike Quick Start Version 1.1 Introduction Cato s Hike is a fun game to teach children and young adults the basics of programming and logic in an engaging game. You don t need any experience to play
More informationCMS.608 / CMS.864 Game Design Spring 2008
MIT OpenCourseWare http://ocw.mit.edu / CMS.864 Game Design Spring 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. DrawBridge Sharat Bhat My card
More informationMore Adversarial Search
More Adversarial Search CS151 David Kauchak Fall 2010 http://xkcd.com/761/ Some material borrowed from : Sara Owsley Sood and others Admin Written 2 posted Machine requirements for mancala Most of the
More informationCS 540-2: Introduction to Artificial Intelligence Homework Assignment #2. Assigned: Monday, February 6 Due: Saturday, February 18
CS 540-2: Introduction to Artificial Intelligence Homework Assignment #2 Assigned: Monday, February 6 Due: Saturday, February 18 Hand-In Instructions This assignment includes written problems and programming
More informationOjas Ahuja, Kevin Black CS314H 12 October 2018
Tetris Ojas Ahuja, Kevin Black CS314H 12 October 2018 1 Introduction We implement Tetris, a classic computer game in which a player must arrange variously-shaped falling pieces into rows on a 2D grid.
More informationPositive Triangle Game
Positive Triangle Game Two players take turns marking the edges of a complete graph, for some n with (+) or ( ) signs. The two players can choose either mark (this is known as a choice game). In this game,
More informationCOS 226 Algorithms and Data Structures Fall Midterm Exam
COS 226 lgorithms and Data Structures Fall 2015 Midterm Exam This exam has 8 questions worth a total of 100 points. You have 80 minutes. The exam is closed book, except that you are allowed to use one
More informationName: Exam 01 (Midterm Part 2 take home, open everything)
Name: Exam 01 (Midterm Part 2 take home, open everything) To help you budget your time, questions are marked with *s. One * indicates a straightforward question testing foundational knowledge. Two ** indicate
More informationCOS 226 Algorithms and Data Structures Fall Midterm Exam
COS 226 lgorithms and Data Structures Fall 2015 Midterm Exam You have 80 minutes for this exam. The exam is closed book, except that you are allowed to use one page of notes (8.5-by-11, one side, in your
More informationJS Lab 5 Due Thurs, Nov 30 (After Thanksgiving)
JS Lab 5 Due Thurs, Nov 30 (After Thanksgiving) With instructions for final project, due Dec 8 at bottom You may work on this lab with your final project partner, or you may work alone. This lab will be
More informationBERKS & BUCKS SIMULTANEOUS PAIRS SEPTEMBER Commentary for Tuesday 18 th Sept. Prepared by Mike Ribbins
BERKS & BUCKS SIMULTANEOUS PAIRS SEPTEMBER 2018 Commentary for Tuesday 18 th Sept Prepared by Mike Ribbins K 973 K 6 A 952 1097 A Q 2 86 1073 A J 9542 K J 1064 K Q J 842 5 J 1054 Q 8 Q 873 A 63 10 N -
More informationTic Feedback. Don t fall behind! the rest of the course. tic. you. us too
LECTURE 1 Announcements Tic is over! Tic Feedback Don t fall behind! the rest of the course tic you us too Global Reqs They exist! Cover broad standards for every project runs 20+ FPS, engine and game
More informationor More Events Activities D2.1 Open and Shut Case D2.2 Fruit Machines D2.3 Birthdays Notes for Solutions (1 page)
D2 Probability of Two or More Events Activities Activities D2.1 Open and Shut Case D2.2 Fruit Machines D2.3 Birthdays Notes for Solutions (1 page) ACTIVITY D2.1 Open and Shut Case In a Game Show in America,
More informationEmpire Deluxe Combined Edition Open Source Guide To Map Making And AI Players
Empire Deluxe Combined Edition Open Source Guide To Map Making And AI Players Last updated: 08/31/17 Table Of Contents Table Of Contents...1 Introduction...2 Empire Common DLL...3 World Building Development
More informationPRIORITY QUEUES AND HEAPS. Slides of Ken Birman, Cornell University
PRIORITY QUEUES AND HEAPS Slides of Ken Birman, Cornell University The Bag Interface 2 A Bag: interface Bag { void insert(e obj); E extract(); //extract some element boolean isempty(); } Examples: Stack,
More informationIF YOU CAN COUNT, YOU CAN HELP A SCIENTIST!
IF YOU CAN COUNT, YOU CAN HELP A SCIENTIST! Big Idea The Great Backyard Bird Count (GBBC) takes place during of each year; your students can count birds and submit data that will help scientists. This
More informationMITOCW ocw lec11
MITOCW ocw-6.046-lec11 Here 2. Good morning. Today we're going to talk about augmenting data structures. That one is 23 and that is 23. And I look here. For this one, And this is a -- Normally, rather
More informationSheepshead, THE Game Set Up
Figure 1 is a screen shot of the Partner Method tab. Figure 1 The Partner Method determines how the partner is calculated. 1. Jack of Diamonds Call Up Before Picking. This method allows the picker to call
More informationArtificial Intelligence. Minimax and alpha-beta pruning
Artificial Intelligence Minimax and alpha-beta pruning In which we examine the problems that arise when we try to plan ahead to get the best result in a world that includes a hostile agent (other agent
More informationPINOCHLE SINGLE DECK PARTNERS STRATAGY NOTES
PINOCHLE SINGLE DECK PARTNERS STRATAGY NOTES (Note: Strategy Notes there may be errors and omissions). There are many techniques used in evaluating a hand. Some require more experience than others. Our
More informationGame Playing AI Class 8 Ch , 5.4.1, 5.5
Game Playing AI Class Ch. 5.-5., 5.4., 5.5 Bookkeeping HW Due 0/, :59pm Remaining CSP questions? Cynthia Matuszek CMSC 6 Based on slides by Marie desjardin, Francisco Iacobelli Today s Class Clear criteria
More informationWhat makes a good Grand?
What makes a good Grand? Grand is easier to play than a suit game only 4 trumps, not the usual 11! The hardest part of playing Grands is recognizing when you have one and when you don t! The Rule of Strong
More informationLesson 2. Overcalls and Advances
Lesson 2 Overcalls and Advances Lesson Two: Overcalls and Advances Preparation On Each Table: At Registration Desk: Class Organization: Teacher Tools: BETTER BRIDGE GUIDE CARD (see Appendix); Bidding Boxes;
More informationThe Exciting World of Bridge
The Exciting World of Bridge Welcome to the exciting world of Bridge, the greatest game in the world! These lessons will assume that you are familiar with trick taking games like Euchre and Hearts. If
More informationADVANCED COMPETITIVE DUPLICATE BIDDING
This paper introduces Penalty Doubles and Sacrifice Bids at Duplicate. Both are quite rare, but when they come up, they are heavily dependent on your ability to calculate alternative scores quickly and
More informationMITOCW watch?v=2g9osrkjuzm
MITOCW watch?v=2g9osrkjuzm The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To
More informationHandling the Pressure l Session 6
Handling the Pressure l Session 6 Under Pressure Role Plays Put Yourself into the Story Instructions: Photocopy this page and cut out the cards. Read one scenario at a time and choose a child to answer
More informationCISC 1600, Lab 2.2: More games in Scratch
CISC 1600, Lab 2.2: More games in Scratch Prof Michael Mandel Introduction Today we will be starting to make a game in Scratch, which ultimately will become your submission for Project 3. This lab contains
More informationThe Basic Endplay by Bob Gruber
The Basic Endplay by Bob Gruber Today, let s concentrate on an intermediate technique called the strip and end play. Just what is a strip and end play? Rather than give a complex definition, I d rather
More informationMITOCW watch?v=-qcpo_dwjk4
MITOCW watch?v=-qcpo_dwjk4 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To
More informationLESSON 5. Watching Out for Entries. General Concepts. General Introduction. Group Activities. Sample Deals
LESSON 5 Watching Out for Entries General Concepts General Introduction Group Activities Sample Deals 114 Lesson 5 Watching out for Entries GENERAL CONCEPTS Play of the Hand Entries Sure entries Creating
More informationAdvanced Strategy in Spades
Advanced Strategy in Spades Just recently someone at elite and a newbie to spade had asked me if there were any guidelines I follow when bidding, playing if there were any specific strategies involved
More informationMITOCW R9. Rolling Hashes, Amortized Analysis
MITOCW R9. Rolling Hashes, Amortized Analysis The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources
More informationSUMMER MATH-LETES. Math for the Fun of It!
SUMMER MATH-LETES Math for the Fun of It! During this busy summer take some time to experience math! Here are some suggested activities for you to try during vacation. Also, take advantage of opportunities
More informationHomework Assignment #2
CS 540-2: Introduction to Artificial Intelligence Homework Assignment #2 Assigned: Thursday, February 15 Due: Sunday, February 25 Hand-in Instructions This homework assignment includes two written problems
More informationProbability (Devore Chapter Two)
Probability (Devore Chapter Two) 1016-351-01 Probability Winter 2011-2012 Contents 1 Axiomatic Probability 2 1.1 Outcomes and Events............................... 2 1.2 Rules of Probability................................
More informationLESSON 4. Eliminating Losers Ruffing and Discarding. General Concepts. General Introduction. Group Activities. Sample Deals
LESSON 4 Eliminating Losers Ruffing and Discarding General Concepts General Introduction Group Activities Sample Deals 90 Lesson 4 Eliminating Losers Ruffing and Discarding GENERAL CONCEPTS Play of the
More informationAlgorithms for Data Structures: Search for Games. Phillip Smith 27/11/13
Algorithms for Data Structures: Search for Games Phillip Smith 27/11/13 Search for Games Following this lecture you should be able to: Understand the search process in games How an AI decides on the best
More informationInstructor (Mehran Sahami):
Programming Methodology-Lecture24 Instructor (Mehran Sahami): So welcome back! So yet another fun-filled, exciting day of 26A. After the break, it almost feels like I came into the office this morning,
More informationLESSON 3. Developing Tricks the Finesse. General Concepts. General Information. Group Activities. Sample Deals
LESSON 3 Developing Tricks the Finesse General Concepts General Information Group Activities Sample Deals 64 Lesson 3 Developing Tricks the Finesse Play of the Hand The finesse Leading toward the high
More informationLesson 3. Takeout Doubles and Advances
Lesson 3 Takeout Doubles and Advances Lesson Three: Takeout Doubles and Advances Preparation On Each Table: At Registration Desk: Class Organization: Teacher Tools: BETTER BRIDGE GUIDE CARD (see Appendix);
More information3. If you can t make the sum with your cards, you must draw one card. 4. Players take turns rolling and discarding cards.
1 to 10 Purpose: The object of the game is to get rid of all your cards. One player gets all the red cards, the other gets all the black cards. Players: 2-4 players Materials: 2 dice, a deck of cards,
More informationclass TicTacToe: def init (self): # board is a list of 10 strings representing the board(ignore index 0) self.board = [" "]*10 self.
The goal of this lab is to practice problem solving by implementing the Tic Tac Toe game. Tic Tac Toe is a game for two players who take turns to fill a 3 X 3 grid with either o or x. Each player alternates
More informationMike: Pretty good, thank you.
Kris: Hi this is Kris Alban, with another instalment of our financial aid and financial literacy podcast. With me on this session is Mike Fife who is the lead financial sophistication coordinator at Champlain
More informationThere certainly is a good case for having splinters, but what is the best way to go about it? What sort of hand do we need for a splinter?
2.9 Looking for Slam (after Stayman) We have defined most of responder s 2 nd bids after Stayman, but there are a few remaining. Consider: - After 1NT - 2-2, what is 3, 4 or 4? After 1NT - 2-2, what is
More informationPlaying Games. Henry Z. Lo. June 23, We consider writing AI to play games with the following properties:
Playing Games Henry Z. Lo June 23, 2014 1 Games We consider writing AI to play games with the following properties: Two players. Determinism: no chance is involved; game state based purely on decisions
More informationA Guide To Scoring Single Events With BridgePads. written by Cad Delworth, Carlton Bridge Club, Edinburgh
A Guide To Scoring Single Events With BridgePads 1 A Guide To Scoring Single Events With BridgePads written by Cad Delworth, Carlton Bridge Club, Edinburgh This is revision number 8, saved at 09:11:00
More informationF Home Articulation Game Frog Jump
Frog Jump Target Phrase Frog jump Stand next to your child. Squat down and place your hands on the floor, like a frog. Next, say "frog jump" as you take turns jumping forward like a frog. See who can jump
More informationProgramming Languages and Techniques Homework 3
Programming Languages and Techniques Homework 3 Due as per deadline on canvas This homework deals with the following topics * lists * being creative in creating a game strategy (aka having fun) General
More informationGames and Adversarial Search II
Games and Adversarial Search II Alpha-Beta Pruning (AIMA 5.3) Some slides adapted from Richard Lathrop, USC/ISI, CS 271 Review: The Minimax Rule Idea: Make the best move for MAX assuming that MIN always
More informationGame-playing AIs: Games and Adversarial Search FINAL SET (w/ pruning study examples) AIMA
Game-playing AIs: Games and Adversarial Search FINAL SET (w/ pruning study examples) AIMA 5.1-5.2 Games: Outline of Unit Part I: Games as Search Motivation Game-playing AI successes Game Trees Evaluation
More informationGirls Programming Network. Scissors Paper Rock!
Girls Programming Network Scissors Paper Rock! This project was created by GPN Australia for GPN sites all around Australia! This workbook and related materials were created by tutors at: Sydney, Canberra
More informationSchool Based Projects
Welcome to the Week One lesson. School Based Projects Who is this lesson for? If you're a high school, university or college student, or you're taking a well defined course, maybe you're going to your
More informationBE SURE TO COMPLETE HYPOTHESIS STATEMENTS FOR EACH STAGE. ( ) DO NOT USE THE TEST BUTTON IN THIS ACTIVITY UNTIL THE END!
Lazarus: Stages 3 & 4 In the world that we live in, we are a subject to the laws of physics. The law of gravity brings objects down to earth. Actions have equal and opposite reactions. Some objects have
More informationMath Fundamentals for Statistics (Math 52) Unit 2:Number Line and Ordering. By Scott Fallstrom and Brent Pickett The How and Whys Guys.
Math Fundamentals for Statistics (Math 52) Unit 2:Number Line and Ordering By Scott Fallstrom and Brent Pickett The How and Whys Guys Unit 2 Page 1 2.1: Place Values We just looked at graphing ordered
More informationInformatics 2D: Tutorial 1 (Solutions)
Informatics 2D: Tutorial 1 (Solutions) Agents, Environment, Search Week 2 1 Agents and Environments Consider the following agents: A robot vacuum cleaner which follows a pre-set route around a house and
More information