[SOLVED] 161-INTRO-TO-PROGRAMMING-I -Project-9

45.00 $

Programming resource
Digital learning resource
Practical programming resource
Suitable for guided study and reference
Tutor guidance available when needed

Description

5/5 - (1 vote)

Your AddThreeGame class must include the following methods: * An init method that takes no parameters and initializes all data members. * A get method named get_current_state, which returns the current state. * A method named make_move that takes two parameters – a string designating the player making the move, either “first” or “second”, and an integer giving their number choice (in that order). If it is not that player’s turn, or if the integer is not in the correct range, or if that integer has already been chosen, or if the game has already been won or drawn, make_move should return False. You can assume the user chooses an integer, but if it’s outside the range 1-9, make_move should return False. Otherwise, it should record the move, update the current state if the move caused a win or draw, update which player’s turn it is, and return True.
For example, your class could be used as follows: game = AddThreeGame() game.make_move(“first”, 2) game.make_move(“second”, 5) result = game.make_move(“first”, 7) state = game.get_current_state()
Your file must be named: AddThreeGame.py

Resource details

Understand the Task Before You Use the Resource

Review the requirements, identify the programming concepts involved, study the implementation and test your understanding with your own examples and modifications.