7 kyu
Tetris Series #1 — Scoring System
983 of 1,929Etoneja
Loading description...
Fundamentals
Games
Algorithms
Arrays
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Cool kata, but one thing I can't get is how the random tests are suppose to work?
My solution passes all the basic tests, but random tests all return "Cannot read properties of undefined",
when I copy the input from the random test in VScode for example though it works fine and returns the score?
Your score array contains only up to level 7.
It's 8, but I've seen where the problem is
"For level n" <-- this tiny bit..
Terrible description. The process of moving to a new level is not described; I had to try all the options to find the right one. Wasted my time
"The game starts at level 0. The level increases every ten lines you clear."
It's pretty self explanatory..
Nice kata, thanks for author for putting this up.
Go translation
D translation
Rust translation
Good one! Thanks
Pretty decent for 7.
Rewrote python tests with new framework. Please, review and close issue if everything fine.
Looks good.
On a side note: can you add the failure message for all assertions in random tests ?
Also, use
repr(arr)
I'll close the issue anyhow, thanks!
Enabled in this fork
Nice kata, perfect example on how to build an algorithm step-by-step.
Thank you! Very enjoyable kata.
Thank you!
It was both pleased to read it and ashamed that I had not published new katas for so long. Someday they will be, I believe in it.
I realy liked this kata, I learned a lot whith. Thank to the author :)
Thank you, warrior!
I can recommend also trying something from this collection - there are some entertaining and not hard katas that I liked.
This comment has been hidden.
This comment has been hidden.
not an issue, use the
question
tag to ask for helpstupid description in javascript - dislike this kata. IAM ANGRY Mistakes in example - getScore([4, 2, 2, 3, 3, 4, 2]); // returns 4700 its return 4900 WTF
Sorry you didn't like the kata. I know this feeling.
Correct answer for
[4, 2, 2, 3, 3, 4, 2]
4900.I fixed the example in the description and describe steps with more details.
I hope it has become a little more clear.
bad thing that approved kata had mistakes
Hi,
In this type of case, there is no need to get angry (or at least to express it ;) ). Just raise an issue, with all the related information (language, faulty test with input/output, explaining why/what is wrong), and the author or someone else will correct the kata if the problem can be confirmed.
cheers.
Ruby translation
Approved
Haskell translation
I will not tire of saying "thank you" for the contribution you make to the site.
Good job, guys!
i am running the random tests while attempting to submit my code and it seems that the math in the tests is not correct. I am testing Python solution. For example i have got the following message after running my code: Failed when arr = [1, 4, 1, 4, 1, 4, 1, 1, 2, 0, 0, 4, 2, 3, 3, 3, 3, 4, 0, 0, 1, 2, 1, 0, 1, 2]: 18180 should equal 18620 well. let's see: level 0: 1,4,1,4: 40+1200+40+1200 = 2480 level 1: 1,4,1,1,2,0,0,4: 80 + 2400+80+80+200+0+0+2400 = 5240 level 2: 2,3,3,3 : 300+900+900+900 = 3000 level 3: 3,4,0,0,1,2: 1200 + 4800 + 0 + 0 + 160+400 = 6560 level 4: 1,0,1,2: 200+ 0 + 200 +500 = 900 score = 2480+5240+3000+6560+900 = 18180
some of the tests are passed and some of them are incorrect as the one above. could you please check if I am missing something or the test case is really incorrect?
That.
Not a kata issue.
Follow the example and find the mistake by yourself. Write, please, if it doesn’t help.
for input
[2, 0, 2, 4, 4, 0, 4, 3, 0, 0, 0, 1, 0, 0, 2, 4, 0, 1, 3, 4, 2, 0, 2, 1, 4, 2, 0, 0, 1, 3, 1, 4, 4]
thank you all very much! got it.
I see that the problem appears after a level is increased, but I don't know the reason. In my version I have a sum var, which is the sum of the values in the array (I'm adding new values in the for cycle where I compute the points). If the sum is greater than or equal to ten, I subtract ten from it and increase the level variable by one.
I don’t see your code, so I can’t say what’s wrong. But if you provide an example, then I can describe it in details.
The most common mistakes:
This comment has been hidden.
Not a kata issue, your code is wrong, use Question label for that. You're handling levels wrong, check again the kata description.
Try to figure it out yourself with an example:
for input
[2, 0, 4, 2, 2, 3, 0, 0, 3, 3]
correct
your
You need to fix a little your calculation.
C translation kumited
If no one checks earlier, then I will try to look at the weekend.
Thank you for your contribution!
Typescript translation and Julia translation
Please, can anyone check translations?
I will try to do it myself when there is free time, but I don’t know these languages at all.
Typescript looks good, approved. I know nothing about julia unfortunately.
Thank you warriors!
This comment has been hidden.
Python ignores it.
In the following code:
the
-> int
just tells thatf()
returns an integer.More information here PEP 3107
It was great solving this! But I think that the description of what happens when you level up with more than exact 10 lines. There is nothing explaining that the remainder should remains, instead of going to zero.
Thank you for your comment!
This should have been a test of mindfulness. But I did not want to embarrass anyone, so I updated the description.
I disagree with the arithmetics in the provided example - total should be 4900 and not 4700
Great eye! Of course you're right. Desciption edited.
Thank you for pointing!
This error is still present in the python sample tests, would you mind updating it there as well (nevermind, seems i had an outdated version)
This error is still present in the javascript sample tests, would you mind updating it there as well (nevermind, seems i had an outdated version)
Why is
0
a possible array element? Clearing 0 lines is absurd."The player doesn't clear any lines" = "number of cleared lines is 0"?
Well, then cases like
[4, 2, 2, 3, 3, 4, 2]
is absurd because in reality it's impossible to happen in any tetris variants (how tall a well do we even talk about here...?).It's, well, confusing to tetris players ;-)
This is 8 kyu kata with pseudo realism. The aim of which is to check basic knowledge of the language and prepare the player for next chapters where he will have to move the blocks, twist and stack them.
You don't get to play Tetris forever in a coin op game. Say you get 3 lives. 0 counts as one life. If zero didn't count as a life, then there would be no way to tell when you failed a level.
Example: Drop a Ruble into the machine and you get 3 lives. Do nothing and the board fills up, and you lose a life, score zero and do not advance to a higher scoring level.
Looks like the kata is inspired by the upcoming CTWC ;-)
You right!
The user can modify the input in JavaScript.
JS tranlation deleted. Sorry, but not my language. Dont think I can handle all issues and suggestions.
Also wanted to delete whole kata, but didn't find any delete button. So it still remains.
No, you don't need to delete the kata. I can write another JS translation.
Thank you, but the current task is not worth it. It does not solve anything new and unique. This was supposed to be the introduction to the series.
Now I have even greater respect for those who fill the site with content - it's a realy hard work!
@Steffan153, thank you for the js-translation! Of course, I approved it. You have a very nice and mature style of writing code - I like it!
JS:
i
is not declared yet)Python: Try out the test framework v2.
It is not.
JS naming convention is camelCase, not snake_case
Fixed. Thank you for your comment!