diff --git a/CHANGELOG.md b/CHANGELOG.md index 58b399f..5356ad9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Random mode modified ## [0.8] - 2022-06-01 ### Added - `INVALID_COLOR_TYPE_ERROR` error diff --git a/samila/functions.py b/samila/functions.py index 139e82d..dfb976f 100644 --- a/samila/functions.py +++ b/samila/functions.py @@ -27,17 +27,22 @@ def random_equation_gen(): :return: equation as str """ - num_elements = random.randint(2, len(ELEMENTS_LIST) + 3) + num_elements = random.randint(1, len(ELEMENTS_LIST)) result = "" index = 1 random_coef = random.choice(RANDOM_COEF_LIST) while(index <= num_elements): argument = random.choice(ARGUMENTS_LIST) + if random.randint(0, 1) == 1: + argument = random.choice(ELEMENTS_LIST).format( + random_coef, argument) result = result + \ random.choice(ELEMENTS_LIST).format(random_coef, argument) if index < num_elements: result = result + random.choice(OPERATORS_LIST) index = index + 1 + if random.randint(0, 1) == 1: + result = random.choice(ELEMENTS_LIST).format(random_coef, result) return result @@ -106,7 +111,7 @@ def is_valid_color(color): :type color: any format :return: result as bool """ - if color == None: + if color is None: return True try: _ = matplotlib.colors.to_hex(color) diff --git a/samila/params.py b/samila/params.py index ec07031..d6f362f 100644 --- a/samila/params.py +++ b/samila/params.py @@ -98,6 +98,8 @@ ARGUMENTS_LIST = [ "y**2", "(x**2)*y", "(y**2)*x", + "(y**2)+(x**2)", + "(y**2)-(x**2)", "(x**2)*(y**3)", "(x**3)*(y**2)", "x*(y**3)",