abbarnes

Cookie Clicker Simulation Test Suite [codeskulptor]

Dec 12th, 2017
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.50 KB | None | 0 0
  1. """
  2. Testing program for CookieClicker simulation
  3. """
  4.  
  5. import poc_simpletest
  6. import poc_clicker_provided as provided
  7. #http://www.codeskulptor.org/#user43_nlSmwduqhE_1.py
  8.  
  9. def run_suite_ClickerState(ClickerState):
  10.     """
  11.    Testing code for Clicker_State()
  12.    """
  13.    
  14.     #create TestSuite object
  15.     suite = poc_simpletest.TestSuite()
  16.    
  17.     #create ClickerState object
  18.     clicker = ClickerState()
  19.    
  20.     suite.run_test(clicker.get_history(), [(0.0, None, 0.0, 0.0)], "Test 1: initial State")
  21.     suite.run_test(clicker.get_cps(), 1.0, "Test 2: initial cps")
  22.     clicker.wait(10)
  23.     suite.run_test(clicker.get_cookies(), 10.0, "Test 3: cookies @ 10 secs")
  24.     clicker.buy_item("2cps_at_5_cookies", 5.0, 2.0)
  25.     suite.run_test(clicker.get_history(), [(0.0, None, 0.0, 0.0), (10.0, "2cps_at_5_cookies",5.0, 10.0)],
  26.                    "Test 4: purchaseed 2 cps for 5 cooks")
  27.     suite.run_test(clicker.get_cps(), 3.0, "Test 5: cps check after purchase")
  28.     suite.run_test(clicker.get_cookies(), 5.0, "Test 6: cookie check after purchase")
  29.     suite.run_test(clicker.time_until(35.0), 10.0, "Test 7:  time until 35 cookies check")
  30.  
  31.     #report results
  32.     suite.report_results()
  33.    
  34. def run_suite_cheap_simulation(simulate_clicker, strategy_cheap):
  35.     """
  36.    Testing code for simulate_clicker function.
  37.    """
  38.    
  39.     #create TestStuite object
  40.     suite = poc_simpletest.TestSuite()
  41.    
  42.     #cheap_sim_100_k = simulate_clicker(provided.BuildInfo(), 100000, strategy_cheap)
  43.     print "sim created"
  44.     cheap_sim_owl = simulate_clicker(provided.BuildInfo({'A': [5.0, 1.0],
  45.                                                          'C': [50000.0, 3.0], 'B': [500.0, 2.0]}, 1.15),
  46.                                      5.0, strategy_cheap)
  47.    
  48.     #suite.run_test(cheap_sim_100_k.get_time(), 100000, "Test 1: time for 100k run")
  49.     suite.run_test(cheap_sim_owl.get_history()[-1][1], 'A', "Test 2: purchase A at t = 5.0")
  50.     suite.run_test(cheap_sim_owl.get_time(), 5.0, "Test3: owl test time")
  51.     suite.run_test(cheap_sim_owl.get_net_cookies(), 5.0, "Test4: owl test net cookies @ t=5.0")
  52.     #print cheap_sim_100_k.get_history()
  53. #    print cheap_sim_owl.get_history()
  54. #    print cheap_sim_owl
  55. #    print
  56.  
  57.     suite.report_results()
  58.  
  59. def run_suite_none_simulation(simulate_clicker, strategy_none):
  60.     """
  61.    Testing code for simulate_clicker function.
  62.    """
  63.    
  64.     #create TestStuite object
  65.     suite = poc_simpletest.TestSuite()
  66.  
  67.     none_sim_5k = simulate_clicker(provided.BuildInfo({'Cursor': [15.0, 0.10000000000000001]},1.15),
  68.                                    5000.0, strategy_none)
  69.  
  70.     suite.run_test(none_sim_5k.get_net_cookies(), 5000, "Test1: cookies for None sim for t = 5000.0")
  71.     suite.run_test(none_sim_5k.get_time(), 5000, "Test2: time for None sim for t = 5000.0")
  72.     suite.run_test(none_sim_5k.get_cps(), 1, "Test3: cps for None sim for t = 5000.0")
  73.     suite.run_test(none_sim_5k.get_history(), [(0.0, None, 0.0, 0.0)],
  74.                    "Test 4: History for none sim, t = 5000")
  75.     suite.report_results()
  76.    
  77. #def run_suite_cursor_broken(simulate_clicker, strategy_cursor_broken):
  78. #    """
  79. #    Testing code for simulate clicker function with cursor broken strat
  80. #    """
  81. #    
  82. #    #create TestStuite object
  83. #    suite = poc_simpletest.TestSuite()
  84. #
  85. #    cursor_sim = simulate_clicker(provided.BuildInfo({'Cursor': [15.0, 50.0]}, 1.15), 16.0,
  86. #                                  strategy_cursor_broken)
  87. #    
  88. #    #suite.run_test(cursor_sim.get_history
Advertisement
Add Comment
Please, Sign In to add comment