HuePig 0 Light Poster

Hi,

I'm trying to build a simple turn-based game. Its working if I don't have any AI in the game and just multiple human players.
My UI is just a couple of buttons and some text that gets updated, heres how I structured the whole thing without any AI players:

  • Player Click on a button ==> on_click(){game.play(int); update();}

Its that simple, Game contains everything about the game and update() just uses the inforamation from the game object to update the UI texts. The turns are handled inside the game class (its the same case if I add an AI).

How can I call game.play() and update() when its the AI's turn?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.