Slider Maze by OSKAR

Hi Arduino fans,

Slider Maze is an electro-mechanical puzzle. An Arduino programmable controller controls a motor fader, similar to the Four Bit Maze. The player and the computer take turns. Every time the player moves the slider to one position, the computer decides whether it can stay there or it moves the slider to another position. The lights indicate what is happening.

  • Green: The player can move.
  • Green+yellow: The player is moving.
  • Yellow: The player has just finished his move.
  • Red: The computer makes a move.

An electronic touch detector measures whether the player is touching the knob of the slider.

The object is to get the slider from 0 to 10. There are ten challenges, set by the counter switch. Even though each challenge has only 11 states, some challenges can be extremely hard or confusing to solve.

Here are some of the challenge concepts.

  • All OK: Any move is OK, just slide immediately to 10.
  • Plus one: If you slide to n, the computer moves to n+1(mod 11).
  • Mirror: If you slide to n, the computer moves to 11-n.
  • Belgian maze: From each state, you can only move to the next or previous state. Surprisingly, people can get lost in a Belgian maze.
  • Wrong move reset: Do all state in the right order. At any wrong move, the computer resets and you have to start all over.
  • Binary search: From every state, you can move to two other.
  • Extreme: Too hard to explain (or solve).

Watch the YouTube video below.
Buy the puzzle from mer directly.
Read more at the Non-Twisty Puzzles Forum.
Check out the photos below.

Enjoy!

Oskar

wel done !

I really need to get some of those motorized faders...

Good work as usual!

Great work! :slight_smile:
Is the source code public?

Hi Oskar!

This puzzle is realy great and I fell in love with this game! My question is: How do you recognize the touch of the slider? Or is there an other logic to know when your move is over?

Thanks for sharing this project with us!
Robert

simonem:
Great work! :slight_smile: Is the source code public?

Hi Simonem,

I would be happy to share the code with you. It is pretty useless by itself. It is essentially a huge matrix that provides an output state from an input state and a user action.

Oskar

flyingangel:
This puzzle is realy great ... How do you recognize the touch of the slider?

Hi Robert,

Thank you for the complement. As for your question, this is the code of the touch detector.

// Touch detector
/*
This detector works by using capacitive detection, sensing how quickly a voltage change acros a 1 MOhm resistor
is followed by a voltage change at the capacitor
*/
void updateTouchState(){
  digitalWrite(PULSEPIN,HIGH);                   // Set PULSEPIN HIGH
  i=10;                                          //
  while(i>0&&analogRead(TOUCHPIN)<=1020){i--;}   // Give TOUCHPIN some time to get HIGH as well
  if(analogRead(TOUCHPIN)>1020){                 // Only detect touches when properly reset (HIGH)
    digitalWrite(PULSEPIN,LOW);                  // Set pulse low
    out=(analogRead(TOUCHPIN));                  // Immediately measure how the voltage at TOUTCHPIN decreases
    digitalWrite(PULSEPIN,HIGH);                 // And set PULSEPIN HIGH again
    if(out>upperTouchThreshold){
       touch=true;
    }
    else if (out<lowerTouchThreshold){    // If no-touch is detected
       touch=false;
    }
  }
  return;
}

Oskar

moderator: replaced quote with code tags

OskarPuzzle:
... this is the code of the touch detector...

Hi Oskar!

Thanks a lot! I'll try this on a breadboard and I hope that I can realize a similar project in the (near) future!

Thanks,
Robert

Hi Oskar!

Sorry, but I have one more question: is the sequence - for example the belgian maze - always the same or is it generated by random each time you start this level? And second: The two posible moves are the last one (correct move) and the next one (incorrect move). What is when your move is the incorrect one? always back to "0" or one step back?

I try to understand the rule for the belgian maze and made a matrix for a fix sequence. My next step will be a routine to generate this matrix by software on the arduino after generating a sequence by random.

Thanks a lot,
robert

Hi Robert,

My software design is as simple as can be. One big static matrix. Nothing random or generated.

Oskar

Hi Oskar!

I tried to write some code to generate a "belgian maze"-matrix randomly:

int sequence[11];
int field[11][11];
  

void setup() {
  
  Serial.begin(9600);
  
}


void loop() {

  generateSequence();
  belgianMaze();

  printAll();
  
  delay(10000);
  
}


// *****************************************
// generate sequence (0, random order 1-9, 10)
// *****************************************
void generateSequence() {
 
  int i, j, temp;
 
  // generate sorted sequence from 0-10
  for (i = 0; i <= 10; i++) {    
    sequence[i] = i;
  }

  // random permutation of position 1-9 (algorithm by Ronald Fisher and Frank Yates)  
  randomSeed(millis());         // really random
  for (i = 9; i>1; i--) {
    j = random(1,i+1);
    temp = sequence[i];         // swap sequence[i] with sequence[j]
    sequence[i] = sequence[j];
    sequence[j] = temp;
  }
}


// *****************************************
// generate Matrix for "Belgian Maze"
// *****************************************
void belgianMaze() {

  // fill all 121 fields with "11" (11 = no "click")
  for (int i = 0; i <=10; i++) {
    for (int j = 0; j <=10; j++) {
      field[i][j] = 11;
    }
  }

  // generate first row
  field[0][0] = 0;
  field[0][sequence[1]] = sequence[1];     // first goal

  for (int i = 1; i <= 9; i++) {
    field[sequence[i]][sequence[i-1]] = sequence[i+1];  // last field = next goal (forward in maze)
    field[sequence[i]][sequence[i+1]] = sequence[i-1];  // next field = last goal (step back)
    field[sequence[i]][sequence[i]] = sequence[i];      // current field
  }
}


// *****************************************
// printout on serial
// *****************************************
void printAll() {

  // printout sequence
  for (int i = 0; i <= 10; i++) {    // 
    Serial.print(sequence[i]);
    Serial.print(" ");
  }
  Serial.println();
  Serial.println("------------------");

  // printout matrix
  for (int i = 0; i <= 10; i++) {
    for (int j = 0; j <= 10; j++) {
      Serial.print(field[i][j]);
      Serial.print(" ");
    }
    Serial.println();
  }
  Serial.println("++++++++++++++++++");
}

I hope you will like this. I think it is possible, to generate most of your mazes with a random function. So your maze would be more challenging.

Robert