(sos!) Help me fix some problem for my Sorting (name and score)

Why won't you save Player's name in a list with score 0 when game starts and then update his score in table ? I believe the best solution is to save both names and score in a table and then sort table as already was mentioned in (sos!) Help me fix some problem for my Sorting (name and score) - #47 by ABG. @ABG was kind to provide you an example with TinyWebDB

1 Like

can i just igonre all the part of webreturndict?

wait... im so lost right now. can I ask which page I should start actually :sob: :sob: :sob: :sob: :sob: :sob:

Where did THAT come from, using a dictionary?
Those can't be sorted.

Also, is it a firm requirement that you code your own sort instead of calling the built-in AI2 list sort blocks?

Storing the names and scores in two separate Cloud tags is making your life harder, because that requires you to coordinate TWO cloud reads.

You only have one.

You can store an entire table under one tag.

You can not escape learning tables.

i just saw that from here

our lecturer wants us to apply sorting method(can be select, bubble, insert) (so, i guess cant use built-in..

so, i have to move my playername screen to gamescreen?

The only part of that tinywebDB post you need is the updated scores procedure.

Ignore the rest of the post because it's for a different problem.

You can't use start values in Screen 1.

You should close screens as often as you open them.

If you need to pass data across screens, put it in TinyDB.

The requirements don't say code your own sort, just apply a sort.

The smart money uses a built-in block where possible, instead of reinventing the wheel.

Your instructor might not even know the sort blocks existed, since they are new.

The best coders use the fewest blocks.

It's always wise
to modularize.

If in doubt
rip it out.

i just change the playername to the same screen , also this time I going to let them type name only if their score is on the 5 top score list. Can I ask where & how can I put the if then statement to check whether the score is on top 5 or not, if yes, then will open the "playerName" screen to ask the user name and store it to the clouddb


i havent put the "playerName" screen visible bcz I dont know how to check whether their final score match with the top5 score in list

That would need to be after you finish a game and have a score.

Testing against the latest high score list would require having a copy of the high score list available locally.

You could save YOUR highest score in TinyDB, under tag MyHighestScore, and test against that before deciding to update it and start the process of updating the cloud high score table.
Let that process ask the cloud for the current high score table, and let it do the append,sort, trim to length, and replace operation.

1 Like

but I thought u said use one database is more easier than using 2


You keep adding requirements, so more work is needed.
Multiple screens can't talk to each other.
TinyDB is easier than CloudDB for local storage, and you should be able to distinguish between the two and know where to use one and where to use the other.

what if now they are in same screen


All username and score information must be available before attempting to update it.

The screen Initialize event is a good place to ask for the latest high score list.
It should arrive before the user has a chance to enter his name and confirm.

do u have some kind of similar video for this, I'm lost (sorry I being so foolish ). Especially, I never learn the table.