A Competitive Coding Game Where Players Write Arbitrary Code
I wanted to think of a two player game where players write arbitrary code on their turns, and then compete to achieve some objective first. Here's what I've come up with:
As a sort of pie rule, player 1 picks an integer, and then player 2 gets to decide if they take the first "coding" turn, or if player 1 gets to instead. Let's say player 2 decides to do the first coding turn.
They then write a function that takes any and only integers and returns for each some other integer, and they put in their own integer, and it must output the integer that player 1 picked. Now player 2 must do the same thing.
Player 2 gets a score which is the number of programming "tokens" (like "while" or "max") used in the function's definition. The length of the input integer in base 2 is also added to one's score. Any other explicit numbers in one's definition are also actually counted for their length in base 2 when scoring, and not just as one token. Also, each time say player 1 uses a token or number that player 2 also used in their last code, an extra point is added to player 1's score.
After this, player 2 gets to put their own input integer into the function that they just wrote, and they get a new integer. Now player 2 must write another function that outputs that same integer using the same rules as before, and then player 1 must. Things keep going back and forth like that. You play to say, 200 points, and whoever reaches 200 first loses, as the goal is to write simpler code to output the target integers.
So far I've only tried playing with ChatGPT using a coding plugin, and ChatGPT played some rather uninspiring moves that were not very difficult to defeat. But I still think that the game could be interesting.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home