7 ms·
HackerRank aims to build a fun place for programmers to hang out
- deleted 14y ago[deleted]
- ehaughee 14y agoAm I missing something? I type signup myemail myusername and I am then prompted for a password which seems to refuse any input or at least not alert me of submission.
- mariocesar 14y agoThe signup is broken, there is a 'login undefined property' exception. Hope this will be fix soon, cool idea
- rvivek 14y agoSorry, it's fixed. Can you try now?
- gms7777 14y agoSo maybe I just fail, but I attempted to sign up, typed in the command and then it asked for a password. I assumed this was to make up a password, so I tried that, and it didn't let me enter. Is this a you have to know a password to sign up thing?
- rvivek 14y agoSorry about it. Can you try now? It's fixed. A js error
- ayla 14y agoI am a novice programmer and I am always put off websites that rank users (and programming competitions for that matter). Avoiding the competition seems better than putting my relatively crappy code out there for all to see. Would more seasoned people out there agree that a clean slate is better than a low ranking on sites like InterviewStreet (or HackerRank if it gets big)?
- rvivek 14y agoHi Ayla, we want to build something that has fun stuff catering to different set of programmers (hackers/programming contest enthusiasts/functional programmers, etc.) Whether it's for pride or for learning new things, we want to leave it to the user.
- mnicole 14y agoI agree, as someone that's still just getting my toes wet, as soon as I saw the leaderboard aspect I was like "Ah, this isn't going to be my type of place.."
- obliojoe 14y agoThis looks cool. But I'm getting a javascript error when trying to sign up. TypeError: Cannot call method 'toLowerCase' of undefined [http://www.hackerrank.com/assets/application-18e8ea124a726771ae0f901e4094ee4f.js:16 http://www.hackerrank.com/assets/application-18e8ea124a72677...]
- quandrum 14y agoWas able to sign up, but the challenge totally failed on me. First it seemed to not be taking any input, and let me enter about 10 different numbers without response. Then, it showed me the back and forth between me and the computer for about half of those numbers, but the total never changed after that.
- Nick5a1 14y agoI am a very novice programmer, but this challenge seems impossible. It asks "Please provide a number between 1 or -1". That isn't even English. Do you mean between 1 and -1? Any number entered just results in the same "Please provide a number between 1 or -1". Did you not test this at all before promoting it? I am brand new to programming and even I know that testing is important.
- carb 14y agoThe error is when the argument to the `challenge` command is anything other than a number. Try `challenge monkey`. It then accepts zero for N, and the computer always picks a positive number. Resulting in a negative.
- rvivek 14y agoPlease use challenge <number> where number is >=5. Updating the problem text as well as the code
- whichdan 14y agoThe game worked fine for me, just double check "challenge 1" since it asks for a range between "1 and 0" A few observations: - If you start <= 6, you will always lose, since you have to choose 1 less than the starting number. - Whoever gets 6 on their turn will always lose. - If you start between 7 and 11, you'll always win. - If you start at 12 or higher, you'll usually lose, since the computer will try to get you to 6. Still fun for a few minutes atleast. No idea how people are winning 20+ games.
- learc83 14y agoAll you have to do is hand the computer a number that is divisible by 6 each time. If you start with 61 pick one and the computer has 60, say it picks 4 and you have 56 pick 2 so you hand it 54. Repeat until you win.
- rvivek 14y agoSome of them write a 'script' ;)
- drewfrank 14y ago> If you start at 12 or higher, you'll usually lose, since the computer will try to get you to 6. Ah, but you can also try to get the computer to 6 ;).
- jaredsohn 14y ago>No idea how people are winning 20+ games. I won over 20 games by just spending a few minutes manually running the algorithm described elsewhere here and I imagine anyone who hasn't won hundreds or thousands of games probably did the same. (If you're going to write a bot, might as well let it run for awhile and see if you can max out the leaderboard.)
- jaredsohn 14y agoA few things: * I'm having issues with the terminal where what I type is not always on the bottom line. Also, the up/down arrows for getting command history don't always show what I would expect and I get latency fairly frequently. Also spoiler here's an algorithm that will let you win every time where it is possible to win. I debated a bit about posting this, but if I didn't I'm sure somebody else would. 1. If number is divisible by 6, do not play since you'll always lose. 2. If the number is less than 6, do not play since it doesn't allow you to take them all in the first move, despite what the instructions suggest. 3. Otherwise, your first pick should be a number that takes the remaining number to a multiple of six (see rule #1). Then, you should look at what number the computer picks and subtract it from six when you pick your number. Getting to the top of the leaderboard is dependent on understanding this and how much time you're willing to spend playing. Or you could write a bot that plays the game for you. Then getting to the top of the leaderboard depends on who started their bot first and the quality of bots' network connections.
- gms7777 14y agoI was about to post this exact thing. Its easy enough to figure out if you watch the computer play. Using this its possible to win every single game as long as the number you start with isn't divisible by 6.
- rvivek 14y ago:) This was just a teaser page/warmup puzzle for fun. Thanks for trying out!
- chimeracoder 14y agoI must say, this 'challenge' is a creative idea. However, not to be a wet blanket, but it's rather simple to construct a winning algorithm, particularly if you can both choose the same starting number and always go first (and choose the same starting number multiple times). If I had a few extra minutes at work right now, I'd take a stab at it. ...That is, unless that's the entire point?
- rsobers 14y agoI'm going crazy or should I not have won here? Playing a game for N: 10 Your move: '4'. Computer's move: '1'. Remaining candies: '5' Please provide a number between 1 or 5. Your move: '5'. Computer's move: '5'. Sorry! You lost the game.
- sp332 14y agoI made the same moves and it said I won.
- RegEx 14y ago"Username can only contain characters, numbers and underscore." _RegEx_ doesn't work :(
- manish_gill 14y agoThere's a bug. The cursor sometimes shows up above the current prompt line and I'm not able to type. Clicking on the prompt will just bring it back for a second and then it goes up again.
- gdi2290 14y ago$ Playing a game for N: 8 $ Your move: '2'. Computer's move: '2'. Remaining candies: '4' $ Congrats! You won the game. Now go ahead and play for more candies. Enjoy :)
- deleted 14y ago[deleted]
- dxbydt 14y agoVivek, Cannot access at the bank. Contacted friends at other banks. Same story :( So some 1 million plus corporate programmers don't have access to your website. Here's the message I get on Internet Explorer. --------- 403 Forbidden This Web site is blocked: http://hackerrank.com/ http://hackerrank.com/ As part of our ongoing effort to protect the bank and its information, the Web site you are trying to reach is blocked because it is classified in a category the bank considers to have certain risks. The bank blocks access to a number of Web site classifications including but not limited to Web mail sites, Personal Network Storage, and other categories to comply with regulations, protect customer and company information, and to be consistent with industry standards and practices. This Web site is categorized as Games. ---------
- jimminy 14y agoI'd say that's probably a good thing considering the passwords were being transmitted in the clear[1]. To me this would seem a huge liability to be accessible by bank employees. [1]https://gist.github.com/3020091/ https://gist.github.com/3020091/
- rvivek 14y agoWe're getting https certificate.
- dxbydt 14y agoimho the reason is the name. If news.ycombinator.com was called hackernews.com, it would be blocked in 15 seconds flat. That's corporate america for you.
- uiri 14y agoHackerne.ws points to the same IP address as news.ycombinator.com. Is the former blocked but the latter allowed?
- dwerthen 14y agoI most certainly enjoyed that! Was nice to find the apply command after poking around in the help. == apply: Apply to join our awesome team. Usage: apply <a profile url> <why do you want to apply> Does it have anything to do with my mad skillz in solving the puzzle perhaps? ;-)
- theonewolf 14y agohey passwords are being sent plaintext (https://gist.github.com/3020091/ https://gist.github.com/3020091/). be careful if you signup/when you log in. use a password you don't care about, or use a throwaway.
- tedjdziuba 14y agoI was working on scripting this because there's an easy algorithm to win, but the parsing out the CSRF token to make it work? You should have made it a bit less hurdle-y to script.
- think-large 14y agoCan you give solutions after the week is up? I really want to become a better programmer and I think this would really help me learn.
- rvivek 14y agoYes, we'll be putting it up. Stay tuned. Thanks for trying
- calinet6 14y agoThe algorithm is obviously pretty easy, as has been demonstrated... but I can't believe I just spent 20 minutes trying to come up with a scripted solution. Nerd sniped again! http://xkcd.com/356/ http://xkcd.com/356/
- rvivek 14y agoCongrats! There are 5 "scripted" solution till now.
- recursive 14y agoThe CLI seems to get into an inconsistent state easily in Chrome, only fixed by reloading the page. I'm sure I know how to win the candy challenge based on the english description of the rules, but I can't make any sense of the output. recursive@hackerrank:~$ challenge 1 Playing a game for N: 1 Please provide a number between 1 or 0. How many candies you want to pick?: At this point, I get stuck in a loop that I've only been able to get out of with f5.
- xiaoma 14y agoWell, I was trying to avoid spoilers, but since jaredsohn has already sailed that boat out to sea... How do you script something like this? I tried looking at the source and then using the chrome console to input jQuery commands, but something really weird happened. I could replace just about any element on the screen except the one that mattered! I could type "challenge 8" into the console and then running a $('tester').text() would return "challenge 8" as expected. But $('tester').text('challenge 9') wouldn't update the screen. I tried for a good hour to find a way to update the text in that element, with no luck (short of removing the whole thing from the dom). (see http://postimage.org/image/c3xkrg8y3/ http://postimage.org/image/c3xkrg8y3/ ) Also how do you send a carriage return? Inserting a newline didn't seem to do the trick. Anyone? As much as I love a challenge, beating my head against this one issue doesn't yield much education / time spent.
- jaredsohn 14y agoIf you look at the JavaScript, you can see that it actually expects a keystroke for the Enter key. I'm not familiar with sending keystrokes in JavaScript (from some brief searching I think it is possible; I just don't know the best practice), but for something like this, you could just do it at the operating system level. A long time ago I automated an annoying user interface for a program we had to use at work by writing some vbscript that changes windows and does a combination of sendkeys and sleep. Unfortunately, just sending keystrokes isn't very robust since it isn't reading what is going on in the UI and if something random happens (the site behaves other than expected, you touch a key / move the mouse, a scheduled program runs, etc) the script could get out of sync. Fortunately, the consequences of an error are so low here that such a solution would be good enough.
- iambibhas 14y agoAnd just found a bug. I started from 2000 and it got stuck at 378. It is miscalculating and thus going into an infinite loop. http://paste.ubuntu.com/1067434/ http://paste.ubuntu.com/1067434/ I mean come on, mathematical miscalculation for a game like this?
- vemuruadi 14y agoAwesome stuff man...looking fwd to more challenges.
- daguar 14y agoI'm getting a whole mess of "You can't play that game!" errors on legitimate moves.
- idefine 14y agoI am getting various errors - there are 4 remaining candies. I take 4. now there are 6 remaining candies...something is wrong.
- deleted 14y ago[deleted]
- kiennt 14y agoYou guys rock !!! I also write new bot by python for hackerrank challenge. Check out my code at https://github.com/kiennt/hackerrank-bot https://github.com/kiennt/hackerrank-bot Happy hacking :)
- think-large 14y agoThanks soo much for posting your code. Just starting out with python and it's nice to be able to learn from someone else's exploits.
- llaxsll 14y agoHa! I attempted this yesterday, after I saw the article in TC. It was a really fun challenge! Good job guys! Hope I didn't cost you a lot of money.. by my estimates i sent you something close to like a million requests .. give or take.