Skip to main content
Share Your Experience: Take the 2024 Developer Survey
11 votes
Accepted

Self-referencing tuple in python

Python 3, 48 bytes from marshal import* t=loads(b'\xa9\1r\0\0\0\0') Try it online! Not portable, depends on the interpreter. There's probably a similar (portable) ...
Command Master's user avatar
9 votes

Adversarial Iterated Prisoner's Dilemma

Neural Networks (Prisoner + Flipper) ...
Command Master's user avatar
6 votes

How can I reduce the characters in the following python code?

Python 3.8 (pre-release), 46 bytes You can use exit instead of print to save 1 byte. This displays the same for me in a terminal running on Windows and displays the string in the Debug section in TIO....
ElPedro's user avatar
  • 6,459
5 votes

Adversarial Iterated Prisoner's Dilemma

Masquerade (prisoner) ...
SuperStormer's user avatar
  • 1,983
5 votes

Adversarial Iterated Prisoner's Dilemma

Paranoia Pattern (flipper) ...
Unrelated String's user avatar
4 votes

Adversarial Iterated Prisoner's Dilemma

Holding A Grudge (prisoner) ...
Kevin Cruijssen's user avatar
4 votes

Adversarial Iterated Prisoner's Dilemma

Prisoner ...
tsh's user avatar
  • 34.9k
4 votes
Accepted

Is there a shortest code to format string

Python 3, 35 bytes print(f"({s:.3}) {s[3:6]}-{s[6:]}") Try it online! Uses the solution from the question but saves three bytes: removes a redundant <...
Jonathan Allan's user avatar
3 votes

Adversarial Iterated Prisoner's Dilemma

Tit Forty Tat (Prisoner) ...
ATaco's user avatar
  • 10.8k
3 votes
Accepted

Adversarial Iterated Prisoner's Dilemma

String (prisoner + flipper) ...
user1502040's user avatar
  • 3,829
2 votes

Is there a shorter way to get user input in python?

This may be much shorter for Python3 and inputs as integer a,b,c=map(int,open(0)) For example expected input is: 23 45 56 The above golf code will assign ...
Nishant Patel's user avatar
2 votes

Adversarial Iterated Prisoner's Dilemma

Detect Evil The goal here is to detect if the opponent is evil. We use our knowledge of the 40 max count of flips to hedge our bets. ...
Yakk's user avatar
  • 929
2 votes

Adversarial Iterated Prisoner's Dilemma

Tempting Trickster (flipper) ...
Unrelated String's user avatar
2 votes

Adversarial Iterated Prisoner's Dilemma

Modulo 4 (flipper) def basic_mod_4_flipper( p1_moves, p1_flipped_moves, p2_moves, p2_flipped_moves, flips_left, state ): return len(p1_flipped_moves) % 4 ...
ld_spectrum's user avatar
2 votes

Adversarial Iterated Prisoner's Dilemma

Slightly Vindictive (prisoner) ...
gsitcia's user avatar
  • 3,301
1 vote

Is there a shortest code to format string

Python, 36 bytes slightly improved version of your f-string (see also Jonathan Allan's comment), wrapped in a function ...
1 vote

Adversarial Iterated Prisoner's Dilemma

Less-Deterministic Prisoner ...
huanglx's user avatar
  • 329
1 vote

Adversarial Iterated Prisoner's Dilemma

Blind Rage (Prisoner) ...
huanglx's user avatar
  • 329
1 vote

Adversarial Iterated Prisoner's Dilemma

Stuck Buttons (Prisoner) ...
huanglx's user avatar
  • 329
1 vote

Adversarial Iterated Prisoner's Dilemma

Make P1 Look Evil Flipper ...
Yakk's user avatar
  • 929
1 vote

The Dating Game / Secretary Problem

...
Ethan C's user avatar
  • 171
1 vote

KotH - Floating Point Prisoners Dilemma

Falling Uppercut ...
The Empty String Photographer's user avatar
1 vote

KotH - Floating Point Prisoners Dilemma

Uppercut def strategy(is_new_game,*a): return -1000000 def plan(opmove,*a): pass Returns a negative number with high magnitude to get lots of points. This ...
The Empty String Photographer's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible