Guest User

execute

a guest
Aug 23rd, 2023
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.78 KB | None | 0 0
  1.  
  2.  
  3. from oc.fns.context import get_ctx
  4. from oc.fns.shapes import is_triangle, is_line, is_square
  5. from oc.fns.spatial import all_close, is_above, is_below, is_right, is_left, is_middle
  6. from oc.fns.spatial import get_top, get_bottom, get_right, get_left
  7. from oc.fns.spatial import get_top_right, get_top_left, get_bottom_right, get_bottom_left
  8. from oc.fns.spatial import get_middle
  9. from oc.fns.spatial import get_distance, get_minimum_radius
  10. from oc.fns.color import is_dark, is_grey, is_light, lightest, darkest, same_color, different_color, is_darker, is_lighter
  11. from oc.fns.size import is_large, is_small, is_medium_size, largest, smallest, same_size, different_size, is_larger, is_smaller
  12. from oc.fns.iterators import get1idxs, get2idxs, get3idxs, getsets
  13. from oc.fns.lists import add
  14. from oc.fns.lists import sort_state
  15. import numpy as np
  16. from functools import partial
  17. from itertools import permutations
  18.  
  19.  
  20. def get_ctx():
  21. ctx = np.array([[0.125, 0.815, -1.0, -0.8933333333333333], [-0.21, -0.585, 0.3333333333333333, -0.9733333333333334], [0.645, -0.185, -1.0, -0.96], [0.305, -0.645, -1.0, -0.9733333333333334], [-0.705, -0.015, 0.0, 0.84], [0.345, 0.545, 0.6666666666666666, -0.9066666666666666], [-0.315, -0.165, 0.6666666666666666, 0.8]])
  22. return ctx
  23.  
  24. idxs = list(range(7))
  25.  
  26. # New.
  27. ctx = get_ctx()
  28. state = None
  29.  
  30.  
  31. # Turn 0
  32. # Them: Do you see a pair of dots, where the bottom dot is medium-sized and dark and the top dot is large-sized and light?
  33. def turn(state):
  34. results = set()
  35. orderedresults = []
  36. parents = []
  37. for config in getsets(idxs, 2):
  38. for a,b, in permutations(config):
  39. for _ in [0]:
  40. check_ab_pair = all_close([a,b], ctx)
  41. check_a_bottom = a == get_bottom([a,b], ctx)
  42. check_a_medium = is_medium_size(a, ctx)
  43. check_a_dark = is_dark(a, ctx)
  44. check_b_top = b == get_top([a,b], ctx)
  45. check_b_large = is_large(b, ctx)
  46. check_b_light = is_light(b, ctx)
  47.  
  48. if (
  49. True
  50. and check_ab_pair
  51. and check_a_bottom
  52. and check_a_medium
  53. and check_a_dark
  54. and check_b_top
  55. and check_b_large
  56. and check_b_light
  57.  
  58. ):
  59. dots = frozenset([a,b,])
  60. if dots not in results:
  61. results.add(dots)
  62. orderedresults.append(dots)
  63. parents.append(config)
  64. return sort_state(orderedresults, parents, ctx, select=False)
  65. state = turn(state)
  66.  
  67.  
  68. if state is not None:
  69. print([tuple(x) for x in state])
  70. else:
  71. print("None")
Add Comment
Please, Sign In to add comment