bg = Image.load("./game/game.png")
random = math.random(3)

while true do
  pad = Controls.read()

  screen:blit(0,0,bg,true)
  screen.waitVblankStart()
  screen:flip()

  if pad:square() and (random==3)then
    dofile("./game/winr.lua")
  elseif pad:square() and (random==1)then
    dofile("./game/drawr.lua")
  elseif pad:square() and (random==2)then
    dofile("./game/loser.lua")
  end

  if pad:cross() and (random==1)then
    dofile("./game/winp1.lua")
  elseif pad:cross() and (random==2)then
    dofile("./game/drawp.lua")
  elseif pad:cross() and (random==3)then
    dofile("./game/losep.lua")
  end

  if pad:triangle() and (random==2)then
    dofile("./game/wins.lua")
  elseif pad:triangle() and (random==1)then
    dofile("./game/loses.lua")
  elseif pad:triangle() and (random==3)then
    dofile("./game/draws.lua")
  end

  if pad:circle()then
    dofile("./script.lua")
  end
end