hi guys :)
i am new in the designing patterns field
so i have a question
i have made dots game(like this) which have two options
a)play against the computer
b)play multi users
so i want to apply the state pattern so i will have two states
a)play against the computer
b)play multi users
right?
and what will be the context i don't know ????see this
and when the click event handler is clicked also
there is a code that is different for the first and second state
such that
if(against computer state)
{
while(against computer.play()||count%2==0)
{
}
}
else if(multiuser state)
{
multi.play()
}
how i made this in a better design pattern way thanks for reading this and please if u have any idea just share it and thanks a lot