296 karma · joined October 15, 2017
In high school, it definitely crossed my mind that I could hide earphones under my hair or wear a bracelet with a different color of seed bead for each digit. That's one of the slower methods, and it's easy to catch if you're looking for it, but it works in person and doesn't require a screen.
I use scroll position to keep the state. In effect, each square is in a div with overflow:hidden. (In the actual code I used <i>, not <div>, which might've been to save bytes because the server is so slow). It has a fixed visible height, the height of the square. Above the fold (before scrolling) is the un-clicked square, and below the fold (what you see after scrolling) is the clicked square.
Since overflow is hidden, you have to use an in-page anchor link to scroll to the clicked state. The unclicked version of each cell is an anchor to the clicked version.
I used HTML/CSS so I could implement it on a Neopets page, which meant I couldn't use forms, inputs, or CSS3, which means it's less feature-complete and the approach is completely different. The final result, though, is still the same delightful Minesweeper experience.
Codepen link (so you don't have to be signed into Neopets to see it)
https://codepen.io/qaz/pen/bGEzyrJ
Enjoy!
Mars might still be easier to terraform than Venus, if we develop the technology, so maybe that’s part of why it became the focus. But if we could terraform Mars, perhaps we could just reterraform Earth.
- Each function should do just one thing.
- Don't reuse a variable if making a new variable with a new name would describe the value better.
- Give functions verb names that describe what they do. If that's hard, they may be doing too many things.
- A function should either change something or return a value (command-query separation)
- Any data should have a single, canonical source of truth. https://en.wikipedia.org/wiki/Single_source_of_truth
- When deciding between making code DRY https://en.wikipedia.org/wiki/Don%27t_repeat_yourself or not, decide if future changes should affect both places at the same time (use DRY) or not (probably doesn't need DRY, maybe shouldn't have it.)
- Avoid spooky action at a distance https://en.wikipedia.org/wiki/Action_at_a_distance_(computer... and if you can't, refactor or at least add comments.
- Write modular functions that can be used without understanding much about the function beside what the name/arguments tell you.
One measure of your success in this area is how quickly someone who'd never seen your code could describe what it does.
- Ask them to review your code and suggest changes
- Look for questions of taste and ask more. It may feel intuitive to them, but if you dig in you can often find a good reason/principle behind it.
- Read your coworkers' code
- Read the comments people leave on others' code
1) I reengaged with a friend. I was so busy and stressed that I went months at a time without making social plans, and when a she wanted to get coffee, the first thing through my mind was how taking a few hours off from studying would make me that much more overwhelmed. She told me about burnout, and that's how I realized I was in a temporary state that I could get out of. Beyond that insight, just talking with a friend and breaking my isolation was the right thing to do for my social and mental well-being.
2) I switched from an accomplishment-oriented schedule (I'm done once I finish this task) to a time-based schedule (I have two weeks to do this assignment, and it will take me up to 20 hours, so I'll spend 2 hours on it per work day; that leaves six hours for these other projects, eight hours for sleep, and eight hours of free time.) I made a spreadsheet so I could see how much I was accomplishing and see that I'd have time to finish everything.
This made a big difference. There was always more work to do, always some long term project that wasn't finished yet that I felt like I had to work on, but scheduling time for it made it possible to take free time without worrying I was being lazy and I was never going to finish. It made my work, even huge projects, feel manageable.
3) I reevaluated my motivation. I was motivated by a sense of duty and obligation to work hard and make the most of my education, by grades, and by not wanting to fail. Hearing someone say, "Hard work pays off," was a great reminder to me that there were better reasons for what I was doing. Looking back, my hard work really did pay off. My education prepared me for my current job, which I love going to even on Mondays. It was very encouraging to look forward to the payoff and remind myself that my work was adding up to something.
4) I gave myself a break. I made it through the term by changing my time management and reevaluating my motivation, and the next term, I signed up for a lighter workload. I made it through college, and I've avoided going through burnout again by keeping an eye on my working hours and my motivation.
TL;DR: Take care of yourself, make some progress each day, don't forget your real motivations in the midst of your proxy motivators, take time off when you need it, and know that you're doing a good job and your work will pay off.
I like this. It’s a rule for finding useful rules. I wonder if I can get good at this kind of analysis.
So many people learned the joy of coding from that site. Sadly, it can’t be that for the next generation because its code filters are almost as obsolete as this guide. HTML5, CSS3, multiple classes on an element, and the word “position” in a stylesheet aren’t supported. TNT, if you’re reading this, please take some time to invest in the part of your site where people learn and create.
Gameplay: Each number tells you how many of the tiles touching it (on sides and corners) are bombs. This board is designed to be solvable without guessing.
Pro Tip: You can undo a move by clicking on the square and typing Shift+Tab.
Discussion: Can you figure out how it works? Can you think of a way to implement flagging, game-over, or other features? Know of any other HTML/CSS hacks?