GNOME Bugzilla – Bug 743119
crash because no colors for boxes with > 2048
Last modified: 2019-01-30 14:22:01 UTC
Tried to concatenate 2048 with 2048.
+ Trace 234565
Thread 1 (Thread 0x7ffff7f98a00 (LWP 13461))
public ColorPalette () { Object (); _palette = new Gee.HashMap<uint,Clutter.Color?> (); _palette.set (2, Clutter.Color.from_string ("#fce94f")); // Butter 1 _palette.set (4, Clutter.Color.from_string ("#8ae234")); // Chameleon 1 _palette.set (8, Clutter.Color.from_string ("#fcaf3e")); // Orange 1 _palette.set (16, Clutter.Color.from_string ("#729fcf")); // Sky blue 1 _palette.set (32, Clutter.Color.from_string ("#ad7fa8")); // Plum 1 _palette.set (64, Clutter.Color.from_string ("#e9b96e")); // Chocolate 1 _palette.set (128, Clutter.Color.from_string ("#ef2929")); // Scarlet red 1 _palette.set (256, Clutter.Color.from_string ("#c4a000")); // Butter 3 _palette.set (512, Clutter.Color.from_string ("#4e9a06")); // Chameleon 3 _palette.set (1024, Clutter.Color.from_string ("#ce5c00")); // Orange 3 _palette.set (2048, Clutter.Color.from_string ("#204a87")); // Sky blue 3 } we don't have colors for more than 2048 We should find algorithm which will generate colors automatically
This link will certainly help: http://stackoverflow.com/questions/43044/algorithm-to-randomly-generate-an-aesthetically-pleasing-color-palette
Created attachment 294818 [details] [review] view: autogenerate colors Reference: https://bugzilla.gnome.org/show_bug.cgi?id=743119 Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
(In reply to comment #3) > Created an attachment (id=294818) [details] [review] > view: autogenerate colors I've not tested it, I'm also not familiar with vala. I will check it after some hours and if there problems - will fix it.
Created attachment 294821 [details] [review] view: autogenerate colors Reference: https://bugzilla.gnome.org/show_bug.cgi?id=743119 Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
Shouldn't colors be consistent between games? I think the best thing will be to follow logic in original 2048 (for browsers).
(In reply to comment #6) > Shouldn't colors be consistent between games? I think the best thing will be to > follow logic in original 2048 (for browsers). I think this should be RFE to switch between original game and unlimited game, because getting 2048 in one block is not interesting.
Created attachment 294897 [details] [review] view: autogenerate colors for boxes > 2048 Reference: https://bugzilla.gnome.org/show_bug.cgi?id=743119 Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
Created attachment 295344 [details] [review] view: autogenerate colors for boxes > 2048 Reference: https://bugzilla.gnome.org/show_bug.cgi?id=743119 Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
Created attachment 295345 [details] [review] view: autogenerate colors for boxes > 2048 Reference: https://bugzilla.gnome.org/show_bug.cgi?id=743119 Signed-off-by: Igor Gnatenko <ignatenko@src.gnome.org>
Sorry for the delay. I think this is due to me not being very good on this game as I hardly ever reach 2048 :) Sorry, I still didn't have the time to apply your patch and test it. Anyway, I think the proposed solution is not ideal. I do not like the idea of having some tiles being colored using pre-defined colors and other tiles being colored using random colors. I think it would be better if we could have a unified solution. On one side, I like the idea of using the Tango palette; however, it does not come with a large amount of colors. So on the other side, I like the idea of using generated random colors, probably always using the same seed (I would appreciate if a value always matches a color). Any idea? I think we could use your algorithm, but only that algorithm, to create colors; we should still make sure that we always use the same seed.
I have added a deterministic algorithm to generate colors for tiles greater than 2048. I will leave the bug report open if someone comes up with a better solution.
Just to toss in my two cents -- I like the fixed palette idea, but I want to also point out that the theoretical limit of the board is 16 variations of tiles (you could never build a 2^17 tile because it would need 17 squares), so we only need 5 more colours to pick with likely no one ever seeing the last two or three of them, anyway.
The colors discussion will probably come again one day, but I’m closing here because the bug is solved for me. Thanks everyone!