Questions tagged [java]
Java (not to be confused with JavaScript) is a class-based, object-oriented, strongly typed, reflective language and run-time environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM) enabling a "write once, run anywhere" (WORA) methodology.
1,069 questions
85
votes
5
answers
9k
views
Guessing a number, but comments concerning
I always get marked down for my comments and I just wanted to see if these comments are acceptable or what I should include/where I should include them.
...
62
votes
3
answers
4k
views
Analyzing Minesweeper Probabilities
Calculating probabilities in Minesweeper might sound like an easy task, but I've seen so many probability calculators that's either incorrect, horribly slow, or with ugly code (or all of them) so I ...
37
votes
2
answers
8k
views
Weekend Challenge - Poker Hand Evaluation
Weekend Challenge #2 - Poker Hand Evaluation
Very early I decided to support the usage of wild jokers, even though I knew that this was going to lead to trouble more work. I also wanted to support ...
98
votes
9
answers
33k
views
'100' is a magic number
Magic numbers are bad... I totally agree. But there's one magic number I find hard to fix:
'100' is a magic number.
Consider this code:
...
23
votes
6
answers
14k
views
Optimize Conway's Game of Life
I have coded up an implementation of Conway's Game of Life and I have a performance bottleneck in it which I wish to be optimized. The main logic is in the Universe ...
20
votes
3
answers
4k
views
Recursive and flexible approach to Tic-Tac-Toe
Description
This is my code for the Weekend Challenge Reboot - Tic Tac Toe Ultimate.
The game can be played here: http://www.zomis.net/ttt (along with some other variations that are also use the ...
12
votes
4
answers
5k
views
Sound manager for Android
I created a singleton class for managing sound effects on Android. This class will only be instanced and loaded once at the beginning, and each activity will use the loaded songs.
I don't know either ...
12
votes
1
answer
217
views
YAuB - Micro Benchmark Follow-on
Following some great advice here from Simon, I realized that I had over-engineered things, and that the Task builder methods were a horrible Java8 abstraxction. In Simon's words: "From a usability ...
8
votes
4
answers
17k
views
Random walk on a 2D grid
The program assignment:
A drunkard in a grid of streets randomly picks one of four directions
and stumbles to the next intersection, then again randomly picks one
of four directions, and so on. ...
12
votes
3
answers
6k
views
Project Euler Problem 12 - triangle number with 500 divisors
I've just done Problem 12 of Project Euler:
What is the value of the first triangle number to have over five hundred divisors?
The \$N\$'th triangle number is the sum of all natural numbers ...
5
votes
3
answers
632
views
Readable code with many components (Swing)
Please help me to make more readable and simple code like this. What if I had 20 components? Is it right to organize code like this?
...
2
votes
1
answer
2k
views
NBA*: Very efficient bidirectional heuristic search algorithm in Java - follow-up
This post elaborates on NBA*: Very efficient bidirectional heuristic search algorithm in Java.
I have made the following changes:
Added an explicit type for representing digraph paths: ...
57
votes
8
answers
36k
views
Efficiently checking if a number is divisible by 3
I'm looking for code review, best practices and optimizations.
...
47
votes
2
answers
1k
views
Tool for creating CodeReview questions
To download the tool and for usage instructions, see the follow up to this question
Description
I have realized that there's a whole bunch of code I want to have reviewed, but copying file by file, ...
35
votes
3
answers
1k
views
Advanced and Detailed Minesweeper Probabilities
In an earlier question, I showed my code for calculating the mine probability for each and every field in a Minesweeper board. But it doesn't stop there. In that very same Minesweeper Analyze project, ...