Live data from Hacker News

Solitaire

localthunk.com

161–164 of 164 posts

Re: Solitaire

#161

Earlier quoted context omitted.

That code is a few lines maintaining a mapping though, changing it is not going to be hard and all the mappings are captured explicitly which makes it even more straightforward versus shaving off lines of code by making some of them implicit (e.g. by seeing a pattern in the mapping and using an if statement to capture them all). I'd really love to know what you think it should be to be more maintainable!

Something like this would pass a code review, while the original would not: function createObject(value, id, nominal) return { value = value, id = id, nominal = nominal } end local objects = { createObject(100, 1, "nominal1"), createObject(200, 2, "nominal2"), createObject(300, 3, "nominal3"), createObject(400, 4, "nominal4") } Still far from ideal, but I'm not that familiar with LUA either. And I do acknowledge that…

This is not equivalent though so you fail my code review. :D

For starters its clear the code in the example expects self.base.value to already hold a value. So constructing an object blind isn't necessarily what's happening here, it's possible an existing object is even being decorated with extra fields. So your suggestion isn't preserving the semantics.

Secondly for the face cards there is an additional field being set which is not happening in your case.

That's what I mean when I said earlier that we can't just look at a piece of code contextless and say it's bad. Your refactor is definitely neater if we're initializing homogenous objects but that's an incorrect assumption on your part. It also comes with trade-offs for example it's not obvious anymore what any of the values relate to without going to the function constructing the object. Not the biggest thing in the world but if this is the only place in the codebase doing this then I'd argue that it probably isn't worth it.

Re: Solitaire

#162
post #106

Earlier quoted context omitted.

Using a lightweight PWA (progressive web app) is also an option: https://FreeSolitaire.win (self-plug). Doesn’t generate unwinnable games[1] & detects dead-ends. Works offline after the first visit. No ads until game over, and they aren’t obtrusive. Often lauded on HN, e.g. https://news.ycombinator.com/item?id=41972075 or https://news.ycombinator.com/item?id=42031052 . 1: The probability that a random deal is unwinna…

First time I've played any game through the end just because I wanted to see an ad! It's really well made, gotta confess I went the CLI route because I don't know how to design GUIs with moving parts. Also, I wanted to play my game with controls tailored for the keyboard layout (ASDFGHJ keys control the columns if using QWERTY).

You can also try my own implementation of https://klondikesolitaire.com/. Ad-free.

Re: Solitaire

#163
post #106

Earlier quoted context omitted.

First time I've played any game through the end just because I wanted to see an ad! It's really well made, gotta confess I went the CLI route because I don't know how to design GUIs with moving parts. Also, I wanted to play my game with controls tailored for the keyboard layout (ASDFGHJ keys control the columns if using QWERTY).

You can also try my own implementation of https://klondikesolitaire.com/ . Ad-free.

Thanks! Looks nice, the DOM part seems to be very well made, I can't draw cards from stock on Firefox though. Dragging cards works well, it's just the click on stock that doesn't seem to register.

It works when I first load the page, then stops working after a new game.

Re: Solitaire

#164

Earlier quoted context omitted.

Game is great, I might continue playing, but the fake update scam ads are predatory and frankly fairly intrusive. Edit: screenshot: https://ibb.co/4RkTFzZ4 The X to close the ad didn’t work.

Thanks for letting me know. That’s not my choice but AdSense. However, I can manually disable ads like this one, I’ll look into it.

I just removed interstital ads.
Post reply on HN