Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement logic of coin capture #3

Closed
PrajwalKrishna opened this issue Oct 2, 2018 · 5 comments · Fixed by #9
Closed

Reimplement logic of coin capture #3

PrajwalKrishna opened this issue Oct 2, 2018 · 5 comments · Fixed by #9
Labels
enhancement New feature or request

Comments

@PrajwalKrishna
Copy link
Owner

Right now for seeing a capture of coin the function iterates over all set coins and checks whether some matches with Mario or not. This is highly ineffective and needs to be changed.

@PrajwalKrishna PrajwalKrishna added the enhancement New feature or request label Oct 2, 2018
@jrkong
Copy link
Contributor

jrkong commented Oct 2, 2018

I took a look at the code and I have an idea.

Currently coins are created and put into a list. I want to add an additional layer to this by creating a nested dictionary which uses the coin coordinates as keys and stores the coin index in the resulting nest structure (so something like `{"x coordinate"{"y coordinate" = coin index}}). Then instead of checking every coin the dictionary is referenced to check if a coin exists. If it does the coin list is accessed to update the coin's state.

If this sounds like a viable implementation I'll work on it.

@PrajwalKrishna
Copy link
Owner Author

Nice idea and seems viable you may get going with it

@PrajwalKrishna
Copy link
Owner Author

@jrkong status?

@jrkong
Copy link
Contributor

jrkong commented Oct 19, 2018

Currently debugging. I'm thinking that just using the x and y isn't viable because of a few issues:

  1. Mario's overall coordinates aren't tracked by the board, he's just identified by the board which means checking Mario's coordinates requires more checks then originally intended.
  2. The math required to calculate Mario's size from his seed coordinates will take roughly as much work as the current coin logic implementation.

Right now I'm testing moving the coin logic into the board update logic so it removes the coin at the updated location if Mario passes it using the coin dictionary I implemented.

@PrajwalKrishna
Copy link
Owner Author

Nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants