ASCII Scores
code-golf music ascii-art
Digging around in the depths of your temp folder, you find some compositions for the piano. Unfortunately, these compositions were written with note names and durations only, and you only have access to a text terminal. Therefore, your task is to write a...
@Lembik Sorry, I wasn't on chat. I got the updated code at work, but didn't want to post it from there. You never know if somebody freaks out if the detect that you're posting source code to a web site. I'll try and bring a memory stick tomorrow.
Well, most employers tell you that they have the right to watch what you're doing. You just don't think that they would actually do it, without any good reason.
That OEIS entry has the value for 36, but nothing else that is close. Weird. Anyway, I tried for n=17 for the Toeplitz matrix, which completed in about half an hour. I started n=19, should be complete when I get back tomorrow morning. n=20 would take about a weekend. Roughly four time as long for each n -> n+1.
Yes, it says there that g(n) = 2^(n-1)*a(n-1). Where a() is the count for 0,1 and g() is for +-1.
If I read the OEIS entry and related web site correctly, the maximum for a 0/1 matrix for n=30 is 75960984159088. But I guess that tells us nothing about the maximum for a Toeplitz matrix of that size. Except that it can't be higher, of course.
I have a variation running now that goes a little farther. Once it can't make an improvement with changing one bit at a time, it starts inverting and reversing sub-sequences. So far, no improvement.
I'll have to look at the larger one. Up to n=15, the maximum does not seem to be circulant. At least the one I printed. There could potentially be tied results that are circulant. I can probably change it to list all tied matrices. At least if there aren't too many.
n=19 (which obviously includes n=18) is running on my work computer. Should be done by tomorrow morning. I got a nice quad core desktop there. It finished n=15 in 1:30 minutes.
Consider all $n$ by $n$ matrices whose elements are real values in $[0,1]$. Now for a given $n$, consider all those matrices with maximum determinant.
Are all the elements of these matrices always either exactly $0$ or $1$?
From numerical experiments this seems to be the case but I don't s...
Mine is more similar to isaacg. I tried a less greedy simulated annealing algorithm first. But at least in the time I ran it, it only got to about 4.7*10^13.
I tried reversal and inversion of random sub-sequences. But I think what happens is that once you get to a high value, a typical simulated annealing gets stuck because every attempted move makes the target function so much smaller. There's really no locality to the function.
And if you set the temperature high enough to prevent this, it will just go all over the place.
So yes, the reversals keep the number of ones constant.
I typically get that maximum value that the other two posters got in a fairly short time. Less than a minute, probably. That's with running a semi-greedy algorithm. Of all the 1-bit changes, I find all the ones that improve the score, and choose a random one from them.
Since the determinant is typically 0 until you have a certain amount of 1s in there, the first few moves sort of randomize the starting position. I didn't think of that, but it might not make a big difference anyway.
One of the secret chambers in Hog-warts is full of philosopher’s stones. The floor of the chamber is covered by h × w square tiles, where there are h rows of tiles from front (first row) to back (last row) and w columns of tiles from left to right. Each tile has 1 to 100 stones on it. Harry has t...
Question: If a problem is posted on SPOJ without a copyright notice (no mention of CC-SA like some have), that defaults to "rights reserved" and we shouldn't have it copied verbatim here, right?
You should write a program or function which receives a list of digits as input and outputs or returns the largest sum achievable by putting these digits in a square.
Input will always contain a square number of digits. An example square arrangement for the input 9 1 2 3 4 5 6 7 7 could be
677
...
Using you language of choice, write the shortest function/script/program you can that will identify the word with the highest number of unique letters in a text.
Unique letters should include any distinct character using UTF-8 encoding.
Upper and lower case versions of the same character are...
Your program must find all the words in this wordlist that contain all the vowels (a e i o u y). There are easy ways to do this, but I am looking for the shortest answer. I will take any language, but I'd like to see Bash.
Here is an example (could be much improved):
cat wordlist.txt | grep "a"...
Yesterday, I put a description of my contest idea in the Sandbox (meta.codegolf.stackexchange.com/questions/2140/…), but I have not received any responses. How long do I wait before I conclude that no response is a vote against the proposal?
@sadakatsu I said this (in a more brief form) yesterday, but it's pretty complex. Even writing a standard (full) chess AI is more complex than many (most?) users here are willing to do. Adding complexity means that even fewer will play. I'm not saying this to mean "No don't do it", but just to temper expectations.
Whether that's a good or bad reflection of the site is another discussion. That's just the way I see it actually working.
Did SE have some self-contained policy or am I remembering this incorrectly?
(It sounds interesting though, but seems to raise a few questions - e.g. can I delay an opponent multiple times in one turn, and can I check and use a delay on the same turn?)
As an example, take the existing chess KotH. The rules were even made simpler for the contest (no castling, en passant, etc). While there was what I'd consider decent turnout, most of the entries relied on really basic techniques, because (IMO) making it more complex wasn't worth the fun/time equation they have for challenges here.
It might, just don't expect many deep-thought entries. If it requires even more code just to follow the rules at all, there's less incentive to do something clever. Again, my opinion.
This is the first problem I've posted here; please post criticisms in comments.
Summary
A game board consists of a starting space, an ending space, and between them are N spaces, each with an instruction. You begin on the starting space with 0 points to your credit. Flip a coin or roll a die to...
CJam Expander
Input: a program written in CJam. You can accept input however you'd like.
Output: the same program ready to be put into a PPCG answer. You must:
Not change the horizontal position of any token in the program.
Put each token one line below the previous one except } which must ...
Vowel-Consonant Imbalance
Sandbox question: Is it too easy/too close to an existing question? Related ones I found: Find words containing every vowel and Finding the most 'unique' word
You should write a program or function which receives a list of space-separated words as input and outputs or ...
Recently the challenge Word with greatest repeat of letters was posted. The OP said that it was inspired by a question on Stack Overflow, in which the user sought assistance with a solution to a Coderbyte challenge (specifically Letter Count I). The challenge posed here amounts to a reproduction ...
Redraw an Image
code-golf
In this challenge, you'll be redrawing an image with colors from another image.
Input
The input will consist of two image files. The first image will be the one you need to redraw, the second will be the image which you grab the colors to redraw the first one with
...
While moving, I broke my lamp. Now, I need a new one. It's your job to make me a lamp! I'm not sure what size I want, though I know I want a squiggly one.
Your program/function must take in a number input, and print out a lamp with that many squiggles/bumps.
Examples:
Input:2
Output:
/--\
...
@Doorknob intentionally designed to be verbose? :P every answer of yours accompanies with the fact that you forgot to implement the only feature really required by that answer :P
Retina or Trash!
We live in a wonderful age of technology where we can have beautifully detailed 8K screens on our TVs, and even 2K displays on our phones for our mobile browsing pleasure. We've come a long way in recent years in terms of screen technology.
One of the products of this is a ter...
... why is it that every challenge I try to solve exposes a new bug? Apparently the function that parses decimal numbers that used to work no longer works. -_-
@Doorknob intentionally designed to be verbose? :P every answer of yours accompanies with the fact that you forgot to implement the only feature really required by that answer :P
You know Imma slap it in yo face every single taim
I've already found it weird that JS answers have been randomly downvoted without comments recently... but Prolog? Why would anyone randomly downvote Prolog?
You should write a program or function which receives a list of digits as input and outputs or returns the largest sum achievable by putting these digits in a square.
Input will always contain a square number of digits. An example square arrangement for the input 9 1 2 3 4 5 6 7 7 could be
677
...
@Sp3000 Okay, lets raise the stakes. I hereby promise to slap a big juicy 500 pt bounty on the shortest legal (community consensus) Retina answer to this question one week from this comment posting timestamp. — Digital Trauma4 mins ago
folks - you'll have to hold me to this one - otherwise I might forget ;-)
This is a list of unofficial, deadline-less (hence not searchable) bounties offered by users on various challenges on the main site.
Disclaimer: There is no guarantee that the user will award the bounty for you in case you fulfill its requirement. Especially if the user isn't an active member an...
def f(I):
S=[]
for i in map(len,I.split("\n")):S=(S+[0])[:i];S[-1]+=1;print" "*~-i+`S[-1]`+"."
You haven't defined clearly what happens with >1 digit numbers, so I assumed that the preceeding number of spaces just had to be the same as the one digit case
Average color of an image
code-golf
Scientists have been able to determine the average color of the universe but in how many bytes can we find the average color on an image?
Your task
Your input will be a single image which you will need to find the average of the colors in the image and outp...
Write a program that takes in a string where every line consists of the character 0 indented by some number of spaces. The top line is not indented and every other line will be indented by at most one more space than the line just before it.
No lines will have trailing spaces but you may optiona...
@NewSandboxedPosts This got me thinking - how about a pop-con that takes in an image and a color C. The goal is to make the average color of the image be C with minimal visual difference.
@Calvin'sHobbies Depending on the color space, I think that would involve fiddling with blacks more than anything, since there's a wide range that people see as "black" with little contrast. For those pictures that have a bit o black at least.
Consider the following bit of code:
f=(m,c)=>{m?c()&f(--m,c):0}
(thanks to zzzzBov for this little nugget)
which is a "for"-less loop
and the following:
a=b=>b++
Given these two snippets, and the fact that:
z = 0; f(10,a(z));
which I would expect would result in z equating to 10, but i...