python_data_scien/poc1/min_porj_5(Cookie Clicker).py
def buy_item(self, item_name, cost, additional_cps):
        """
        Buy an item and update state

        Should do nothing if you cannot afford the item
        """
        if self._current_cookies >= cost:
            self._current_cookies -= cost
            self._current_cps += additional_cps
            new_entry = (self._current_time,item_name,cost,self._total_cookies)
            self._history_list.append(new_entry)

        Buy an item and update state

        Should do nothing if you cannot afford the item
        
Buy an item and update state
Should do nothing if you cannot afford the item
Buy an item and update state Should do nothing if you cannot afford the item
def buy_item(self, item_name, cost, additional_cps):
        if self._current_cookies >= cost:
            self._current_cookies -= cost
            self._current_cps += additional_cps
            new_entry = (self._current_time,item_name,cost,self._total_cookies)
            self._history_list.append(new_entry)
def buy_item ( self , item_name , cost , additional_cps ) : if self . _current_cookies >= cost : self . _current_cookies -= cost self . _current_cps += additional_cps new_entry = ( self . _current_time , item_name , cost , self . _total_cookies ) self . _history_list . append ( new_entry )
Buy an item and update state
Should do nothing if you cannot afford the item
Buy an item and update state Should do nothing if you cannot afford the item
"""
        Buy an item and update state

        Should do nothing if you cannot afford the item
        """
self
item_name
cost
additional_cps