Artificial Intelligence and Robotics By Keith Bright & John DeBovis.

Slides:



Advertisements
Similar presentations
COSC2007 Data Structures II
Advertisements

Tic tac toe v1.2 Made by Rogonow XX PC: X YOU: O The PC-player with mark X goes first. After the PC, you place the mark O at the position of a green oval.
Tic-Tac-Toe Using the Graphing Calculator for Derivatives.
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
TIC-TAC-TOE FELIX CHEN CLUSTER 5: Computers in Biophysics and Robotics.
DATA STRUCTURES AND ALGORITHMS.  The project that we worked on is a well known game called “Tic Tac Toe”.  We implemented this game using a binary tree.
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.
J AVA A SSIGNMENT 1. O VERVIEW Tic Tac Toe How it should work Using the supplied methods What you need to do How we will test your code.
Integer Tic Tac Toe Let’s Begin Rules: 1.Erase all x’s and o’s from the previous game before you begin. 2.Decide which player will be x’s and which will.
Stacks CS 3358 – Data Structures. What is a stack? It is an ordered group of homogeneous items of elements. Elements are added to and removed from the.
Index Values NATIONAL STATISTICAL COORDINATION BOARD.
Basic Programming II. Outline Standard Deviation Function (SD) Complex Guessing Game.
1 Introduction to Computing Lecture 15 Arrays (Part 1) Dr. Bekir KARLIK Yasar University Department of Computer Engineering
Representing a Game Board In a game, we represent the action taking place using an array – In a very simple game, we use individual variables to represent.
Introduction to Application Programming IST 256 Application Programming for Information Systems Xiaozhong Liu
Arrays Write a program that first reads in 20 integers and then asks the user whether they want to display all the even integers or all the odd integers.
1 CSE1301 Computer Programming Lecture 19 Arrays (Part 2)
CMPUT 101 Lab #6 October 29, :00 – 17:00. Array in C/C++ Array is a structure type variable. One dimension of array int: int num[3]; There are.
1 CSE1301 Computer Programming Lecture 18 Arrays (Part 1)
Click Here to Begin the Game CHOICE 1CHOICE 2CHOICE 3 CHOICE CHOICE
Artificial Intelligence By John Debovis & Keith Bright.
D I F Lesson 12: Futurism.
Insert Category 1 $100 $200 $300 $400 $500 $ 500$500 Insert Category 2 Insert Category 3 Insert Category 4 Insert Category 5.
While Loops Indefinite Iteration. Last lesson we looked at definite loops using the ‘For’ statement. The while loop keeps going while some condition is.
Computer Programming for Engineers. Outline Tic-Tac-Toe (O-X Game) Drawing 3x3 grid Receiving the inputs Checking for a winner Taking turns between.
TIC TAC TOE. import java.util.Scanner; import java.util.Random; public class PlayTTT{ public static void main(String[]args){ Scanner reader = new Scanner(System.in);
Artificial Intelligence and Robotics Ross Clark Trevor Sheehan.
WEEK 6 Class Activities Lecturer’s slides.
How to design and code functions Chapter 4 (ctd).
CS 100Lecture 191 CS100J Lecture 19 n Previous Lecture –Two dimensional arrays. –Reasonable size problem (a past assignment). –Stepwise refinement. –Use.
Tic tac toe specifications Maaike Gerritsen Ingmar van der Steen Bas Geertsema Brian Vermeer.
Integer Tic Tac Toe Let’s Begin Rules: 1.Erase all x’s and o’s from the previous game before you begin. 2.Decide which player will be x’s and which will.
Discussion 7. Make up tutorial Official make up slot: Friday 27 Oct (4-6) (by majority of the people that send me the ) For those who cannot make.
Strings program. C Program to Check if a given String is Palindrome #include void main() { char string[25], reverse_string[25] = {'\0'}; int i, length.
CS Class 15 Today  More practice with arrays  Introduction to Multi-dimensional arrays Announcements  Programming project #4 due 10/23 by midnight.
1 Data Structures CSCI 132, Spring 2014 Lecture 18 Recursion and Look-Ahead.
Chomp. How is the game played Human player goes first choose a square, all to the right and down are “eaten” computer takes a turn whoever is forced to.
Print Row Function void PrintRow(float x[ ][4],int i) { int j; for(j=0;j
Programming for Art: Arrays – 2D ART 315 Dr. J. R. Parker Art/Digital Media Lab Lec 16 Fall 2010.
When constructing a two-dimensional array, specify how many rows and columns are needed: final int ROWS = 3; final int COLUMNS = 3; String[][] board =
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.
Engineering Problem#1 Engr201 Computer Programming for Engineers Faculty of Engineering Chiang Mai University 1.
Lecture 5 of Computer Science II
Chapter 8 – Arrays and Array Lists
Programming application CC213
Intro to Computer Science II
A fun reading Comprehension Game
Tic-Tac-Throw! How to Play: X or O
Next Level Tic-Tac-Toe
Arrays 1. One dimensional arrays - Review 2. Using arrays
multi-dimensional arrays
O X X O O X X O X O X O O X O X O X Tic Tac Toe Graphical
Tic – Tac – Toe ! Choose a square by clicking on “box #”
IPad Center.
Multi-dimensional Array
Functions in C.
Board: Objects, Arrays and Pedagogy
DIVIDING FRACTIONS TIC-TAC-TOE
Multidimensional Arrays
Announcements & review

Tic Tac Toe application
Tic – Tac – Toe ! Choose a square by clicking on “box #”
EECE.2160 ECE Application Programming
EECE.2160 ECE Application Programming
Tic-Tac-Toe Game Engine
Data Structures & Programming
Presentation transcript:

Artificial Intelligence and Robotics By Keith Bright & John DeBovis

Progress Switched from ELIZA chat program to Tic Tac Toe program Switched from ELIZA chat program to Tic Tac Toe program Spent time developing Tic Tac Toe program Spent time developing Tic Tac Toe program Two dimensional arrayTwo dimensional array Human vs. ComputerHuman vs. Computer Use test to decide what is the smartest decision for the computer to make—becoming an example of weak intelligenceUse test to decide what is the smartest decision for the computer to make—becoming an example of weak intelligence

Main #define ROW 3 #define COL 3 #define SPACE ‘ ' void get_computer_move(char tic[][COL]); void get_player_move(char tic[][COL]); void disp_tic(char tic[][COL]); int check(char tic[][COL]); int main(){ int main(){ char tic[ROW][COL]={' '}; char tic[ROW][COL]={' '}; char done= SPACE; char done= SPACE; while(done==SPACE){ while(done==SPACE){ disp_tic(tic); disp_tic(tic); get_player_move(tic); get_player_move(tic); done=check(tic); done=check(tic); get_computer_move(tic); get_computer_move(tic); done=check(tic); done=check(tic); }if(done=='X'){ printf("You Win!.\n"); printf("You Win!.\n"); } else{ else{ printf("I Won!!!!!\n"); printf("I Won!!!!!\n");}disp_tic(tic);}

Get Players Move /*Input Players move*/ void get_player_move(char tic[ROW][COL]{ int i=0,j=0; printf("Enter coordinates for your X, with the index starting at 0: "); scanf("%d %d", &i,&j; if(tic[i][j]!=SPACE){ printf("Invalid move, try again. \n"); get_player_move(tic);}else{tic[i][j]='X';}}

Get Computer Move /*Get the computer's move*/ void get_computer_move(char tic[][COL]); Problems Problems We had trouble figuring out where to insert the computer’s next moveWe had trouble figuring out where to insert the computer’s next move In order to do so, the computer must test to see where the smartest move would beIn order to do so, the computer must test to see where the smartest move would be

Display Game /*Display the game board*/ void disp_tic(char tic[][COL]){ int t; for(t=0; t<3;t++){ printf("%c | %c | %c", tic[t][0], tic[t][1], tic[t][2]); if(t!=2){printf("\n---|---|---\n");}}printf("/n");}

Test for Winner /*See if there is a winner*/ int check(char tic[][COL]){ int j; char answer = SPACE; int k=0; int i=2; for(j=0;j<3 && answer==SPACE;j++){ if(tic[j][0]==tic[j][1] && tic[j][1]==tic[j][2]){ answer=tic[j][0]; return (answer); }} for(j=0; j<3 && answer==SPACE;j++){ if(tic[0][j]==tic[1][j] && tic[1][j]==tic[2][j]){ answer=tic[0][j]; return answer; }}

Test for Winner (cont.) /*test diagonal*/ if(tic[k][k]==tic[k+1][k+1] && tic[k+1][k+1]==tic[k+2][k+2]){ return (tic[j][j]); } else if(tic[k][i]==tic[k+1][i-1] && tic[k+1][i-1]==tic[i][k]){ return (tic[i][j]); } return SPACE; }