« first day (1665 days earlier)      last day (3177 days later) » 

9:00 PM
@PeterTaylor I didn't know the correct terminology :P
 
90% of the difficulty in the Programming Languages Quiz seems to come from the fact that esolangs.org has lots of old forgotten junk on it. ;-;
 
@Mauris I don't think so. It doesn't support nested loops.
 
@PeterTaylor You would just need one enormous loop with lots of IFs in it, though.
I think it might work!
 
@MartinBüttner As the HW is essentially kolmogorov-complexity, I think non-programming languages should be allowed.
 
Haha, calling "Hello, world!" a challenge seems very cute to me, but it's technically correct.
 
9:06 PM
@PeterTaylor Maybe I should have said it's not intentionally descriptive. More like a self-fulfilling descriptivism ;)
 
Nominal determinism.
 
was the name "Pepsi" descriptive or self-fulfilling?
(in the beginning)
 
Hmm. I should change my name to UserWithTheMostRep if nominal determinism is a thing.
@Optimizer At least partially descriptive. I'm pretty sure the Pep comes from peptic.
 
@PeterTaylor Personally, I don't mind allowing a boring answer like that if it allows some other languages where answers are really interesting. For instance, it seems that it's not clear whether Malbolge is TC, and it's going to be hard to prove that you can test primality, but I'd hate to exclude it from the catalogue.
(If what I said about Malbolge is bullshit, I can go looking for another language.)
 
@MartinBüttner have you seen the CG chatroom...?
 
9:13 PM
If the goal of this challenge is to just be "where we put the Hello, World! programs" I don't think we'd even want to get rid of the boring answers tbh.
 
Would it be worth setting another challenge to find a very simple (if inefficient) way of testing primality that can then be used to check any language more easily?
 
@trichoplax now I have :D
 
I saw it before the announcement, so I thought it was all over. Emotional rollercoaster...
 
@Mauris Ok, I think primality testing is doable. But general Minsky machines can have arbitrarily large state machines, and I'm still not convinced that a finite number of temporary variables suffice to track the state with the limited looping and conditionals of Fourier.
 
@Optimizer Pepsi originally had pepsin in it (a stomach enzyme)
 
9:21 PM
@PeterTaylor Well, they're finite state machines. So your state is just a single integer, and you write: state = 1; while (state != 0) { if (state == 1) { ... }; if (state == 2) { ... }; ... }, right?
Also, people write papers about Malbolge, and it's amusing.
 
@AlexA. Hey that makes two of us :)
 
Here's another one, that infamously spawned a working "99 bottles of beer" program
 
Isn't there a circle of programmers' hell where people are made to write papers about Malbolge?
 
I don't know how serious IPSJ-SIGPRO is, but this group gave a serious-looking talk on Malbolge at it, and that's amazing.
 
@Mauris That's fine for the increment states, but for the decrement ones you need nested ifs, and that's not supported.
(Either that or an && operation, but I don't see that either)
No, wait. Ok, it can be done using double-increment and compare to 2.
 
9:29 PM
Ugh, what a dilemma... I know what one of the cops on the quiz is, but I only figured it out because it's the author's own language, and I know his user name on esolangs, and I only know that because I personally showed him the challenge ... :/
 
@PeterTaylor Huh, I don't really see it, but that sounds like a cool plan. Could you elaborate?
 
@MartinBüttner Tell someone else in secret, let them get upvoted for it, transfer in bounty to you. No appearance of corruption, dilemma solved :P
 
@MartinBüttner Good robbers case their target.
 
bait
 
Needs a small tweak. if (state == 2 && x == 0) state = 5; else if (state == 2) { x--; state = 17} becomes c = 0; if (state == 2) c++; if (x == 0) c += 2; if (c == 1) { x--; state = 17; } if (c == 3) state = 5;
 
9:52 PM
yay I solved one :)
 
Someone other than me has written a program in pb \o/
 
For which question?
 
no
it wasn't on this site they just dropped it in the talk page on esolangs
 
Oh, cool!
 
exciting :D
 
9:57 PM
That's quick, I don't think anyone has done it for Stuck :P
 
the problem is that it was a program that looped infinitely and until just now the interpreter didn't output until the program was complete :P
 
Yes, I can see that being an issue :P
 
Vioz-: Psh, hey, I wrote 4 whole bytes of Stuck. :)
 
Fun fact about pb: nested loops are implemented with recursion. Enough nested loops will hit python's recursion limit :P
 
@undergroundmonorail The looping sounds like it's implemented the same way it is in java regular expressions.
 
10:11 PM
when the tokenizer is doing its thing, it detects loops and just doesn't parse the code inside it at all
then when it's about to be executed, that code is just sent to the tokenizer on the spot
 
@undergroundmonorail That's how Snowman works too.
 
Then it's not :(
 
10:29 PM
But it prints... why does it matter... ( ╯°□°)╯ ┻━━┻ — aditsu 50 secs ago
@aditsu ( ╯°□°)╯ ┻━━┻
 
>_>
 
@MartinBüttner So... programming challenge sites in general as well?
(I haven't really been active in that many, but I can try :P)
 
10:56 PM
I'm a bit curious, is there a way to log out on all devices instead of just the one I'm currently using?
 
11:11 PM
log out of?
 
@Justin Isn't that what the standard log out does?
 
It claims not to be
 
@Optimizer No, "on" makes sense.
 
It says "Clicking Log Out will log you out of the following domains on this device:"
 
@Doorknob log out of gmail vs log out on gmail.
 
11:13 PM
on this device
 
Oh, huh. It used to be all devices. It's changed.
So have you, @UsedToBeQuincunx. :P
 
Yes :)
So have I ? What does that mean?
 
@Optimizer Yes, but you can [x] on one device, or you can [x] on all devices.
@Justin You previously had the username Quincunx, right?
 
Yes
 
@Doorknob dude. I meant, "of" makes sense too, if you talk about a website instead of device
 
11:15 PM
@Optimizer But "log out on all devices" is correct.
 
@Doorknob I never said anything about that.
 
@Optimizer Yes, "of" makes sense too, but it could be misinterpreted to logging out on my machine instead of logging out of the website on the device.
Also I didn't think of the word "of" when I asked that question
 
@Justin Answerer checks out; he's a chronic username/profile picture-changer. :P
 
Which answerer?
Not Kevin, of course
 
The one who is currently known as Normal Human but has been known to have 20+ previous names.
 
11:21 PM
I didn't know that xD
 
0
A: Sandbox for Proposed Challenges

pawel.boczarskiRec(ursion)less execution We have a simple (non-Turing complete) language. Each line of program is a set of terms separated by single space. Some of terms (ending with ()) are function calls. Some lines (whose first term ends with :) are function definitions. The lines that are not function def...

 
What is a good way of implementing pieces in Chess? My first thought was inheritance because inheritance just makes sense for it, but then as I was implementing my board, I discovered I kept having to use instanceof (Java) to check for Kings or Pawns since they have special behaviour.
I ended up switching to Enums.
But I'm not sure if that's a good idea either since there is inherent inheritance in here.
 
@Justin Instead of a bunch of instanceof checks, just call an abstract method, and implement it differently for Kings and Pawns.
 
@Justin Keep the inheritance, and have a getPieceType() or similar public method which you override for each piece?
That could return an Enum.
(Not sure whether "override" is the right word there; haven't done Java in a while)
 
@Mauris That was my original intent. But there's en passant and the like, which can't be cleanly implemented through inheritance (or I haven't yet invented a way to do so).
Perhaps I can do something like this: stackoverflow.com/a/562852/1896169
@Doorknob Or better. Since it's a bunch of boilerplate to add an override for each piece, let's just use reflection to figure it out. (Actually a really bad idea... I like reflection a bit too much)
 
11:37 PM
Give pieces a hitbox() method returning a List<Coordinate>. For almost all pieces, it returns the singleton list that contains their own position; for a pawn that jumped two ranks in the last turn, it contains its own position and the one it jumped over.
Then in the capture logic for other pieces, find all enemy pieces whose hitbox() contains the square being captured on.
 
Ahh but only pawns can capture pawns through en passant
The idea is I give my Piece base class a List<Coordinate> getMoves(Board board) method and each class overrides that. Each piece also has a location and a color, and can be taken, etc. The problem is the special rules regarding Pawn-Pawn interaction and King-Rook interaction (and dealing with check)
 
if (PieceTypeFactory.getInstance(PieceTypeFactory.DEFAULT_INSTANCE).createBuilder(PieceTypeFactory.Builder.PIECE_TYPE_BUILDER).setPiece(piece).getPieceType().type == PieceTypeFactory.getPieceTypes(PieceTypeFactory.DEFAULT_INSTANCE).PAWN) {
   ...
}
 
Hahaha
 
Yikes
 
Oh, Java. <3
 
11:40 PM
:)
This probably warrants some static imports
 
Oh, there's already plenty of those of course. ;)
 
import static PieceTypeFactory.DEFAULT_INSTANCE
 
If the hitbox() depends on whether the capturer can capture en-passant, try:
public abstract List<Coordinate> hitbox(Piece capturer);
Then in the implementation for Pawns:
 
The real class is Codebase.Java.Code.AllFiles.Chess.ChessEngine.Implementation.Board.BoardInterna‌​ls.Pieces.PieceTypeFactory, of course.
 
if (jumpedLastTurn() && capturer.canCaptureEnPassant()) { return this position and the one jumped over; } else { return this position; }
Of course, for Pawns that canCaptureEnPassant method will be return true; and for everyone else it'll be return false;.
@Justin The trick in the OOP train of thought is to ask: what can this Piece do? as opposed to what specific kind of Piece is this?
 
11:45 PM
Okay that really helps. ... except my code was so much smaller when I did it Enum style...
 
The former leads to nice methods like canCaptureEnPassant(), which describe behavior, as opposed to ugly checks involving isinstance
 
Okay
 
This does feel a bit roundabout, yeah! And it's because a more "human" description of the rules of chess talks about pawns concretely, as opposed to "pieces that can be captured en-passant" and "pieces that can capture en-passant".
But using this kind of writing, all of your board logic knows nothing about the kinds of pieces that exist, which is a very nice thing in OOP!
 
@Mauris Implement check. That's a lot harder if my board doesn't know at least the two Kings. Likewise checkmate.
 
Chess is best implemented with a bunch of ints and C code full of bit hacks :P
 
11:50 PM
And of course there's the 50 move rule
 
Chess is best implemented with a beer.
 
Chess is best implemented with a chessboard and two humans.
 
I prefer beer to chess and human contact.
 
I'm sorry.
 
:P
 
11:52 PM
Chess is best implemented with explosions. :P
 
Haha
 
Again, try to generalize: instead of "if this player's King is in check", implement the rule as "if any of the player's pieces are in check".
 
Chess is best implemented on a rollercoaster.
 
@Mauris Yes, isUnderAttack or something similar. The thing is that when a King is under attack, there are special things that should be done.
Like disallowing any move that doesn't take the king out of check. Or disallowing any move that puts your king in check.
Chess is best implemented with a butterfly
 
Right! player.inCheckBy(enemy) just ORs together piece.inCheckBy(enemy) for all pieces; piece.inCheckBy(enemy) returning false for non-Kings and ORing together each enemyPiece.canAttack(piece) for Kings.
 
11:56 PM
@Mauris It seems silly to disguise a check for the type of a piece under a method.
 
Chess is best implemented with human chess engines. In a Stack Exchange chatroom. </plug type='shameless'>
 
@Justin It totally does, at first. It gets less silly the more your get brainwashed by OOP, and then it starts to seem like "just another way of doing things" :)
 
This is why I should program in Ruby. Then I wouldn't feel obliged to follow OOP so strictly.
 

« first day (1665 days earlier)      last day (3177 days later) »