Help Calculate Position of stepper

I have a problem ... To randomize two array and do the current position calculation to define new position.
I'm debugging the serial trying to find the problem ...

Any help or suggestion will be very welcome ...

My problem is being to calculate the current position to define the new position ...

The home sensor will be implemented later, so this code is assuming the start position is already in
home when it's powered.

#include "Arduino.h"
#include "Wire.h"
#include <Stepper.h>
#include <SoftwareSerial.h>                     //BIBLIOTECAS

 
int START = 3;
const int stepsPerRevolution = 200;
Stepper myStepper(stepsPerRevolution, 5, 6, 7, 8);
 
int posiatual;
int proximaposi;
int roda;
int RUN;
int GIRA[5] = {4000, 6000, 1000, 2000, 800 } ;
 
 
void setup() {
  // put your setup code here, to run once:
 pinMode(START, INPUT_PULLUP);
  myStepper.setSpeed(60);
   
}
 
void loop() {
 JOGA();
 
 
}
 
void JOGA(){
 
  if (digitalRead(3) == LOW ){
 
    PALTO();
  }
}
 
void PALTO(){
 
unsigned long seed = 0;
for (int i=0; i<32; i++)
{
  seed = seed | ((analogRead(A0) & 0x01) << i);
}
randomSeed(seed);
 
  int  listalto[10] =   {80, 180, 200, 60,40,120,140,160, 20, 100};
 
const size_t n = sizeof(listalto) / sizeof(listalto[0]);
 
for (size_t i = 0; i < n - 1; i++)
{
    size_t j = random(0, n - i);
 
    int posi = listalto[i];
    listalto[i] = listalto[j];
    listalto[j] = posi;
    proximaposi=posi;
}
 
 
   Serial.print("resultado sorteio :");
   Serial.println(proximaposi); // até aqui ok
 
 
 
// Aqui está meu problema
 
 if (proximaposi == posiatual) {                             // se posição  sorteada = posição atual
      Serial.println("posiatual == proximaposi");             // debug
      RUN = random(GIRA[0, 4]);                               // escolhe quantidade de voltas aleatória e para no mesmo lugar
      myStepper.step(RUN);                                    // roda o motor
      Serial.println(RUN);                                    // debug
      proximaposi=posiatual;                                  // informa que apartir de agora o int proxima posi assume o valor já utilizado da posição atual
     
    }
 
   
   if (proximaposi < posiatual  ) {                                   // se posição  sorteada menor posição atual
     RUN = (proximaposi - posiatual) - (stepsPerRevolution) * -1 ;    // calcula posição atual menos posição sorteada transforma o numero em positivo pois quero que sempre rode sentido horário
    Serial.println("posiatual < proximaposi");                        // debug
    myStepper.step(RUN);                                              // roda o motor
    Serial.println(RUN);                                              // debug
    proximaposi=posiatual;                                            // informa que apartir de agora o int proxima posi assume o valor já utilizado da posição atual
     
    }
 
 
   
     if ( proximaposi > posiatual) {                                   // se posição  sorteada menor posição atual
      RUN = proximaposi - posiatual ;                                // calcula posição atual menos posição sorteada transforma o numero em positivo pois quero que sempre rode sentido horário
      Serial.println("posiatual > proximaposi");                       // debug
      myStepper.step(RUN);                                             // roda o motor
      Serial.println(RUN);                                             // debug
      proximaposi=posiatual;                                           // informa que apartir de agora o int proxima posi assume o valor já utilizado da posição atual
     
    }
   
   
   
   
 
     CHECKWIN();
}
 
void CHECKWIN() {
 
  if (proximaposi== 200) {
Serial.println("hj vc limpa a casa");
 
  }
 
if (proximaposi== 180) {
Serial.println("hj a loça é sua");
 
  }
}

As your program instructed the stepper motor how many steps to take it must already know where the motor is. Just keep a count of the total steps.

...R
Stepper Motor Basics
Simple Stepper Code