Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
BACKGROUND
So this is a game with my friends I am playing. You create a function in the form of f(them), where them is the opponent function. What the game does is pit both functions against each other in a game of prisoners' dilemma, but with access to the other's function. However, as you can see above, the function is "wrapped" by another function, so ToString() and name do not work. You cannot alter the stack either.

QUESTION
How can I detect when my bot is playing against myself? (I need that info because the bots also play against themselves, and for extra points in this game, I want it to cooperate with itself for extra points.)

Source code:
https://pastebin.com/8Dx2hppZ
Edit fiddle - JSFiddle[^]

What I have tried:

I have tried invoke counters, and creating tester functions that don't return 'C' or 'D'. They have not worked.
Posted
Comments
Afzaal Ahmad Zeeshan 26-Nov-18 4:08am    
This is too much confusing, as a question. Can you please elaborate what you mean to say?
Member 14066655 26-Nov-18 22:11pm    
So what I mean is that I want to know if the other function that this function is squaring off against is an instance of this function. However, as you can see in the pastebin, the functions are called through a function called wrap.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900