C++ is Fun – Part 12 at Turbine/Warner Bros.! Russell Hanson.

Slides:



Advertisements
Similar presentations
COSC2007 Data Structures II
Advertisements

Heuristics in AI Search. waretopics/software/story/0,10801, 99340,00.html waretopics/software/story/0,10801,
C++ is Fun – Part 10 at Turbine/Warner Bros.! Russell Hanson.
Adversarial Search We have experience in search where we assume that we are the only intelligent being and we have explicit control over the “world”. Lets.
Computers playing games. One-player games Puzzle: Place 8 queens on a chess board so that no two queens attack each other (i.e. on the same row, same.
C++ is Fun – Part Six at Turbine/Warner Bros.! Russell Hanson.
Tic Tac Toe size(600,600); Aim: How can we set up our canvas and display for a Tic Tac Toe game? 1. Sketch the two drawings and write the two code.
Playing Tic Tac Toe with Neural Networks Justin Herbrand CS/ECE/ME 539.
Tic Tac Toe Game Design Using OOP
Part2 AI as Representation and Search
CHAPTER 10 FUN AND GAMES Group 1: Xiangling Liu.
PLANNING THE TIC TAC TOE GAME BY NEEL DAVE. TIC TAC TOE INSTRUCTIONS Tic Tac Toe Instructions The basic concept of Tic Tac Toe 1.This is a game for two.
Tic Tac Toe Architecture CSE 5290 – Artificial Intelligence 06/13/2011 Christopher Hepler.
Presented by : Ashin Ara Bithi Roll : 09 Iffat Ara Roll : 22 12th Batch Department of Computer Science & Engineering University of Dhaka.
Chess AI’s, How do they work? Math Club 10/03/2011.
Welcome to C++ is Fun at Turbine/Warner Bros.! Russell Hanson.
Didier Perroud Raynald Seydoux Frédéric Barras.  Abstract  Objectives  Modalities ◦ Project modalities ◦ CASE/CARE  Implementation ◦ VICI, Iphone,
XNA Game-Themed Workshop, FDG Pre-Conference Workshop, April 25, 2009 Developing a Simple Game-Themed Application Kelvin Sung Computing and Software Systems.
Shallow Blue Project 2 Due date: April 5 th. Introduction Second in series of three projects This project focuses on getting AI opponent Subsequent project.
Online Chess Project 3 Due date: April 17 th. Introduction Third in series of three projects This project focuses on adding online support –2 players.
Backtracking. Introduction Systematic way to do an exhaustive search Take advantage of pruning when possible.
Adversarial Search: Game Playing Reading: Chess paper.
Introduction to WEKA Aaron 2/13/2009. Contents Introduction to weka Download and install weka Basic use of weka Weka API Survey.
Introduction to OpenGL. What is OpenGL OpenGL is a low-level software interface to graphics hardware No commands for performing windowing tasks or obtaining.
C++ is Fun – Part 14 at Turbine/Warner Bros.! Russell Hanson.
C++ is Fun – Part Nine at Turbine/Warner Bros.! Russell Hanson.
C++ is Fun – Part 13 at Turbine/Warner Bros.! Russell Hanson.
C++ is Fun – Part Eight at Turbine/Warner Bros.! Russell Hanson.
THE RENJU GAME BY ABHISHEK JAIN, PRANSHU GUPTA & RHYTHM DAS PCLUB SUMMER PROJECT PRESENTATION JUNE, L7 IIT KANPUR MENTOR – SANIL JAIN.
Prof. dr Slobodanka Đorđević-Kajan Dr Dragan Stojanović
Introduction CSE 2320 – Algorithms and Data Structures Vassilis Athitsos University of Texas at Arlington 1.
Minimax.
OpenGL Shading Language (Advanced Computer Graphics) Ernest Tatum.
Chapter 15 Recursion INTRODUCTION Recursion is a program-solving technique that expresses the solution of a problem in terms of the solutions of.
1 Introduction to Computer Graphics SEN Introduction to OpenGL Graphics Applications.
Computer Graphics I, Fall 2008 Introduction to Computer Graphics.
1 JEOPARDY! Version __: Review for ________ 2 Topic $100 $200 $300 $400 $500 Topic.
Connect Four AI Robert Burns and Brett Crawford. Connect Four  A board with at least six rows and seven columns  Two players: one with red discs and.
Introduction to OpenGL Programming Jian-Liang Lin 2002.
Machine Learning for an Artificial Intelligence Playing Tic-Tac-Toe Computer Systems Lab 2005 By Rachel Miller.
Cilk Pousse James Process CS534. Overview Introduction to Pousse Searching Evaluation Function Move Ordering Conclusion.
Game Board Title Your name. Game Board Title Topic 1 – 100 points Enter your answer.
Outline Intro to Representation and Heuristic Search Machine Learning (Clustering) and My Research.
C++ is Fun – Part 15 at Turbine/Warner Bros.! Russell Hanson.
Introduction to Game Theory Kamal Aboul-Hosn Cornell University Computers Playing Games.
CS 100Lecture 191 CS100J Lecture 19 n Previous Lecture –Two dimensional arrays. –Reasonable size problem (a past assignment). –Stepwise refinement. –Use.
Super EastGate Jon Caron, Ryan Fleming, Antonio Guarino, and Mike LoVerme Merrimack College Introduction Super EastGate is a 2D side scroller game that.
Introduction to Game Programming Pertemuan 11 Matakuliah: T0944-Game Design and Programming Tahun: 2010.
Adversarial Search. Regular Tic Tac Toe Play a few games. –What is the expected outcome –What kinds of moves “guarantee” that?
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Artificial Intelligence in Game Design Board Games and the MinMax Algorithm.
Understanding AI of 2 Player Games. Motivation Not much experience in AI (first AI project) and no specific interests/passion that I wanted to explore.
1 Decisions in games Minimax algorithm  -  algorithm Tic-Tac-Toe game Decisions in games Minimax algorithm  -  algorithm Tic-Tac-Toe game.
CISC220 Spring 2010 James Atlas Lecture 04: Pointers, Functions, Memory Management, ADTs, Classes, Hardware, Software, Graphics, Networking, AI, Databases,
ADVERSARIAL GAME SEARCH: Min-Max Search
Backtracking, Search, Heuristics
CS100J Lecture 19 Previous Lecture This Lecture
Intro to Computer Science II
Robotics csi445 Final Project:
Tic-Tac-Throw! How to Play: X or O
O X X O O X X O X O X O O X O X O X Tic Tac Toe Graphical
CS Fall 2016 (Shavlik©), Lecture 11, Week 6
Lesson 5 Functions I A function is a small program which accomplishes a specific task. For example, we invoke (call) the function, sqrt(x), in the library.
Adversarial Search.
Review.
Depth-First Searches Introduction to AI.
Mobile Gaming Through The Wireless Internet
Virtual PacMan By Brett Jones.
Advanced DAX – Tic Tac Toe
Introduction to OpenGL
Presentation transcript:

C++ is Fun – Part 12 at Turbine/Warner Bros.! Russell Hanson

Syllabus 1) First program and introduction to data types and control structures with applications for games learning how to use the programming environment Mar ) Objects, encapsulation, abstract data types, data protection and scope April 1-3 3) Basic data structures and how to use them, opening files and performing operations on files – April ) Algorithms on data structures, algorithms for specific tasks, simple AI and planning type algorithms, game AI algorithms April Project 1 Due – April 17 5) More AI: search, heuristics, optimization, decision trees, supervised/unsupervised learning – April ) Game API and/or event-oriented programming, model view controller, map reduce filter – April 29, May 1 7) Basic threads models and some simple databases SQLite May 6-8 8) Graphics programming, shaders, textures, 3D models and rotations May Project 2 Due May 15 9) How to download an API and learn how to use functions in that API, Windows Foundation Classes May ) Designing and implementing a simple game in C++ May ) Selected topics – Gesture recognition & depth controllers like the Microsoft Kinect, Network Programming & TCP/IP, OSC June ) Working on student projects - June Final project presentations Project 3/Final Project Due June 12

Woah! Tic Tac Toe!!! Welcome to Tic-Tac-Toe You will make your move by entering a number, 0-8. The number will correspond to the board position as illustrated: 0 | 1 | 2 3 | 4 | 5 6 | 7 | 8 You want to go first? (y/n) : y You want to be X or O? (x/o) : X You want to be X or O? (x/o) : x | | | Where do you want to move? (0 - 8): 0 X | | | | | | X | | | | O | | | | | Where do you want to move? (0 - 8): 8 X | | | | O | | | | X | X | | O | | O | | | | X | Where do you want to move? (0 - 8): 6 X | | O | | O | | X | | X | X | | O | | O | | X | O | X | Where do you want to move? (0 - 8): 1 X | X | O | | O | | X | O | X | X | X | O | O | O | | X | O | X | Where do you want to move? (0 - 8): 5 X | X | O | O | O | X | X | O | X | TIE! sh: PAUSE: command not found Russells-MacBook-Pro:mgraessle_Homework4 russell$ X | | O | | O | | X | O | X | Where do you want to move? (0 - 8): 1 X | X | O | | O | | X | O | X | X | X | O | O | O | | X | O | X | Where do you want to move? (0 - 8): 5 X | X | O | O | O | X | X | O | X | TIE! sh: PAUSE: command not found Russells-MacBook-Pro:mgraessle_Homework4 russell$

/* Use the current empty pieces to have the computer choose the best move to counter the last human move */ void Board::computerMove() { // set the list of all the ways to win int WAYS_TO_WIN [8][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 4, 8}, {2, 4, 6}}; // if computer can win, take that move for (int i = 0; i < 8; ++i) { if ( board_pieces[WAYS_TO_WIN[i][0]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][1]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][2]] == EMPTY) { setPiece(WAYS_TO_WIN[i][2], COMPUTER); return; } else { if ( board_pieces[WAYS_TO_WIN[i][1]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][2]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][0]] == EMPTY) { setPiece(WAYS_TO_WIN[i][0], COMPUTER); return; } else { if ( board_pieces[WAYS_TO_WIN[i][0]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][2]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][1]] == EMPTY ) { setPiece(WAYS_TO_WIN[i][1], COMPUTER); return; } // if human can win, block that move for (int i = 0; i < 8; ++i) { if ( board_pieces[WAYS_TO_WIN[i][0]] == HUMAN && board_pieces[WAYS_TO_WIN[i][1]] == HUMAN && board_pieces[WAYS_TO_WIN[i][2]] == EMPTY) { setPiece(WAYS_TO_WIN[i][2], COMPUTER); return; } else { if ( board_pieces[WAYS_TO_WIN[i][1]] == HUMAN && board_pieces[WAYS_TO_WIN[i][2]] == HUMAN && board_pieces[WAYS_TO_WIN[i][0]] == EMPTY) { setPiece(WAYS_TO_WIN[i][0], COMPUTER); return; } else { if ( board_pieces[WAYS_TO_WIN[i][0]] == HUMAN && board_pieces[WAYS_TO_WIN[i][2]] == HUMAN && board_pieces[WAYS_TO_WIN[i][1]] == EMPTY ) { setPiece(WAYS_TO_WIN[i][1], COMPUTER); return; } int BEST_MOVES[10] = {4, 0, 2, 6, 8, 1, 3, 5, 7}; // if one of the best squares is empty, take it for (int i = 0; i < 10; ++i) { if ( isMoveLegal(BEST_MOVES[i]) ) { setPiece(BEST_MOVES[i], COMPUTER); break; }// end if }// end for }// end computerMove

/* Use the current empty pieces to have the computer choose the best move to counter the last human move */ void Board::computerMove() { // set the list of all the ways to win int WAYS_TO_WIN [8][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}, {0, 3, 6}, {1, 4, 7}, {2, 5, 8}, {0, 4, 8}, {2, 4, 6}}; // if computer can win, take that move for (int i = 0; i < 8; ++i) { if ( board_pieces[WAYS_TO_WIN[i][0]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][1]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][2]] == EMPTY) { setPiece(WAYS_TO_WIN[i][2], COMPUTER); return; } else { if ( board_pieces[WAYS_TO_WIN[i][1]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][2]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][0]] == EMPTY) { setPiece(WAYS_TO_WIN[i][0], COMPUTER); return; } else { if ( board_pieces[WAYS_TO_WIN[i][0]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][2]] == COMPUTER && board_pieces[WAYS_TO_WIN[i][1]] == EMPTY ) { setPiece(WAYS_TO_WIN[i][1], COMPUTER); return; } // if human can win, block that move for (int i = 0; i < 8; ++i) { if ( board_pieces[WAYS_TO_WIN[i][0]] == HUMAN && board_pieces[WAYS_TO_WIN[i][1]] == HUMAN && board_pieces[WAYS_TO_WIN[i][2]] == EMPTY) { setPiece(WAYS_TO_WIN[i][2], COMPUTER); return; } else { if ( board_pieces[WAYS_TO_WIN[i][1]] == HUMAN && board_pieces[WAYS_TO_WIN[i][2]] == HUMAN && board_pieces[WAYS_TO_WIN[i][0]] == EMPTY) { setPiece(WAYS_TO_WIN[i][0], COMPUTER); return; } else { if ( board_pieces[WAYS_TO_WIN[i][0]] == HUMAN && board_pieces[WAYS_TO_WIN[i][2]] == HUMAN && board_pieces[WAYS_TO_WIN[i][1]] == EMPTY ) { setPiece(WAYS_TO_WIN[i][1], COMPUTER); return; } int BEST_MOVES[10] = {4, 0, 2, 6, 8, 1, 3, 5, 7}; // if one of the best squares is empty, take it for (int i = 0; i < 10; ++i) { if ( isMoveLegal(BEST_MOVES[i]) ) { setPiece(BEST_MOVES[i], COMPUTER); break; }// end if }// end for }// end computerMove

Graphics and OpenGL!

Double Buffering

Some links: pengl-quick-reference-card.pdf pengl-quick-reference-card.pdf The Official Guide to Learning OpenGL, Version OpenGL Tutorial addison.pdf