Artificial Intelligence

hi everyone

i build a game for my First game it is 2 player football. I have big problem here how i can tell the computer play with people?

computer is other side and i said him this way:

local function objPlay(event)
  local obj = event.target
  local sensorObj = event.other.name or " "
  if event.phase == “began” then
 
      
        if sensorObj == “sensor3” then
            ball.state = “coming”
            print(ball.state)
        – local back

            
         local function reset(obj)
             – obj.x=150
           transition.to ( cpuPlayer , {time=500, x=bar3.x , y=bar3.y} )
          end

          function back(event)
          transition.to(cpuPlayer ,{time=500 , x=150,y=10,onComplete=reset})

          end
           

            transition.to ( cpuPlayer , {time=500, x=bar3.x , y=bar3.y,onComplete=back} )

–[[i want Artificial Intelligence]]–

but didn’t work i build all of the game just i stay on that part and if we can fix it i will Release the game.
Thank you so much.