It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
I still can't get over how awesome the last one was! Wishbone, you gotta do another!

Please!

Pretty please!
avatar
Alaric.us: I still can't get over how awesome the last one was! Wishbone, you gotta do another!

Please!

Pretty please!
[url=https://en.wikipedia.org/wiki/Wishbone_(TV_series)]Wishbone[/url] did programming puzzles?
avatar
kohlrak: Wishbone did programming puzzles?
This man: https://www.gog.com/u/Wishbone
Post edited June 06, 2018 by Alaric.us

Wishbone did programming puzzles?
avatar
Alaric.us: This man: https://www.gog.com/u/Wishbone
Well, for a lame one, since you said about not using PHP, find a way to make the original url work, and ~, and the funky other letters. That should keep you busy for about 5 minutes. 10 if you write the conversion yourself.
low rated
avatar
kohlrak: Well, for a lame one, since you said about not using PHP, find a way to make the original url work, and ~, and the funky other letters. That should keep you busy for about 5 minutes. 10 if you write the conversion yourself.
No, I want an actual clever puzzle. Fixing GOG is something I offered to do before, but that would basically involve rewriting this horrendous mess of a forum from the ground up. And since there are already excellent open source solutions, which GOG is apparently not interested in ... yea.
avatar
kohlrak: Well, for a lame one, since you said about not using PHP, find a way to make the original url work, and ~, and the funky other letters. That should keep you busy for about 5 minutes. 10 if you write the conversion yourself.
avatar
Alaric.us: No, I want an actual clever puzzle. Fixing GOG is something I offered to do before, but that would basically involve rewriting this horrendous mess of a forum from the ground up. And since there are already excellent open source solutions, which GOG is apparently not interested in ... yea.
No, a redirector. A practical problem, actually, but not a hard one. Alot of other forums also have this trouble, believe it or not. Replacing tinyurl with something a little more safe for people to read the url before clicking it would actually be somewhat practical.

But, if you must. Most a simple puzzle that most coders can't pull off is trying to write a single line function that returns 1 if the number is odd, 0 if the number is even (assuming all positive numbers). Strange puzzle, i know, but there's a lesson in it.
low rated
avatar
kohlrak: But, if you must. Most a simple puzzle that most coders can't pull off is trying to write a single line function that returns 1 if the number is odd, 0 if the number is even (assuming all positive numbers). Strange puzzle, i know, but there's a lesson in it.
That's some REALLY junior shit. =)

const evenOrOdd = num => num % 2 === 0 ? 0 : 1;
avatar
kohlrak: But, if you must. Most a simple puzzle that most coders can't pull off is trying to write a single line function that returns 1 if the number is odd, 0 if the number is even (assuming all positive numbers). Strange puzzle, i know, but there's a lesson in it.
avatar
Alaric.us: That's some REALLY junior shit. =)

const evenOrOdd = num => num % 2 === 0 ? 0 : 1;
Junior? I've seen temp files in released games already. I was looking for "&=1;" but that'll suffice, too (you didn't really need the conditional operator, either). You're already smarter than the average bear. Puzzles aren't my forte, but i like to provide practical problems. For something similar, but harder, try printing out the number in binary using the largest non-floating point datasize available in the language you're using, allowing for negative numbers, but not allowing for negative in binary representation (in other words -1 appears as 0b1...1, where ... is omitted 1s). That tends to get people screaming at their programming language. Me included. Doesn't have to be on one line.
low rated
avatar
Alaric.us: That's some REALLY junior shit. =)

const evenOrOdd = num => num % 2 === 0 ? 0 : 1;
avatar
kohlrak: Junior? I've seen temp files in released games already. I was looking for "&=1;" but that'll suffice, too (you didn't really need the conditional operator, either).
How would "&=1;" work in JavaScript? But yes, you are absolutely right, the conditional is unnecessary. I typed it out explicitly because we often ask a similar question but instead reverse the 0 and the 1 in terms of what we ask in the output.
Post edited June 06, 2018 by Alaric.us
Here is a two-part one:

1. Re-implement the gets() function from the C standard library in Rust. Your implementation must be callable from C using the usual prototype, and must be as secure as the C version.

2. In Rust, write a safe wrapper for the C gets() function. When called from safe rust, it must not be possible to violate menory safety. You must actually use the gets() function to read the input; no using other functions to do so.
avatar
kohlrak: Junior? I've seen temp files in released games already. I was looking for "&=1;" but that'll suffice, too (you didn't really need the conditional operator, either).
avatar
Alaric.us: How would "&=1;" work in JavaScript? But yes, you are absolutely right, the conditional is unnecessary. I typed it out explicitly because we often ask a similar question but instead reverse the 0 and the 1 in terms of what we ask in the output.
Sorry, i iddn't catch that it was JS. Next time, i shall consult the guide.

Believe it or not& and | as bitwise ops actually exist in javascript. You can even use ^ for XOR. I wrote a VM in javascript for a macro assembler i was working on. I was thoroughly surprised what javascript could and could not process.
Yo Alaric, I once got one of your Goldmine key and must say that I simply enjoyed it.
avatar
dtgreene: Here is a two-part one:

1. Re-implement the gets() function from the C standard library in Rust. Your implementation must be callable from C using the usual prototype, and must be as secure as the C version.

2. In Rust, write a safe wrapper for the C gets() function. When called from safe rust, it must not be possible to violate menory safety. You must actually use the gets() function to read the input; no using other functions to do so.
Nah. I'm not gonna go and learn Rust or look into C (which I haven't touched for like 20 years) just to do a puzzle. Wishbone did one that could be solved in any language. It was like an awesome quest, with multiple stages that were all distinct.
avatar
zlaywal: Yo Alaric, I once got one of your Goldmine key and must say that I simply enjoyed it.
Glad you liked it! =)
avatar
kohlrak: Believe it or not& and | as bitwise ops actually exist in javascript. You can even use ^ for XOR.
Yea, JS does have bitwise but it's generally very much recommended to avoid using them.

Heh, so I just asked around the office, and none of the other senior devs have actually ever found a problem, to which the solution would be using bitwise in JS. Some of us used them to show off and be clever or to troll applicants during interviews. =) I guess this is because of what JS is currently used for, that being frontend and backend, but never anything low level where you could actually benefit from the speed increase. Oh and none of the mid and junior devs actually knew what bitwise were.
Post edited June 06, 2018 by Alaric.us
avatar
Alaric.us: <snip>
I can give you a programming / maths one if you fancy a challenge:

With a function provided that generates purely random numbers (I know - impossible, but pretend and just use whatever the rand function is in JS), write a class that can be given more and more randoms, and with each one output an approximation of pi, getting more accurate as more random numbers are provided.

The answer can be trivially looked up, but if you don't know the technique, have a play about, or ask for more clues.

I don't fully know JS lingo nowadays, but class & object tend to get mixed up from my memory, what I mean is something that will store state (i.e. remember the numbers it has already been given). Back when I was doing OO javascript it was still using that prototype crap.
Post edited June 06, 2018 by wpegg
Here is another one, which can be done in any language that supports floating point numbers. Actually, here are three of them. One rule for these two challenges: You may not assume anything about the size of the floating point values, or how many bits are used for each part of the number. In particular, your solutions must continue to work if the size of the float changes.

1. Find the smallest positive float x such that x == x + 1.

2. Determine the rounding mode that the FPU is set to (or that is being emulated if run on an FPU-less system).

3. Find the largest finite float that can be represented.