Skip to main content
Notice removed Draw attention by Calvin's Hobbies
Bounty Ended with Vectorized's answer chosen by Calvin's Hobbies
Notice added Draw attention by Calvin's Hobbies
Bounty Started worth 250 reputation by Calvin's Hobbies
Added score checking script
Source Link
Calvin's Hobbies
  • 90k
  • 46
  • 339
  • 555

Dark black ink has splattered all over your white sheet of printer paper! The obvious solution is to fold the paper so black and white parts meet and both become grey as the ink diffuses. Then unfold and refold until your paper is all equally grey.

Finding the best way to make these folds is your task in this coding challenge. This Pastebin contains four different sized grids of ones and zeros. Each grid represents a piece of ink splattered paper that you must turn grey. Zeros are paper and ones are ink.

In these grids, only horizontal and vertical folds along the spaces between lines and columns are valid. When a fold is made the pairs of overlapping values are averaged. Folds are done one at a time and always unfolded. Folds only change the ink distribution, not the size of the paper.

Rn denotes folding the left edge of the grid to the right, starting after the nth column. Dn denotes folding the top edge of the grid downward fold, starting after the nth row. (n is 1-indexed)

Example

Given this grid

0 1 1 1
0 0 0 0
0 0 0 0

a D1 fold means "fold the entire top row down then unfold".

0 0.5 0.5 0.5
0 0.5 0.5 0.5
0   0   0   0

Then an R2 will produce

0.25 0.5 0.5 0.25
0.25 0.5 0.5 0.25
   0   0   0    0

and another R2 will not change anything.

Goal

Your goal is to write an algorithm that finds the best ink-spreading folding sequence for each of the four grids using exactly 8 folds each time. The folds may be any combination of Rs or Ds.

Scoring

The score of your submission is the sum of your scores for each grid. A grid's score is the sum of the absolute differences between each of its values and its average (its sum divided by its area). Lower scores are better. A score of 0 is perfect, but is probably impossible in only 8 folds.

You must report your four 8-step folding sequences with your code in your answer. This is so we can verify your algorithm really works.

Please put them in this form:

20*20R1D2R3D4R5D6R7D8
40*20R1D2R3D4R5D6R7D8
40*40R1D2R3D4R5D6R7D8
20*80R1D2R3D4R5D6R7D8

(I will soon writeHere is a Python script that calculates a scorewill calculate your scores given the fouryour folding sequences.)

Naturally you should not copy someone else's sequence submission. Sequences for each grid only belong to the person who first created them.

Clarifications

  • Ideally your algorithm will work well on any grid, though you can tailor it to these specific ones.

  • You must submit your code with your sequence. To win you need the smallest-scoring set of 8-step folding sequences that has not already been posted, and also an algorithm that stands up to public scrutiny. Explain your code, don't obfuscate it.

  • The grid should never contain negative numbers.

  • Standard loopholes apply.

Dark black ink has splattered all over your white sheet of printer paper! The obvious solution is to fold the paper so black and white parts meet and both become grey as the ink diffuses. Then unfold and refold until your paper is all equally grey.

Finding the best way to make these folds is your task in this coding challenge. This Pastebin contains four different sized grids of ones and zeros. Each grid represents a piece of ink splattered paper that you must turn grey. Zeros are paper and ones are ink.

In these grids, only horizontal and vertical folds along the spaces between lines and columns are valid. When a fold is made the pairs of overlapping values are averaged. Folds are done one at a time and always unfolded. Folds only change the ink distribution, not the size of the paper.

Rn denotes folding the left edge of the grid to the right, starting after the nth column. Dn denotes folding the top edge of the grid downward fold, starting after the nth row. (n is 1-indexed)

Example

Given this grid

0 1 1 1
0 0 0 0
0 0 0 0

a D1 fold means "fold the entire top row down then unfold".

0 0.5 0.5 0.5
0 0.5 0.5 0.5
0   0   0   0

Then an R2 will produce

0.25 0.5 0.5 0.25
0.25 0.5 0.5 0.25
   0   0   0    0

and another R2 will not change anything.

Goal

Your goal is to write an algorithm that finds the best ink-spreading folding sequence for each of the four grids using exactly 8 folds each time. The folds may be any combination of Rs or Ds.

Scoring

The score of your submission is the sum of your scores for each grid. A grid's score is the sum of the absolute differences between each of its values and its average (its sum divided by its area). Lower scores are better. A score of 0 is perfect, but is probably impossible in only 8 folds.

You must report your four 8-step folding sequences with your code in your answer. This is so we can verify your algorithm really works.

Please put them in this form:

20*20R1D2R3D4R5D6R7D8
40*20R1D2R3D4R5D6R7D8
40*40R1D2R3D4R5D6R7D8
20*80R1D2R3D4R5D6R7D8

(I will soon write a script that calculates a score given the four sequences.)

Naturally you should not copy someone else's sequence submission. Sequences for each grid only belong to the person who first created them.

Clarifications

  • Ideally your algorithm will work well on any grid, though you can tailor it to these specific ones.

  • You must submit your code with your sequence. To win you need the smallest-scoring set of 8-step folding sequences that has not already been posted, and also an algorithm that stands up to public scrutiny. Explain your code, don't obfuscate it.

  • The grid should never contain negative numbers.

  • Standard loopholes apply.

Dark black ink has splattered all over your white sheet of printer paper! The obvious solution is to fold the paper so black and white parts meet and both become grey as the ink diffuses. Then unfold and refold until your paper is all equally grey.

Finding the best way to make these folds is your task in this coding challenge. This Pastebin contains four different sized grids of ones and zeros. Each grid represents a piece of ink splattered paper that you must turn grey. Zeros are paper and ones are ink.

In these grids, only horizontal and vertical folds along the spaces between lines and columns are valid. When a fold is made the pairs of overlapping values are averaged. Folds are done one at a time and always unfolded. Folds only change the ink distribution, not the size of the paper.

Rn denotes folding the left edge of the grid to the right, starting after the nth column. Dn denotes folding the top edge of the grid downward fold, starting after the nth row. (n is 1-indexed)

Example

Given this grid

0 1 1 1
0 0 0 0
0 0 0 0

a D1 fold means "fold the entire top row down then unfold".

0 0.5 0.5 0.5
0 0.5 0.5 0.5
0   0   0   0

Then an R2 will produce

0.25 0.5 0.5 0.25
0.25 0.5 0.5 0.25
   0   0   0    0

and another R2 will not change anything.

Goal

Your goal is to write an algorithm that finds the best ink-spreading folding sequence for each of the four grids using exactly 8 folds each time. The folds may be any combination of Rs or Ds.

Scoring

The score of your submission is the sum of your scores for each grid. A grid's score is the sum of the absolute differences between each of its values and its average (its sum divided by its area). Lower scores are better. A score of 0 is perfect, but is probably impossible in only 8 folds.

You must report your four 8-step folding sequences with your code in your answer. This is so we can verify your algorithm really works.

Please put them in this form:

20*20R1D2R3D4R5D6R7D8
40*20R1D2R3D4R5D6R7D8
40*40R1D2R3D4R5D6R7D8
20*80R1D2R3D4R5D6R7D8

Here is a Python script that will calculate your scores given your folding sequences.

Naturally you should not copy someone else's sequence submission. Sequences for each grid only belong to the person who first created them.

Clarifications

  • Ideally your algorithm will work well on any grid, though you can tailor it to these specific ones.

  • You must submit your code with your sequence. To win you need the smallest-scoring set of 8-step folding sequences that has not already been posted, and also an algorithm that stands up to public scrutiny. Explain your code, don't obfuscate it.

  • The grid should never contain negative numbers.

  • Standard loopholes apply.

deleted 1596 characters in body
Source Link
Calvin's Hobbies
  • 90k
  • 46
  • 339
  • 555

Finding the best way to make these folds is your task in this coding challenge. This 40×20 gridThis Pastebin contains four different sized grids of ones and zeros. Each grid represents youra piece of ink splattered paper that you must turn grey. Zeros are paper and ones are ink.

1 1 0 1 0 1 1 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 1 1 0 1 0 1 
0 1 1 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 1 1 1 1 0 0 0 0 1 0 
1 0 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 1 0 0 0 0 1 0 1 0 
1 0 1 0 1 1 0 1 1 1 0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 0 0 1 
1 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 0 1 1 1 0 0 1 0 1 1 0 1 0 0 1 1 0 1 1 0 0 0 0 
1 1 1 0 0 0 1 1 0 1 0 0 1 0 1 1 0 1 0 0 1 1 0 1 1 1 1 0 1 0 1 0 0 0 0 1 1 1 0 0 
0 0 1 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 1 1 0 1 0 1 0 0 1 1 0 0 1 1 0 0 0 1 1 0 
0 1 0 0 1 1 1 0 1 0 0 0 0 1 1 0 1 0 0 1 1 0 0 0 1 0 0 0 1 1 0 0 0 0 1 1 1 1 0 1 
0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 0 1 0 0 0 1 1 0 1 0 1 0 1 1 0 1 1 1 0 1 0 1 0 1 1 
1 1 1 0 1 0 1 0 1 0 1 1 0 0 0 0 0 0 1 0 1 1 0 1 0 0 1 0 0 0 0 0 1 1 1 0 1 0 0 0 
1 1 1 1 1 0 1 1 1 1 1 1 0 0 1 0 0 1 0 0 1 0 0 0 1 0 1 1 1 0 1 0 1 1 1 1 1 1 0 0 
0 1 0 1 0 1 1 1 1 0 0 0 0 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 1 0 1 0 1 1 0 1 1 0 1 
0 0 1 1 0 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 0 0 0 0 1 1 0 1 1 0 1 0 0 0 0 1 1 0 0 0 
1 0 0 1 1 0 1 0 1 0 0 1 0 1 0 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 0 0 1 0 1 1 1 1 1 
1 0 1 1 0 0 0 1 1 0 1 1 0 0 0 0 1 1 1 0 0 1 0 1 0 0 1 1 0 1 0 0 0 1 0 0 1 1 0 1 
1 1 1 0 1 0 0 1 1 0 0 0 0 1 0 0 1 0 0 1 1 1 1 0 1 1 0 1 0 0 0 0 1 0 0 1 1 0 0 1 
0 0 0 1 1 1 0 0 1 1 0 1 0 0 1 1 1 1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1 0 0 0 0 
1 1 0 1 0 0 1 0 1 1 0 0 0 1 0 1 1 0 1 0 0 1 0 0 0 1 0 0 1 1 1 1 0 0 0 1 1 0 1 0 
0 0 0 1 0 1 1 0 0 0 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 1 1 0 1 1 1 0 0 1 1 
1 0 0 1 1 1 0 0 1 1 1 1 1 0 1 1 0 1 0 0 1 0 0 0 0 1 0 0 1 0 1 1 1 1 1 0 1 0 0 1 

OnlyIn these grids, only horizontal and vertical folds along the spaces between lines and columns are valid. When a fold is made the pairs of overlapping values are averaged. Folds are done one at a time and always unfolded. Folds only change the ink distribution, not the size of the paper.

Rn denotes folding the left edge of the grid to the right, starting after the nth column. Dn denotes folding the top edge of the grid downward fold, starting after the nth row. (n is 1-indexed, folds for n < 1 and n > row/column count are undefined.)

Your goal is to write an algorithm that finds the best ink-spreading folding sequence for each of the 40×20 gridfour grids using using exactly 8 foldsexactly 8 folds each time. The folds may be any combination of Rs or Ds.

The score of your submission is the sum of your scores for each grid. A grid's score is the sum of the absolute differences between each of your final grid'sits values and the grid'sits average (which is 0.5 in this caseits sum divided by its area). Lower scores are better. A score of 0 would indicate a 0.5 in every spot, which is optimal. The grid's current scoreperfect, but is maxed out at 400probably impossible in only 8 folds.

You must report your four 8-step folding sequencesequences with your code in your answer (something like R3 D14 R15 D9 R26 R5 R3 D5). I need it toThis is so we can verify that your algorithm does what it claimsreally works.

Please put them in this form:

20*20R1D2R3D4R5D6R7D8
40*20R1D2R3D4R5D6R7D8
40*40R1D2R3D4R5D6R7D8
20*80R1D2R3D4R5D6R7D8

(I will soon write a script that calculates a score given the four sequences.)

Naturally you should not copy someone else's sequence submission. Sequences for each grid only belong to the person who first created them.

  • It would be great ifIdeally your algorithm tried to optimizewill work well on any grid but, though you can tailor it does not have to. Optimizing the given 40×20 grid is the only requirement these specific ones.

  • You must submit your code with your sequence. To win you need the smallest-scoring set of 8-step folding sequencesequences that has not already been posted, and also an algorithm that stands up to public scrutiny. You should explainExplain your code, not obfuscate it.

  • Collaboration and working off of other people's ideas is encouraged, just don't be a jerk aboutobfuscate it. Give credit where credit is due.

  • The grid should never contain negative numbers.

  • All standardStandard loopholes apply.

Finding the best way to make these folds is your task in this coding challenge. This 40×20 grid of ones and zeros represents your ink splattered paper. Zeros are paper and ones are ink.

1 1 0 1 0 1 1 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 1 1 0 1 0 1 
0 1 1 1 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 0 0 1 0 1 1 1 1 0 0 0 0 1 0 
1 0 1 1 0 0 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 0 1 0 1 1 1 1 1 0 0 1 0 0 0 0 1 0 1 0 
1 0 1 0 1 1 0 1 1 1 0 0 0 1 0 1 0 0 0 0 0 1 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 0 0 1 
1 0 0 0 0 1 1 1 1 1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 0 0 0 0 
1 1 0 1 0 0 1 0 1 1 0 0 0 1 0 1 1 0 1 0 0 1 0 0 0 1 0 0 1 1 1 1 0 0 0 1 1 0 1 0 
0 0 0 1 0 1 1 0 0 0 1 1 1 0 0 1 1 1 1 1 1 0 0 0 1 1 1 0 1 1 1 1 0 1 1 1 0 0 1 1 
1 0 0 1 1 1 0 0 1 1 1 1 1 0 1 1 0 1 0 0 1 0 0 0 0 1 0 0 1 0 1 1 1 1 1 0 1 0 0 1 

Only horizontal and vertical folds along the spaces between lines and columns are valid. When a fold is made the pairs of overlapping values are averaged. Folds are done one at a time and always unfolded. Folds only change the ink distribution, not the size of the paper.

Rn denotes folding the left edge of the grid to the right, starting after the nth column. Dn denotes folding the top edge of the grid downward fold, starting after the nth row. (n is 1-indexed, folds for n < 1 and n > row/column count are undefined.)

Your goal is to write an algorithm that finds the best ink-spreading folding sequence for the 40×20 grid using exactly 8 folds. The folds may be any combination of Rs or Ds.

The score of your submission is the sum of the absolute differences between each of your final grid's values and the grid's average (which is 0.5 in this case). Lower scores are better. A score of 0 would indicate a 0.5 in every spot, which is optimal. The grid's current score is maxed out at 400.

You must report your 8-step folding sequence with your answer (something like R3 D14 R15 D9 R26 R5 R3 D5). I need it to verify that your algorithm does what it claims. Naturally you should not copy someone else's sequence. Sequences only belong to the person who first created them.

  • It would be great if your algorithm tried to optimize any grid but it does not have to. Optimizing the given 40×20 grid is the only requirement.

  • You must submit your code with your sequence. To win you need the smallest-scoring 8-step folding sequence that has not already been posted, and also an algorithm that stands up to public scrutiny. You should explain your code, not obfuscate it.

  • Collaboration and working off of other people's ideas is encouraged, just don't be a jerk about it. Give credit where credit is due.

  • The grid should never contain negative numbers.

  • All standard loopholes apply.

Finding the best way to make these folds is your task in this coding challenge. This Pastebin contains four different sized grids of ones and zeros. Each grid represents a piece of ink splattered paper that you must turn grey. Zeros are paper and ones are ink.

In these grids, only horizontal and vertical folds along the spaces between lines and columns are valid. When a fold is made the pairs of overlapping values are averaged. Folds are done one at a time and always unfolded. Folds only change the ink distribution, not the size of the paper.

Rn denotes folding the left edge of the grid to the right, starting after the nth column. Dn denotes folding the top edge of the grid downward fold, starting after the nth row. (n is 1-indexed)

Your goal is to write an algorithm that finds the best ink-spreading folding sequence for each of the four grids using exactly 8 folds each time. The folds may be any combination of Rs or Ds.

The score of your submission is the sum of your scores for each grid. A grid's score is the sum of the absolute differences between each of its values and its average (its sum divided by its area). Lower scores are better. A score of 0 is perfect, but is probably impossible in only 8 folds.

You must report your four 8-step folding sequences with your code in your answer. This is so we can verify your algorithm really works.

Please put them in this form:

20*20R1D2R3D4R5D6R7D8
40*20R1D2R3D4R5D6R7D8
40*40R1D2R3D4R5D6R7D8
20*80R1D2R3D4R5D6R7D8

(I will soon write a script that calculates a score given the four sequences.)

Naturally you should not copy someone else's sequence submission. Sequences for each grid only belong to the person who first created them.

  • Ideally your algorithm will work well on any grid, though you can tailor it to these specific ones.

  • You must submit your code with your sequence. To win you need the smallest-scoring set of 8-step folding sequences that has not already been posted, and also an algorithm that stands up to public scrutiny. Explain your code, don't obfuscate it.

  • The grid should never contain negative numbers.

  • Standard loopholes apply.

Made code submission required and advocated honesty
Source Link
Calvin's Hobbies
  • 90k
  • 46
  • 339
  • 555
  • It would be great if your algorithm tried to optimize any grid but it does not have to. Optimizing the given 40×20 grid is the only requirement.

  • Officially, allYou must submit your code with your sequence. To win you need to win is the smallest-scoring 8-step folding sequence that has not already been posted, and also an algorithm that stands up to public scrutiny. But I won't look too kindly on you if all you're doing is tinkering withYou should explain your code, not obfuscate it.

  • Collaboration and working off of other people's hard-earned solutions. This challengeideas is intended to inspire creativityencouraged, not underhandednessjust don't be a jerk about it. Give credit where credit is due.

  • The grid should never contain negative numbers.

  • All standard loopholes apply.

  • It would be great if your algorithm tried to optimize any grid but it does not have to. Optimizing the given 40×20 grid is the only requirement.

  • Officially, all you need to win is the smallest-scoring 8-step folding sequence that has not already been posted. But I won't look too kindly on you if all you're doing is tinkering with other people's hard-earned solutions. This challenge is intended to inspire creativity, not underhandedness.

  • The grid should never contain negative numbers.

  • It would be great if your algorithm tried to optimize any grid but it does not have to. Optimizing the given 40×20 grid is the only requirement.

  • You must submit your code with your sequence. To win you need the smallest-scoring 8-step folding sequence that has not already been posted, and also an algorithm that stands up to public scrutiny. You should explain your code, not obfuscate it.

  • Collaboration and working off of other people's ideas is encouraged, just don't be a jerk about it. Give credit where credit is due.

  • The grid should never contain negative numbers.

  • All standard loopholes apply.

Tweeted twitter.com/#!/StackCodeGolf/status/487198483531972608
Clarified that n is 1-indexed
Source Link
Calvin's Hobbies
  • 90k
  • 46
  • 339
  • 555
Loading
Source Link
Calvin's Hobbies
  • 90k
  • 46
  • 339
  • 555
Loading