Git Product home page Git Product logo

battle_asserts's Introduction

CI status

Setup for development

Contributing

This project exists thanks to all the people who contribute. [Contribute].

Useful commands

  • make check-translations check current tasks translation progress.
  • make check-tags check current tasks tagging progress.
  • make check-generators-and-solutions check current tasks solution and arguments-generator progress.
  • make collect-tags check tags stats, useful to check typo in tags.
  • make collect-disabled check task disabled status.
  • make generate-template create issue template with hints.

Related links

Clojure

Better clojure dev experience


Hexlet Ltd. logo

This repository is created and maintained by the team and the community of Hexlet, an educational project. Read more about Hexlet.

See most active contributors on hexlet-friends.

battle_asserts's People

Contributors

aamanunin avatar aelaa avatar antonkrupin avatar burenkov-anton avatar dfdfdf123 avatar dosbol avatar dstarcev avatar fey avatar igorgakhov avatar ilya-manin avatar imamatory avatar ivanlemeshev avatar krotos avatar makapoxa avatar maratori avatar mikhkonkov avatar mokevnin avatar mrphantomt avatar olegsilakov avatar plugin73 avatar redbrother avatar seth2810 avatar sgmdlt avatar solar05 avatar sun1one avatar v-kolesnikov avatar vtm9 avatar vyorkin avatar yigres avatar zzet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

battle_asserts's Issues

Task: complete_string Шесть битых тестов

Всё хуйня, посоны. Последние шесть тестов - битые. Бот не проходит, да и я тоже. Такие дела.

Receive: "true"Expected: "false"Arguments: "[rgkljviptafmzynodqbuwecsxhr]"

Receive: "true"Expected: "false"Arguments: "[nmstxewhzfgrlykbvdcqpjouian]"

Receive: "true"Expected: "false"Arguments: "[zyxwrbuliqncfjvetohsdkmpagzyx]"

Receive: "true"Expected: "false"Arguments: "[smcgdqkejxfwuyotznlrpbahivsmc]"

Receive: "true"Expected: "false"Arguments: "[rgkljviptafmzynodqbuwecsxhr]"

Receive: "true"Expected: "false"Arguments: "[nwzdtsfaloeqipvkmryhjxbcgunwzd]"

Circle point

Determine whether a given point belongs to a circle.
Tip: to solve the problem, you need to find the hypotenuse.

battle_asserts/src/battle_asserts/issues/ruth_aaron_pairs.clj

Зачем давать на вход 2 числа, если известно, что они в форме n и n+1?

Для теста [0,1]: ни 0, ни 1, говоря строго математически, не являются ни простыми, ни составными числами (правда по разным причинам), поэтому их факторизация на простые множители не определена.

Если исходить из предположения, что факторизация 0 и 1 это пустота (nil) в обоих случаях, то nil == nil и ответ true.
А если из соображения что их факторизация это неопределенность (NULL) (к тому же по разным причинам), то NULL != NULL и ответ false.

Разные языки программирования и интерпретаторы трактуют факторизацию этих чисел по разному и выбирать конкретную реализацию за эталон считаю неправильным. А с точки зрения теоретической математики ответ должен быть false.

Либо добавьте в условие пункт "Если число нельзя разложить на простые множители, то считайте факторизацию этого числа равной 0" , либо уберите вообще этот тест =)

Error in battle problem missing_number_in_progression.clj

It is unclear what to do for a 3-element list, as either difference could be the "typical" difference that you need to fill in for.

Also, for a 2-element list, it does not say that the missing element goes between the two given.

Suggestion: the description on this challenge is actually pretty clear if the test cases are changed to no longer include lists with < 4 elements.

array_interleave incorrect tests

В задаче написано:

"... Arrays can be of different lengths, so if one arrays ends before the other, just continue adding elements from the remaining array"

Пример не соответствует заданию:

"Example: [5,"4",1,"9"] == solution([5,1,3], ["4","9"])"

Тест видимо проверяет такой же вариант:

F
======================================================================
FAIL: test_solution (__main__.TestSolution)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "checker.py", line 15, in test_solution
    self.assertEqual(expected, solution.solution(*arguments), msg)
AssertionError: Lists differ: [4, 2, -4, 2] != [4, 2, -4, 2, -2, 3]

Second list contains 2 additional elements.
First extra element 4:
-2

- [4, 2, -4, 2]
+ [4, 2, -4, 2, -2, 3]
?             +++++++
 : Arguments was: [[4, -4], [2, 2, -2, 3]]

или вот:

F
======================================================================
FAIL: test_solution (__main__.TestSolution)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "checker.py", line 15, in test_solution
    self.assertEqual(expected, solution.solution(*arguments), msg)
AssertionError: Lists differ: [] != [1]

Second list contains 1 additional elements.
First extra element 0:
1

- []
+ [1]
?  +
 : Arguments was: [[], [1]]

Исходный код:

def solution(first_array, second_array):
  result_array = first_array
  for i, item in enumerate(second_array):
    if i < len(first_array):
      result_array.insert(2 * i + 1, item)
    else:
      result_array.append(item)
  return result_array

Cube sum

Calculate array sum from 1 to n.

clock_angle does not have a well-defined answer

Checker assumes that something like this is the correct code:

def solution(h, m):
  ang1 = (360.0 / 12) * h + (360.0 / (12 * 60)) * m
  ang2 = (360.0 / 60) * m
  return abs(ang1 - ang2)

But it isn't. A better solution is:

def solution(h, m):
  ang1 = (360.0 / 12) * h + (360.0 / (12 * 60)) * m
  ang2 = (360.0 / 60) * m
  return min(abs(ang1 - ang2), abs(ang1 + 360 - ang2))

It defines the angle between arrows as the smallest angle among clockwise and counterclockwise directions.

battle_asserts/src/battle_asserts/issues/check_brackets.clj

Задача:

https://files.slack.com/files-pri/T06BMRFQB-F0LUWMMN0/pasted_image_at_2016_02_11_05_21_pm.png

РЕШЕНИЕ:

https://files.slack.com/files-pri/T06BMRFQB-F0LV1SHTK/pasted_image_at_2016_02_11_05_22_pm.png

Проверка в google chrome кода:

https://files.slack.com/files-pri/T06BMRFQB-F0LV2N9QS/pasted_image_at_2016_02_11_05_22_pm.png

Проблема:

В **Example ** solution("( {) } ") = false
в решении задачи solution("( {) } ") = true

Не корректные тесты решения задачи условие в Example.
Хочется, чтобы это были не корректные тесты

Grade calculator

Calculate grade of five student subjects.
If grade average is bigger than 90, final grade is A.
If grade average is bigger than 80, final grade is B.
If grade average is bigger than 70, final grade is C.
If grade average is bigger than 60, final grade is D.
In other cases final grade is F.

Refactoring

  • Выпилить ненужные(?) модули:
    • reader
    • checker
  • Ненужные файлы:
    • issue.example.yml
    • issue\test не конвертированные из старой версии
  • Поправить неймспейсы:
    • выпилить :include-macros true
    • выпилить ненужные require
  • Обновить зависимости
  • Удалить отладочные выводы
  • Написать тесты на core
  • Поправить Readme.md
    • ссылка на travis

String Index Of

Create a function which takes 2 parameters (str1 and str2) and locates the first occurrence of the str2 in the str1 and returns the position, -1 if not found.

Straight line equation

Create a function to describe a line passing through two points with coordinates (x1, x1) and (x2, y2). General view of the equation of the line is y = kx + b. If the line cannot be built, then an empty string should be returned.

Leap year task.

Determine if the year is a leap year. Leap years are all divisible by 4, with the exception of centuries, which are not divisible by 400.

Function max

Implement the calculation function f(x) by the formula:
f(x) = x^2 for -2 <= x <2;
x^2 + 4x + 5 for x >= 2;
4 for x < -2.
Using this function for n given numbers, calculate f(x). Among the calculated values, find the biggest.

Wdmatch

Write a function that takes two string and checks whether it is possible to write the first string with characters from the second string, while respecting the order in which these characters appear in the second string.

"faya" "fgvvfdxcacpolhyghbreda" -> true
"faya" "fgvvfdxcacpolhyghbred" -> false

Celsius to Fahrenheit

Сonvert Celsius temperature to Fahrenheit. Use floor rounding for the result temperature.

Fix levenshtein distance tests

При прохождении тестов, а также при генерации ассертов (lein run) в некоторых случаях процесс зависает на файле src/battle_asserts/issues/levenshtein_distance.clj . Причина скорее всего в геренераторе аргументов.

Stairway to heaven

© Powered by Evgen Zaytsev

Stairway to heaven

Task:

100 dicks randomly spread out of 100 stairs, there can be as many dicks as you want on one step. We gotta go down these stairs.
Every time you step on a stair-step with dicks, the brat ratio increases by the number of dicks.
You can go down one or two steps at a time. Write a function to descend the stairs minimizing the brat ratio.
The function receives an array with the number of dicks on each step and returns the minimum brat index.

JS solution:

export default stairs => {
  const { length } = stairs;
  if (length === 1) return stairs[0];
  if (length === 2) return Math.min(stairs[1], stairs[0]);

  const iter = (i, acc1, acc2) => {
    if (i === length) return Math.min(acc1, acc2);
    const newAcc1 = stairs[i] + Math.min(acc1, acc2);
    return iter(i + 1, newAcc1, acc1);
  };

  return iter(2, stairs[1], stairs[0]);
};

Tests:

import calcBratIndex from "./index";

let result;

beforeEach(() => (result = []));

it("test 1s", () => {
  for (let i = 0; i < 100; i += 1) {
    result.push(1);
  }
  expect(calcBratIndex(result)).toEqual(50);
});

it("test 1s & 0s", () => {
  for (let i = 0; i < 100; i += 1) {
    const el = i % 2 === 0 ? 1 : 0;
    result.push(el);
  }
  expect(calcBratIndex(result)).toEqual(0);
});

it("short array", () => {
  result = [1, 0, 3, 5, 10, 0, 11, 1];
  while (result.length < 100) {
    result.push(0);
  }
  expect(calcBratIndex(result)).toEqual(6);
});

codesandbox:

https://codesandbox.io/s/angry-bose-jv7ct?file=/src/index.js:0-383

javascript

эта задача разумным образом не решается на javascript, поскольку нам все double, вследствие чего происходит потеря точности

arrange_numbers_to_form_biggest_number incorrect tests

battle_asserts/src/battle_asserts/issues/arrange_numbers_to_form_biggest_number.clj - all tests accept using of lexicographic order and joining them, but in this method array = [9,1,91] would be 9191, when max number is 9911.

Некорректность задачи sort_elements_by_frequency

Пытался решить задачу https://github.com/hexlet-codebattle/battle_asserts/blob/master/src/battle_asserts/issues/sort_elements_by_frequency.clj

Проблемы:

  1. Очень неочевидный стектрейс – [ Array(16) ] to deeply equal [ Array(16) ]
    2. Если залогировать вывод – кажется все в порядке – [ 3, 3, 3, 3, 0, 0, 0, 0, 4, 4, 1, 1, -2, -2, 2, -4 ] (для входных данных [0,0,3,3,1,-2,3,2,3,1,0,-4,4,0,-2,4])

UPD: Неправильно понял задачу, поэтому понял, в чем проблема, вопрос про стектрейс актуальный.

Complex number division task

Implement a function that divide two complex numbers. Result Number should be formatted as follows real+imgi or -real+imgi and so on. If number can't be computed, return Division by zero!11!1

Simple calculator

Create simple calculator that supports next operations: add, substract, divide, multiply, modulo.

battle_asserts/src/battle_asserts/issues/garland_word.clj Не полные тесты

Не полные тесты.
Столкнулся с вот таким решением на js:
module.exports = a => {
for(var i=0;i<a.length;i++) {
var q = a.substr(0,a.length-i);
if(a.lastIndexOf(q) > 0)
return q.length;
}
return 0;
}

И человеку засчитало это как правильное решение.

Контрпример: "aab"
В этом случае это решение вернет 1, когда будет i=2, q=="a", "aab".lastIndexOf("a") == 2, return 1;
Хотя правильный ответ 0.
Надо дополнить тесты, что бы такие решения не принимались.

Prime array

Generate the array of first n prime numbers.

Guess soccer match score task

Task:

Two teams playing soccer. Someone is betting on the result of the match, for example 1: 2.
Write a function that takes the assumed and real score as the arguments
and returns 2 if the score is correct, 1 if the winner is correct but
the score is wrong and 0 if the winner is wrong.

JS solution:

export default ([guess1, guess2], [actual1, actual2]) => {
  const guessedDiff = guess2 - guess1;
  const actualDiff = actual2 - actual1;

  if (Math.sign(guessedDiff) !== Math.sign(actualDiff)) return 0;
  if (guess1 === actual1) return 2;
  return 1;
};

tests:

import calcReward from "./index";

it("wrong guess", () => {
  const actual = calcReward([1, 2], [2, 1]);
  expect(actual).toEqual(0);
});

it("correct winner, wrong diff", () => {
  const actual = calcReward([2, 2], [3, 3]);
  expect(actual).toEqual(1);
});

it("correct", () => {
  const actual = calcReward([3, 1], [3, 1]);
  expect(actual).toEqual(2);
});

Biggest square sum

Implement function that take three numbers and returns square sum of biggest two.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.