Skip to main content
27 votes

The Futuristic Gun Duel

The BlackHatPlayer The BlackHat Player knows that bullets and shields are a thing of the past; the actual wars are won by those who can hack the opponent's programs....
Matteo Italia's user avatar
21 votes

Tips for golfing in C++

Shorter header This is GCC specific, it may be extensible to other compilers. Precompiled header. In G++ bits/stdc++.h is the precompiled header consists of all ...
DELETE_ME's user avatar
  • 17.3k
20 votes

The Futuristic Gun Duel

Next, the most feared of all creatures, it's been to hell and back and fought with literally 900000 other bots, its... The BotRobot BotRobot was named, trained ...
ATaco's user avatar
  • 10.8k
12 votes
Accepted

Generate ladder of integers using the least number of unique characters (in C++)

I believe I managed to remove the = character from your code, although it now is significantly slower ...
Expired Data's user avatar
  • 4,001
11 votes

Generate the longest error message in C++

Forgetting a semi-colon before an include statement int i #include <stdio.h> I made this error in a header file which I had included in throughout most of ...
Zachary Vander Klippe's user avatar
11 votes

Add comments to a Python script and make it a bilingual Python/C++ “program”

Score 119 (Thx @Linus for the byte count) (1 byte saved thx @Conor O'Brien) (1 byte saved thx @PieCot) Counting bytes again by hand, I found 113. Maybe it's right this time. No it's not ...
edc65's user avatar
  • 32.1k
11 votes
Accepted

Add comments to a Python script and make it a bilingual Python/C++ “program”

Score 116 Prepend: #include<cstdio> #define print(A)main(){puts(A);} #define greet() #define \ The preprocessor backslash ...
Linus's user avatar
  • 1,958
11 votes

Generate ladder of integers using the least number of unique characters (in C++)

I finally got 24 unique characters by combining the answers of @ExpiredData and @someone. Also, using the short data type instead of int helped to speed up my program because it takes a shorter time ...
Donald's user avatar
  • 359
10 votes

The Futuristic Gun Duel

CBetaPlayer (cβ) Approximate Nash Equilibrium. This bot is just fancy math with a code wrapper. We can reframe this as a game theory problem. Denote ...
George V. Williams's user avatar
9 votes

Generate the longest error message in C++

82 bytes: This one works similar to Joey Adams' approach, but the error message will grow exponentially with respect to -ftemplate-depth (because ...
Colera Su's user avatar
  • 2,421
9 votes

Tips for golfing in C++

Use GCC builtins instead of importing If you are using a GCC compiler, it sometimes helps to use their builtin functions, such as __builtin_puts or ...
dingledooper's user avatar
  • 22.7k
9 votes
Accepted

The Futuristic Gun Duel

MontePlayer This player uses the Decoupled UCT Monte Carlo Tree Search algorithm to decide what choices it should make. It tracks what the enemy does to predict its actions. It simulates the enemy as ...
TheNumberOne's user avatar
  • 11.6k
9 votes

Generate ladder of integers using the least number of unique characters (in C++)

23 unique characters using Digraphs. (25 without). No UB. Use C++11 braced initializer syntax to list-initialize an integer to zero with int var{}; avoiding <...
Peter Cordes's user avatar
  • 4,837
8 votes

Tips for golfing in C++

You may use the ternary operator ?: without any expressions in the true-block (it saves a byte) ...
michael-tkach's user avatar
8 votes

Tips for golfing in C++

Instead of writing big powers of 10, use e notation. For example, a=1000000000 is longer than a=1e9. This can be extended to ...
Pranjal Jain's user avatar
8 votes

Tips for golfing in C++

Functions in <algorithm> often requires passing a.begin(),a.end() which is really long, instead you can use ...
JayXon's user avatar
  • 769
8 votes

The Futuristic Gun Duel

I'm lacking the comment everywhere right, so I can't ask my questions yet. So this is a very basic player to win against the first bot. [Edit] Thanks, now the previous status isn't true anymore but ...
ColdK's user avatar
  • 121
7 votes

Tips for golfing in C++

#import instead of #include gives you one more byte. Also, the space character between ...
michael-tkach's user avatar
7 votes

Tips for golfing in C++

If you want to swap two integer variables a and b then , a^=b^=a^=b; can be used , saving 5 characters than the standard way ...
parth_07's user avatar
  • 171
7 votes

Add comments to a Python script and make it a bilingual Python/C++ “program”

Score 131 130 134 The lines to be prepended are: #import <iostream> #define def int main(){0? #define greet() #define print(A) 0;std::cout<<A"\n";} ...
Conor O'Brien's user avatar
7 votes

The Futuristic Gun Duel

The BarricadePlayer The Barricade Player loads a bullet first round, then keeps an appropiate shield (still a bit random). He also loads another shot every 5th ...
devRicher's user avatar
  • 1,659
7 votes

The Futuristic Gun Duel

The StudiousPlayer The Studious Player studies its prey, modeling each opponent it encounters. This player begins with a basic strategy, randomly driven in ...
H Walters's user avatar
  • 1,646
7 votes

Generate ladder of integers using the least number of unique characters (in C++)

C++ (gcc) x86_64 Linux only, 9295 8900 8712 6812 5590 5218 bytes, 18 unique characters ...
ceilingcat's user avatar
  • 7,605
6 votes

Print 1 to 1000 in C++ without semi-colons

...
Steadybox's user avatar
  • 16.5k
6 votes

Add comments to a Python script and make it a bilingual Python/C++ “program”

Score 110 104 Improving upon Linus' answer: ...
Leon's user avatar
  • 317
6 votes

The Futuristic Gun Duel

The GunClubPlayer Cut out from the original question. This serves as an example of a minimalistic implementation of a derived player. This player will participate ...
Frenzy Li's user avatar
  • 1,009
6 votes

Generate ladder of integers using the least number of unique characters (in C++)

21 unique characters + 1 unremovable newline ...
jimmy23013's user avatar
5 votes

Generate the longest error message in C++

A file named a.cpp. Code: ...
elipszilon's user avatar
5 votes

Tips for golfing in C++

If you're doing C++11 or newer (which should always be the case now), use auto for complex types, if possible. Example: 54 Bytes instead of 66 ...
movatica's user avatar
  • 1,293

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