This repository has been archived by the owner on Jul 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Shepherd/recipemanager #733
Open
ochan1
wants to merge
21
commits into
shepherd/master
Choose a base branch
from
shepherd/recipemanager
base: shepherd/master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
1f3f8af
update chrommunal (#719)
rmandla 4f26445
Removed old scripts and files (#730)
jonathan-j-lee f536f14
update readme with lint fix instructions (#731)
ewc340 b29b1b5
worked on recipe manager
68a6bb7
RecipeManger class fixed, Utils for Recipies and Ingredients, and All…
ochan1 cb311e4
New mapping
ochan1 f361fde
weights
42f11be
Generate Recipes completed
ochan1 bbfa47d
Merge branch 'shepherd/recipemanager' of https://github.com/pioneers/…
ochan1 8347b7d
Fix for style checker
ochan1 b099a64
Merge branch 'shepherd/master' into shepherd/recipemanager
ochan1 61a4d6d
passed pylint test
371cbb1
Merge branch 'shepherd/recipemanager' of https://github.com/pioneers/…
58a65cb
fixed adding/finishing recipe... need to fix probabilities
33704d3
Global Variables and Classless RecipeManager + Utils Corrections
ochan1 5c3300c
Randomized Team Recipe Generators Complete
ochan1 bc1ad83
Added recipeNum to RecipeManager.py
ochan1 2a02b07
Added recipeNum to RecipeManager.py
ochan1 775e673
Stylish for RM
ochan1 86ed605
Style Updates for Recipe Manager
ochan1 e992fb5
finally delete all but shepherd
akshitdewan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
from Utils import * | ||
|
||
|
||
class RecipeManager(): | ||
|
||
master_recipes = [RECIPE_PROBABILITIES.EASY_RECIPE, RECIPE_PROBABILITIES.MEDIUM_RECIPE, \ | ||
RECIPE_PROBABILITIES.HARD_RECIPE, RECIPE_PROBABILITIES.VERY_HARD_RECIPE] | ||
gold_recipes = [] | ||
blue_recipes = [] | ||
gold_recipes_completed = 0 | ||
blue_recipes_completed = 0 | ||
|
||
def generate_recipes(self): | ||
ochan1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
''' | ||
reset recipe list with 4 newly selected recipes | ||
both teams should have the same recipes | ||
''' | ||
self.gold_recipes.clear() | ||
self.blue_recipes.clear() | ||
for recipe in self.master_recipes: | ||
self.gold_recipes += list(recipe.values) | ||
self.blue_recipes += list(recipe.values) | ||
|
||
def next_recipe(self, team): | ||
''' | ||
pop the recipe from the front of the list | ||
|
||
The recipe being popped is done | ||
''' | ||
if team == ALLIANCE_COLOR.BLUE: | ||
if self.blue_recipes: | ||
self.blue_recipes.pop(0) | ||
self.blue_recipes_completed += 1 | ||
else: | ||
if self.gold_recipes: | ||
self.gold_recipes.pop(0) | ||
self.gold_recipes_completed += 1 | ||
|
||
def get_recipe(self, team): | ||
''' | ||
return first element of recipes | ||
''' | ||
if team == ALLIANCE_COLOR.BLUE: | ||
if not self.blue_recipes: | ||
return None | ||
return self.blue_recipes[0] | ||
else: | ||
if not self.gold_recipes: | ||
return None | ||
return self.gold_recipes[0] | ||
|
||
def check_recipe(self, team, ingredients, num_cooked=0): | ||
''' | ||
checks correctness of recipe | ||
''' | ||
recipes = [] | ||
if team == ALLIANCE_COLOR.BLUE: | ||
recipes = self.blue_recipes | ||
else: | ||
recipes = self.gold_recipes | ||
if len(recipes) != len(ingredients): | ||
return False | ||
else: | ||
for item in ingredients: | ||
if item not in recipes: | ||
return False | ||
return True | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. put this line inside the else statement to appease the style checker :') |
||
|
||
def set_recipes(self, gold_recipes, blue_recipes): | ||
''' | ||
overwrite recipes | ||
''' | ||
if gold_recipes != None: | ||
self.gold_recipes = list(gold_recipes) | ||
|
||
if blue_recipes != None: | ||
self.blue_recipes = list(blue_recipes) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why this is a list of references to an empty list... it does give me a good idea of how to manage the recipes tho.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The idea is to make it easier for us to load and reload the list by having a list that we can read from without the programmer looking back and forth
It's to make our lives and future people lives easier
Also, this is not empty (or I believe it shouldn't be)