Probléme de mélange dans un pulzze

It has general ideas of grabbing the list of Media file names and filtering the list to match whatever you need at the moment. It can filter for '.jpg' or '.png' instead of '.mp3' just by changing a text block.

You have machinery available to you to reduce the drudgery of developing an app.
It's worth a moment to learn how to use it.

Here is the world's easiest shuffle value procedure:

I downloaded images of your shuffle code, for the board ...

Is this a memory matching game?
We have samples of those.

I see you loading global list Grille from one of these pre-loaded lists of image files:





(A good coder could have generated those file names in a loop at run time using a counter and text JOIN blocks, given the name cafe/eau/tracteur/....)

None of these have an item 'vide' in them.

But your shuffle code looks for 'vide in them.

Why?

image

What's the game play here?

Is this a slide 15 game, with a missing block?

How do the 4 images above the 16 buttons relate to each other?

le gameplay : je clique sur une image qui se trouve en haut, cette image apparait dans la grande grille (4x4) , je clique sur le bouton "mélanger" et les cases de l'image se mélange, la première case doit rester libre pour pouvoir déplacer les cases. Quand l'image est mélanger , on doit reconstituer l'image de départ en déplaçant les cases (le déplacement des cases se fait en cliquant sur le bouton de la case que l'on veut déplacer ).
Est ce que ma description est plus précise ?

So the 16 images get assigned randomly into the 16 buttons, but all of them except 1 are obscured by a foreground color at any time.

The image distribution remains unchanged as you click the 16 buttons, only the color exposure changes button by button.

The game remembers which of the 4 target images you are seeking, and watches to see if you expose it?

J'ai coupé l'image du puzzle en 16 morceaux images (et la première et vide) , au début mon puzzle s'affiche avec l'image que l'on sélectionne , il faut cliquer sur le bouton "mélanger" pour mélanger les cases.
Oui le jeux se souvient de laquelle des 4 images cibles vous recherchez

Instead of doing this manually and uploading 16 images, you could do this programmatically using the image extension and its CreateChunks method

Taifun

This gets tricky.

This is like the slider 15 puzzle,Fifteen Puzzle Game a 4 by 4 grid of numbered tiles 1-15 and a hole, that you have to get into the proper order by sliding one at a time into the adjacent hole.

Shuffling such a puzzle only works half the time, because half of the shuffle results would be impossible to solve without lifting two pieces from the frame and swapping them instead of sliding them.

https://www.google.com/search?q=impossible+sliding+15+puzzle

Please confirm, this is a sliding puzzle?

Also, if it is, where does the empty slot go,

  • lower right, or
  • upper left

when the puzzle is solved?

Here is some code to find out if it is solvable or not... as App Inventor is a bit slow in doing calculations this might make sense to do in an extension or using Javascript...

Taifun
.

I tried running your app as is, in the Companion.

Initially, an error message popped up about being unable to find one of your very long named images

image

(I forget which one.)

Since they look unessential to the game play, I figured they were background images, and I set the Screen1 background image to none.

That cleared the error for me.

I was subsequently able to bring up your 4 images and shuffle them

Sample run:

Sample run

I noticed during initial game play that I got false positive success messages, perhaps from a Clock Timer?

But the shuffle you had looked okay to me.

P.S. Your images are adorable.

I found where you check for puzzle completion.


You are using the green = block to check if two lists are equal.

I double checked the tool tip for the green = to see what it said about comparing two lists.
It didn't mention anything, only text and numbers.

So I will try comparing the CSV (Comma Separated Values) texts of those two lists instead.

The new blocks:

and the sample run, including shuffle ...
Sample run 2
(I didn't bother trying to complete this one.)

It cleared up the messages during the shuffle.

So, the only thing I ended up touching in your app was the list comparison test, where I switched it to comparing the text CSV rows of the two lists.

My blocks in the prior post are draggable.

Oui effectivement, j'avais un message qui apparaissait , merci . (On comprend mieux le jeu quand on le teste, c'est pas évident à expliquer) .
C'est bizarre car pour moi , Quand je mélange n'importe quel premier puzzle que je choisi ça fonctionne et quand je choisi un prochain puzzle il ne se mélange plus. avez vous essayé de choisir d'autres puzzles et de mélanger ?
Merci Taifun pour vos suggestions.

Je viens de m'apercevoir que quand je choisis un puzzle, je le mélange et je ne joue pas , ensuite je choisis un autre puzzle, je le mélange et bien là il ne se mélange pas !!! par contre quand je joue au premier puzzle (je le fini) et que je choisis un autre puzzle le bouton mélanger fonctionne, je ne comprends plus rien!!!

I found an inconsistency in the way you represent the neighbors list of a cell.

You generate a fixed length = 4 list of neighboring cells, with blank for impossible cells.
But you never check for blank when doing randomization as a series of interchanges around the void.

Your old procedure:


My replacement:

You also need


to report errors.

I see that you randomize the puzzle by applying pair switches around the item in global variable Grille that holds 'void' instead of an image file name.

That insures there is no worry of generating an impossible puzzle.

I notice there are sequences of actions that can result in there being two empty cells in a shuffle.

This tutorial made in 2015 shuffles a grid of 9 images.

1 Like

I got the puzzle working, and made it expandable for more puzzles without changing any blocks.


TAQUIN.aia (1.2 MB)

New puzzle files in the Media folder should follow the naming conventions of the earlier puzzles, and the new image components for puzzle selection should have picture files following the same naming convention.

A lot of the problems were caused by duplication of code, and lack of separation of functions.

Some global variables needed to be eliminated, to lower the cognitive load of maintaining them.

Some value functions were added to replace them.

je n'avais pas vu toutes ces erreurs, merci pour votre aide et pour le tutoriel.
Je vais regarder tout ça tranquillement