Linked Questions
85 questions linked to/from Tips for golfing in PowerShell
39
votes
78
answers
5k
views
10 PRINT CHR$(205.5+RND(1)); : GOTO 10 in PHP (or anything else, for that matter)
Just had a 'spirited' conversation with a co-worker about the succinctness of the following BASIC statement:
10 PRINT CHR$(205.5+RND(1)); : GOTO 10
It's the title ...
49
votes
57
answers
6k
views
Scrabble scorer
Challenge:
Take a string of upper or lower case letters as input (optional), and calculate the score that string would get in a game of Scrabble in English.
Rules:
The score of each letter is as ...
33
votes
79
answers
19k
views
Clearing the most significant bit from an integer
Input
The input is a single positive integer n
Output
The output isn with its most significant bit set to ...
37
votes
73
answers
9k
views
Randomizing until 0
Challenge
Sandbox post
Given a positive integer (K) Output a uniformly-random integer (Y) between ...
42
votes
55
answers
6k
views
Previous Fibonacci number
The sequence of Fibonacci numbers is defined as follows:
\$
F_0 = 0 \\
F_1 = 1 \\
F_n = F_{n-1} + F_{n-2}
\$
Given a Fibonacci number, return the previous Fibonacci number in the sequence. You do not ...
27
votes
57
answers
4k
views
Converting Strings to Decimals (Gone Wrong)
What?
Many programming languages, both practical and esoteric, have functions, methods, etc to convert a given string to a decimal number. This is how the process might work:
For each character in ...
35
votes
51
answers
6k
views
Loading Forever... Windows style
Make a Windows style Loading bar by the following instructions.
(notice that this is different than Loading... Forever)
Your output should start by [.... ].
...
39
votes
45
answers
5k
views
Reverse a string while maintaining the capitalization in the same places
The goal here is to simply reverse a string, with one twist:
Keep the capitalization in the same places.
Example Input 1: Hello, Midnightas
Example Output 1: ...
29
votes
68
answers
5k
views
What's the Date?
Challenge
Weirdly, this hasn't been done yet: output the current date.
Rules
The date format you should follow is as follows:
YYYY-MM-DD
Where the month and ...
21
votes
71
answers
12k
views
Round towards zero
This is a simple task. Given a positive or negative real number, round it to the next whole integer closer to zero.
The challenge
Take input through any reasonable form (stdin, function, etc.) of one ...
36
votes
50
answers
7k
views
Character Cross
I was expecting to post something more complex as my first puzzle in PCG, but a particular, uh... homework question on Stack Overflow inspired me to post this. They want to:
print the following ...
46
votes
35
answers
6k
views
Loves me, loves me not
Loves me, Loves me not
This simple kids' game is old, but still popular. Since we are living in 21st century now, let's digitize it!
Specification
Program must take no input, unless you are using a ...
38
votes
41
answers
4k
views
Is my Matrix Arrowhead?
Definition
An arrowhead matrix is a matrix that has all entries equal to 0, except the ones on the main diagonal, top row and leftmost column. In other words, the matrix should look like this:
* * * *...
6
votes
72
answers
10k
views
Shortest code to print ':)' random times [duplicate]
You have to create a code which prints
:)
a random number of times from 1 to 255 inclusive. Your output may not contain any whitespace.
Your score :
The ...
48
votes
32
answers
8k
views
Very Simple Triangles
Write a program or function that takes in a positive integer (via stdin, command line, or function arg) and prints or returns a string of that many of these small triangles tiled together, alternating ...