« first day (3195 days earlier)      last day (1651 days later) » 

1:52 AM
0
A: Sandbox for Proposed Challenges

bigyihsuanFollow the Path Tags: code-golfpath-findingdecision-problemascii-art I got directions to my friend's house, but it looks like his map might have some mistakes. He's expecting me soon, so I need some short code to figure out if I can get there. The Challenge Write a full program that, when giv...

 
 
2 hours later…
3:34 AM
0
Q: Find the shortest route on an ASCII road

Redwolf ProgramsYou want to find the length shortest path between two points, on an 2d ASCII "map". The roads are made up of + characters, and the two endpoints are represented by #s (not counted in the length). This road can be arranged in any way, and any other characters can be ignored. You can assume the end...

 
4:17 AM
0
Q: Who's Who in the Name-Change Game?

riggedVery recently, I changed my SE username because I made this account some years ago and wanted to get back into asking questions. However, I’m still planning to post questions and potentially earn votes. We can imagine a site that has some issues dealing with name changes. The problem: given a lis...

 
4:59 AM
0
Q: Play the card game "Set"

jnfnt"Set" is a card game played with a deck of 81 cards, twelve of which are pictured below: Each card has four attributes, each of which may assume three values: Number: the number of symbols, either 1, 2, or 3 Shape: the shape of the symbol, either squiggle, diamond or oval Colour: either purp...

 
5:21 AM
0
A: Sandbox for Proposed Challenges

BubblerIs this a valid input for this hardware? code-golf decision-problem The (slightly harder, but still relatively easy) sequel of Generate input for this hardware. I have a hardware that has a 32-bit input register. The register has the following characteristics: The 32-bit register consists of ...

 
 
3 hours later…
8:13 AM
    Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> f=filter(None, [0,1,2])
>>> list(f)
[1, 2]
>>> list(f)
[]
>>>
That's pretty messed up.
How can threads cause exit() to not work in Python 3?
I called exit from the main thread, and all the other threads are marked as daemon.
Wait, I lied. I called exit from a daemon therad.
os._exit it is then.
 
For the first thing you posted, it is weird that filter generates a stateful generator instead of something that's just lazy
you'd expect it to be an object that gives you something stateful if you call iter on it but instead that just makes it return itself
 
0
A: Sandbox for Proposed Challenges

BubblerArea of diagonal-folded regular polygon code-golf math geometry Description coming soon™.

 
 
1 hour later…
9:34 AM
0
Q: Tag Proposal: value-code-golf

A _I propose to create a new tag about value-code-golf, where submissions are scored with their ASCII value sum instead of their length. This is inspired by this challenge. I guess this scoring method will potentially be common; I guess the tag code-golf is insufficient to describe this type of cha...

 
10:11 AM
1
A: Sandbox for Proposed Challenges

A _Does my Keg program generate an error? code-golf keg string interpreter Today's task is real simple: write a non-erroring program that, given a non-extended Keg program input, prints whether the program errors. Keg errors that you are expected to check Here is a complete list of possible Keg e...

 
10:51 AM
0
Q: Totally Blind Chess

feersumIn this challenge, you play chess without seeing any of your opponent's pieces or moves. Or your own pieces. Or whether your own moves succeeded. You send only a stream of moves, with no feedback. If your move is legal (when it is your turn) it will be played, otherwise it is silently discarded. ...

 
11:32 AM
-4
Q: Solution unclear. Need further explanation on google kick start 2019 round A second problem

SpiderMonkey69https://codingcompetitions.withgoogle.com/kickstart/round/0000000000050e01/000000000006987d I can't understand the part with the formula under the explanation of test set 2. Can someone explain it better? Thanks

 
 
2 hours later…
1:44 PM
hiya
does anyone understand why q(x-1)x = 2q -qx in imgur.com/a/lW69LAv ? it's part of a proof that root 2 is irrational
 
It's ... sideways. I can't read sideways.
 
^, cbf
 
@Anush Reminder that x² = 2
That’s the starting hypothesis of the proof by contradiction
 
2:12 PM
@feersum Regarding blind chess, if my instruction is to move a piece across the board, but there is a piece in the way, I assume the move is skipped as invalid? As opposed to "doing as much as it can" (capturing the intervening piece and stopping)?
 
@BradC Like rook a1 going to a8 and there's an opposing piece on a5?
 
@Veskah Right. Cause it would be nice to send the queen bashing through the opposing ranks, but I need to know whether to go long, or to tiptoe
In reference to feersum's new challenge:
10
Q: Totally Blind Chess

feersumIn this challenge, you play chess without seeing any of your opponent's pieces or moves. Or your own pieces. Or whether your own moves succeeded. You send only a stream of moves, with no feedback. If your move is legal (when it is your turn) it will be played, otherwise it is silently discarded. ...

 
heh, I really like the fact you can think you're bashing through the ranks but your queen got captured 8 moves ago
 
I'm thinking that normal chess strategy is almost irrelevant here; because setting up traps and counters and positions and stuff just doesn't mean anything; I'm thinking send your queen and rooks and stuff bashing indiscriminately through enemy ranks
But there is a major unanswered question in the comments: do you actually have to checkmate your opponent? Or just capture the king through random moves?
I'm thinking a checkmate might actually be very difficult to ensure, totally blind
 
2:30 PM
@BradC But you won't even know if you still have queen and rooks!
 
@Adám Not for sure, no, but in the very early game you can probably get pretty far, unless you're dealing with an opponent written specifically to counter your strategy
So, push King's pawn, move queen to far column, capture rook's pawn, capture rook, capture knight, capture bishop, etc...
 
Are there no nukes available in chess?
Or do you need to buy those as extra DLC?
2
 
@flawr coming soon, Spring 2020
pre-purchase now for an exclusive skin
 
What would the six chess pieces be for modern warfare?
 
2:45 PM
Drone
 
Drawing from the USA's military here, and mostly focusing on relative power: King = President, queen = aircraft carrier, rook = fighter aircraft, bishop = battleship, knight = submarine, pawn = tank.
 
Queen should be ICBM
 
@BradC Capturing the king is not allowed. If capturing the king is possible, you won't get a turn until the opponent makes a valid move putting the king in safety
Actually checkmating would be nearly impossible, so I suspect most wins will come from getting close enough to mate that the opponent stops making valid moves and breaks the 2000 move rule
 
@DJMcMayhem That's one possible way of running the tourney, I guess we'll have to see how @feersum wants to do it. Personally I think that option is more tedious and less interesting than "ignore the normal rules around check, just whoever captures the opponent's king first wins"
 
3:02 PM
@BradC That's the way it's currently written though. Any illegal move attempts will be skipped. When it is your turn, the controller will keep reading lines until it finds a valid move. A player who makes 2000 consecutive unsuccessful move attempts shall forfeit the game.
 
@Fatalize thanks!
 
@DJMcMayhem yeah, I see that. And you're right, if you've trapped the opponent so they only have one legal move, then it's somewhere between possible and likely that they won't generate that move in the next 2000 turns.
Which still leaves the "get your queen across the board and create as much damage as possible" idea as a very viable strategy
 
Agreed
 
@Veskah I did consider that. Hmm, that's basically the President's offensive power, isn't it? Doesn't really work with regards to reach but then again nothing else does because chess was developed at a time where warfare was mostly two land armies clashing on a field and modern warfare is verrrry different.
@DJMcMayhem It just occurred to me that the total number of possible moves across all configurations is actually right around 2000. E.g. the queen has no more than 24 possible moves on any square, so the total number of possible moves for a queen is no more than 24 * 64 = 1536.
I think it would technically be possible (or nearly so) to run through every single potentially-legal move in a single turn without forfeiting.
 
3:25 PM
@BradC The problem is: how do you know where your queen is? If you do a wrong move with it, you don’t know it
 
@Fatalize Yep. Close your eyes and cross your fingers, and hope they didn't push the wrong pawn
 
Or, just alternatively try moves assuming it worked and assuming it didn’t
 
Right. Or push your side pawns, and send across both Rooks, in alternating moves. One might be blocked and would end up with invalid moves, but perhaps not both
 
@El'endiaStarman But you don't know where a certain piece is, so you'd have to try every configuration for every piece, which is definitely over 2000
 
3:31 PM
It’s over 2000!
2
Doesn’t have the same ring to it
 
@DJMcMayhem Even so, I think it's still not that much higher.
 
(anti-factorial joke barrier)
 
@Fatalize sad trombone
 
@El'endiaStarman Queen has 24 * 64, rooks have 14 * 64. Just that is 2432
 
@DJMcMayhem There are only 64 spots on the board, and 2000/64 = 31.25. And there are definitely not 31 valid moves from every spot, even for a queen
Plus, you don't necessarily have to cycle through all the far moves, likely that a closer one will still be valid
Perhaps you might not know whether a spot contains a knight, so that would add up to 8 more possible destination spaces
 
3:35 PM
if a(0) = 0, a(1) = 1; for n > 1, a(n) = 2*a(n-1) + a(n-2) .. any idea what a(n) is in big Oh notation?
 
@DJMcMayhem duh, 14 of those moves are the same lol
 
ngn
@Anush O((1+sqrt(2))^n)
 
@ngn Oh! Thanks so much
that's very clever :)
 
ngn
don't trust me, i'm just guessing :)
 
@BradC You make a really good point there. However, it fails in a couple very subtle way with regards to implementation. 1) A queen may not have more than 24 moves from any spot, but it may be in any spot, hence the 24 * 64. This is also true for all other pieces. 2) One could perhaps keep track of where pieces may or may not be, and this will eventually grow large enough to break 2000.
 
3:40 PM
@ngn I think you are right!
how did you guess it?
 
Really, there is an absolute max of 64 * 63 = 4032 moves, from any square to any other square.
 
ngn
@Anush computed the first few a(i) and the ratios a(i)/a(i-1), and i noticed they converge to a familiar constant
 
@ngn very nice.. and now I have found proof you are right
In mathematics, the Pell numbers are an infinite sequence of integers, known since ancient times, that comprise the denominators of the closest rational approximations to the square root of 2. This sequence of approximations begins 1/1, 3/2, 7/5, 17/12, and 41/29, so the sequence of Pell numbers begins with 1, 2, 5, 12, and 29. The numerators of the same sequence of approximations are half the companion Pell numbers or Pell–Lucas numbers; these numbers form a second infinite sequence that begins with 2, 6, 14, 34, and 82. Both the Pell numbers and the companion Pell numbers may be calculated by...
 
@El'endiaStarman unless you factor in that every piece moves like a queen (but not as far) or a knight.
 
@DJMcMayhem ...huh, the queen and knight are the only ones that matter. Since moves are entirely specified by start/end square and the rook, bishop, and king have a subset of the queen's moves.
 
3:42 PM
@El'endiaStarman I think at some point in the game (not sure when) doing that level of piece tracking is going to fail, and you'll have to instead fall back to a more agnostic routine
 
@DJMcMayhem Right, the total number of possible moves must be less than 4032.
 
So 32 * 64 is 2048, which is a very generous estimate since a lot of squares have less than 8 Knight moves
 
Right. So it is possible to send all legal moves within the 2000 limit.
 
@El'endiaStarman Pawns moves, too, are a (smaller) subset of queen moves
 
@BradC Ohh right, lol, forgot about the pawns... But yes, also a subset.
 
3:44 PM
Come on, people, this is a programmer's chat room! We can't write a little script and come up with the real answer??
First one with the real number gets.... my hearty congratulations
 
It's more fun to do it by hand!
 
That could be a good KC. Output a list that is guaranteed to contain at least one valid move on an unknown board
 
Plus, there's motivation to find neat shortcuts/tricks when doing it by hand/mentally. E.g. only 10 squares in a triangle shape are important because the rest of the board can be mirrored from them.
A queen's moves are composed of a rook's moves and a bishop's moves, which are independent from each other, and thus easier to calculate separately.
A rook's moves are easy to calculate: it has 14 at all times (7 horizontal, 7 vertical).
 
rook is easy: there are always 14 possible moves
Bishop ranges between 7 and 13, depending on how close to the center it is
outside ring of the board is 7, next ring is 9, next ring is 11, inside 4 spots are 13
 
Right, so there are 28*7 + 20*9 + 12*11 + 4*13 = 560 total bishop moves, along with 64*14 = 896 rook moves, for a total of 1456 queen moves.
 
3:56 PM
No, I get 560 bishop moves
My grand total of rook (896) + bishop (560) + knight (335) = 1791
 
Oops, I should've had 4*13 not 8*13.
Lemme see if I get the same knight count.
 
So yeah, looks like you could include a way of ensuring you never have 2000 consecutive invalid moves. Unclear whether that would be a winning overall bot
 
4*2 + 8*3 + 20*4 + 16*6 + 16*8 = 336, my result almost agrees with yours. Total is actually 1792.
 
@El'endiaStarman yep, had a typo, entered 2 where I should have had a 3
Here's my spreadsheet, for reference:
 
That's pretty sweet.
 
4:04 PM
Man, having a blind en passante move succeed would be sweet
 
That would be hilarious.
Wait a minute. The rook has the same total number of moves as bishop and knight combined!
 
crazy how nature do dat
 
Let me throw a loop in here: the rules of the challenge state that a pawn that advances to the last rank will be promoted to a queen, unless a different pieces is explicitly listed with the move.
Are there scenarios where promoting a pawn to a knight is the only possible way to get out of check?
Seems not, at least on the same move as the promotion
 
Anyway, 1792 = 2^8 * 7, so there are (2^8 - 2^7) * (7 - 1) = 768 integers relatively prime to 1792, thus 768 independent arithmetic progressions through all the moves. One could write a bot that goes through 1792 moves in 768 different sequences.
 
Even if it were, you'd only have to account for 8+7+7=22 extra moves
 
4:12 PM
@BradC I bet there's some wacky scenario where promoting to knight would checkmate the opponent, thus "getting you out of check" by winning the game.
 
@BradC Surely not. A queen/rook/bishop/knight all block the same
 
Yeah, they might cause a change in the next turn, but not on the current one.
 
I've always thought it's dumb that there's an option to promote to weaker pieces.
 
@BradC Not sure how you get that. You know what color you are and there are 8 different ways for a pawn to move into promotion, times 4 different pieces to promote to which is 32 total.
 
@AdmBorkBork Don't think you can get out of check by putting your opponent in check
 
4:13 PM
If it's mate, though
 
@DJMcMayhem There are scenarios where promoting to a weaker piece either enables checkmate soon after or avoids stalemate.
 
No (to Adm, not to El)
 
@AdmBorkBork nope, doesn't matter.
 
@El'endiaStarman Sure, but there's never a scenario when you'd want a rook/bishop instead of a queen...
Oh wait avoid stalemate. Huh I never thought of that
 
I don't understand how that doesn't matter. If I promote to knight and that puts the opponent into mate, I've won the game.
 
4:15 PM
@AdmBorkBork As long as you're not in check after the move is made
 
@AdmBorkBork If you are in check, you must not be in check after your move. If this is not possible, then you are in checkmate.
 
Oh, durr
I are smrt
 
@El'endiaStarman I was figuring the "promote to Queen" was (by default) already included in the 1792 existing moves, and was adding the 22 ways (8 moves, 14 captures, 7 each side) to get your pawns onto the back rank, presuming that "choose a knight" was the only move usefully distinct from "choose a queen", which is a superset of bishop/rook
 
@BradC Ohhhh right, it's possible to capture into a promotion. Also right that some options are already covered. Still, that should be +22 * 3 because you can promote to a knight, bishop, or rook, even if these are not particularly useful.
 
@El'endiaStarman For example, promoting to a queen here, would stalemate, but promoting to a rook is mate in 2: lichess.org/analysis/standard/8/k1P5/2K5/8/8/8/8/8_w_KQkq_-
 
4:18 PM
@El'endiaStarman True, if you want to be entirely exhaustive. So 1792 + 3 * 22 = 1858.
which is still under our 2000 move limit
 
CMC: What's the fewest number of pieces you can put on the board where "the best move" (given by stockfish) is to promote a pawn to a bishop?
 
63
 
But the truth is that you're not going to find a scenario where only one of those promotion options is legal, even if something other than a queen happens to be best (via contrived scenario)
 
Code Golf & Chess Chat
 
And remember our context here is trying to ensure we don't lose to the 2000 move rule
 
4:22 PM
I can find a scenario where a bishop is mate in 2, and queen/rook is stalemate, but unfortunately in that scenario there's a different move for mate in 1
 
@DJMcMayhem Did it with 4 pieces, mate in 2. lichess.org/analysis/standard/7R/k2P4/2K5/8/2B5/8/8/8_w_-_-#0
And it meets the other criteria of queen/rook = stalemate and there isn't a mate in 1.
 
I'm not sure traditional chess mate puzzles are going to help. At that point in the game, its just as likely that you'll step your king back or move your rook to a random rank
Since you have no visibility on the board
 
Oh yeah, all strategic rules of chess go out the window.
 
Which is why I originally asked about "do normal check rules even apply or do we just keep moving until someone captures a king?"
 
@BradC Correct. The move is not executed unless the full move is valid.
@BradC You do have to checkmate. Moves that leave your own king in check are rejected as illegal.
 
@feersum I recommend specifying that your controller is using the python-chess library so you're not the one making the (chess) rules.
 
@El'endiaStarman Right. It happened to do exactly what I wanted though :)
 
5:14 PM
@feersum Indeed. I meant specifying it in the challenge to head off similar further questions about what is or isn't possible/legal/etc.
 
 
1 hour later…
6:28 PM
@feersum Thanks for clarifying everything. I'm curious to see how often bots stumble blindly into checkmates, or if more matches end in stalemates or draws due to the 100-move rule
 
6:49 PM
0
A: Sandbox for Proposed Challenges

AdmBorkBorkIt's slashing time code-golf date (Inspired by Seven Slash Display) You're lying in bed, awake. Sleepily, you turn your head to the alarm clock and read what time it is. Since you're lying down, the clock is facing diagonally, making it difficult to read. You decide to write a program to help ...

 
7:08 PM
@Veskah Are you asking if alternate dot placement is allowed, or that I should move where the dots are to be more aesthetically pleasing?
 
The former
I mean, roll with the latter if you think it looks better
 
I guess I'm ambivalent if the dots move or not. Do you think that improves the challenge, allowing the person to choose where the dots are?
 
Off the cuff, I'd say majority of languages won't benefit but there might be some weird golf lang that can employ it
 
OK, that's easy enough to add in. And yes, it'll always be a valid time. Input validity parsing sucks.
 
I figured as much but never hurts to stave off the question
Oh, I guess one question is the left margin when there's a leading 1.
Should it hug the left margin? Should it always include the 1 space?
What should I do if my clock reads 99:99? :^)
 
7:19 PM
If your clock reads 99:99, you should either find a new clock or stop time traveling.
2
I've added a rule that you can pad with whitespace as necessary.
 
 
4 hours later…
11:12 PM
o/ I've taken up the challenge of golfing in haskell and I'm applying the finishing touches, is it ok to just give a function that takes the input as opposed to a whole programme?
 
yeah
 
that's pretty much standard except for some weird challenges
also with haskell in particular it can often be shorter to not even bind the function to anything and just write a pointfree expression
well for some languages function definitions can end up longer than full programs but the point is it's always an option
 
@Dignissimus-Spammy When a challenge reads "write a program to...", it's generally accepted to mean either a function or a full program
 
11:46 PM
Thanks all
 

« first day (3195 days earlier)      last day (1651 days later) »