Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unexpected behaviour when combining multiple pieces #1

Open
LucaTedeschini opened this issue Oct 26, 2023 · 1 comment
Open

unexpected behaviour when combining multiple pieces #1

LucaTedeschini opened this issue Oct 26, 2023 · 1 comment

Comments

@LucaTedeschini
Copy link

LucaTedeschini commented Oct 26, 2023

I don't know if it is intended, and I don't know if the AI is made based on this assumption so I haven't changed anything, but the game sum up multiple pieces with one slide, while the android app doesn't, it needs multiple swipe (and between slides pieces get added). For example

0 0 0 0
2 8 4 4
0 0 0 0
0 0 0 0

If the input choosen is "left", the program will update the board this way

0 0 0 0
2 16 0 0
0 0 0 0
0 0 0 0

while on the app it updates to

0 0 0 0
2 8 8 0
0 0 0 0
0 0 0 0

with another piece added in a random position. My solution is to reset the program and input the new board position, so the AI can take in consideration the new added piece. Is this intended? Can i change this behaviour without interfering with the AI logic process? Maybe a flag could be added to choose which behaviour is needed.

Thanks, and btw really cool implementation

@AnasImloul
Copy link
Owner

That's a valid observation, and I appreciate your detailed explanation of the difference in behavior between the program and the Android app. The distinction you've pointed out is important and relates to how merging is handled during a single move.

In the program, the logic assumes that multiple merges can occur in a single line or column in each move. This results in the merging of adjacent tiles, and as a consequence, the board looks different from the Android app after a left swipe.

In the Android app, it appears that the game only allows for a single merge per move, with pieces being added in between slides. This means that when you swipe left, the app combines only adjacent tiles in a single merge, and any new pieces are added separately in random positions.

Your suggestion of adding a flag to choose between these two behaviors is a good idea. It could provide more flexibility to users who prefer one merging style over the other. The great thing is that I implemented the AI in such a way that it doesn't concern itself with the specific details of the move, but rather focuses on changes in the state of the grid, such as the number of merged slots after the move and the score of the move (the sum of scores of individually merged tiles).

Once again, thank you for bringing this to our attention, and I genuinely appreciate your feedback on our implementation. It's been a while since I worked on this project, but I have some free time this weekend, and I will take your comments into consideration to refine it.

Thank you again for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants