I just need a bit of help starting a code.

3 views (last 30 days)
I've been given a task to write a code which will generate the board game 'Reversi'. I've been asked to make it allow for a graphical user interface and an artificial intelligence interface, where a human and an AI player, two human players or two AI players can play the game. I've also been told to make the AI player hard to beat, yet not impossible to beat.
All in all, i'm just writing to see if anyone could give me some ideas on how to start the code and structure the code correctly.
it'd be greatly appreciated if someone could help me with this task.

Accepted Answer

Youssef  Khmou
Youssef Khmou on 14 Apr 2013
Edited: Youssef Khmou on 14 Apr 2013
hi, Micheal,i start with the board :
a=[0 1;1 0];
P=repmat(a,[4 4]); % it contains 64 cells,
imagesc(P), colormap gray
Now i think you need to set two numbers H A, that each time ( each iteration) H and A change the place with new coordinates (x+1,y+1) but with saving the past state , like you have logical matrix M(64,64) that contains zeros where its free to move and ones otherwise ,and each iteration M is updated .
the RAND function that you use must be like
mod(round(10*(rand(2,1))),8)
As it generates (x,y) such that 1<=x,y<=8
"Making the robot difficult to beat", this condition seems difficult,but i believe its directly related to the Parameters of the Probability Density function {mean,variance, kurtosis, skewness} like the move of the robot is based on pdf's parameters but i must tell you that some strategies do exist on problems like this based on Markov Chains.
during your simulation try to adjust the function 'text' to show where the location of the player/robot is for example you are in the cell (4,5) and the robot is the cell (7,7) .
imagesc(P), colormap gray, hold on
text(4,5,'YOU');
text(7,7,'ROBOT');
I hope its good start

More Answers (1)

Image Analyst
Image Analyst on 14 Apr 2013
Making circles may come in useful. See the code in the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_a_circle.3F

Categories

Find more on Board games in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!