So I was thinking about improving the Pong game I made, and I noticed that the game mode that uses AI is a little slower than the endless score mode. I was wondering if anyone had ideas on how to make an AI that isn't unbeatable, but also isn't super dumb. Here is the code of the AI in my Pong game:
randInt(1,100)→M
If M≤55
Then
If H=5
Then
If (D+5)>J and J≠140
Then
Line(240,I,240,J,0)
I+3H→I
J+3H→J
Line(240,I,240,J,RED)
Else
Line(240,I,240,J,RED)
End
End
If H=5
Then
If (D-5)<I and I≠20
Then
Line(240,I,240,J,0)
I+3H→I
J+3H→J
Line(240,I,240,J,RED)
Else
Line(240,I,240,J,RED)
End
End
Else
Line(240,I,240,J,RED)
End
I think the biggest thing that slows the game down is the random integer command, but I haven't thought of an alternative to my method.