Skip to content

Organize&Fix: src/Graphwar/ComputerPlayer.java#30

Open
Cmd-GZ wants to merge 5 commits into
catabriga:masterfrom
Cmd-GZ:reorganize/ComputerPlayer
Open

Organize&Fix: src/Graphwar/ComputerPlayer.java#30
Cmd-GZ wants to merge 5 commits into
catabriga:masterfrom
Cmd-GZ:reorganize/ComputerPlayer

Conversation

@Cmd-GZ

@Cmd-GZ Cmd-GZ commented Jul 7, 2026

Copy link
Copy Markdown
Contributor
  1. Organize ComputerPlayer.java to make it more readable based on optimize/Function
  2. Fix a bug in run(), which makes the program mutate the old function angle (functions[i].angle) instead of the new one (newFunctions[i].angle)
  3. Remove unused initialize about bestFunction

I don't know if you could accept large-scale changes. So I split them into 3 PRs. Here is the last one. Sorry for bothering you if you don't like it.

Cmd-GZ added 5 commits July 4, 2026 07:01
Integrate many repeative codes and nested codes
…eft corner in y' mode

In y' mode, if you send a function that is undefined, such as `log(x)`, `sqrt(x)`, `ln(x)`, at the starting point, instead of exploding at the starting point, the bullet will explode on the top-left corner.
I have no idea that what stuff exactly causes it, but it's suprise that I fixed it when I try reorganising the `Function.java` unconsciously.
Just like I said, the code in `src/Graphwar/Function.java` is organized to make it more readable, which fixes the bug somehow.
…ter the branch `fix/Function`

It's clearly that process(Function/RK4/RK42)Range is unnecessary after abstract them as processRange.
So I make peocessRange be a public method and remove process(Function/RK4/RK42)Range. And modify the caller (GameData.jar, ComputerPlayer.java)'s code for the change.
1. Organize ComputerPlayer.java to make it more readable
2. Fix a bug in `run()`, which makes the program mutate the old function angle (functions[i].angle) instead of the new one (newFunctions[i].angle)
3. Remove unused initialize about bestFunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant