7th Guest Germ Game

by

 

The microscope game from 7th guest with simple 'AI'.

Infection
function Infection
clc
clear all

tic
board=zeros(7,7);
board(1,1)=1;board(7,7)=1;
board(1,7)=-1;board(7,1)=-1;

turn=1;
player1='manual';
player2='AI3';

performedmoves=0;
%while ~isempty(find(board==0, 1)) && ~isempty(find(board==1, 1)) && ~isempty(find(board==-1, 1))
while size(availablemoves(board,turn),1)~=0
    makeboard(board);
    
    if zetpossible(board,turn)
        
        if turn==1
            [x1,y1,x2,y2]=guestzet(board,turn,player1);
            [board,test,c]=guestzetdoen(board,x1,y1,x2,y2,'turn',player1); %'turn'
        else
            [x1,y1,x2,y2]=guestzet(board,turn,player2);
            [board,test,c]=guestzetdoen(board,x1,y1,x2,y2,'turn',player2); %'turn'
        end
        
       
         makeboard(board)
         if c>3
             load('C:\My Documents\MATLAB\infection\curses.mat');
             wavplay(cursessound,22050);
         end
         
    end
    makeboard(board)
    turn=turn*-1;
    performedmoves=performedmoves+1;
end
winner=iswinner(board);
disp('Winner:');
if winner==1
    disp('Blue');
    load('C:\My Documents\MATLAB\infection\yesno.mat');
    wavplay(yesnosound,22050);
else
    load('C:\My Documents\MATLAB\infection\lostsound.mat');
    wavplay(lostsound,22050);
    disp('Green')
end
toc

Contact us