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

Random offset based on difficulty #75

Merged

Conversation

FL3SH
Copy link
Contributor

@FL3SH FL3SH commented Jul 12, 2020

No description provided.

@lpanebr
Copy link
Contributor

lpanebr commented Jul 13, 2020

I think this should enable the #72 but I just tried this pr and I's not working for me.

I tried setting let g:vim_be_good_delete_me_fixed_offset = 1 and let g:vim_be_good_delete_me_fixed_offset = '1' but the offset keeps changing..

In the debug I get zero as if the config is not getting read:

{"message":"[vim-be-good] delete-round#getGameOptions - isDefinedUserRandomOffset  0","level":"info"}
{"message":"[vim-be-good] delete-round#getGameOptions - isDefinedUserFixedOffset  0","level":"info"}

@FL3SH
Copy link
Contributor Author

FL3SH commented Jul 14, 2020

This is why is just a draft. It has a bug and I don't see any issue causing it.
Options are not being read properly, but if you set both random and fixed offsets, fixed values should be picked.

@lpanebr
Copy link
Contributor

lpanebr commented Jul 14, 2020

yes, you're right.

I could not find anything wrong with the logic so I thought maybe the logging is somehow messing things and what you know. When I comment it out:

        /* console.log( */
        /*     "delete-round#getGameOptions - isDefinedUserRandomOffset ", */
        /*     randomOffset, */
        /* ); */
        /* console.log( */
        /*     "delete-round#getGameOptions - isDefinedUserFixedOffset ", */
        /*     fixedOffset, */
        /* ); */

the fixed value gets correcty picked from my init.vim!

let g:vim_be_good_delete_me_fixed_offset = 3
" let g:vim_be_good_delete_me_random_offset = 1

I then tried uncommenting and moving the console.log entries before the return but the build failed with:

Checking formatting...
src/game/delete-round.ts
Code style issues found in the above file(s). Forgot to run Prettier?

Since I now nothing about typescript or prettier I can't help anymore.. and plus I've got to get some real work done..

@FL3SH
Copy link
Contributor Author

FL3SH commented Jul 14, 2020

Run npm run lint:fix and then build the app.
I feel like I should add this to readme.

@ThePrimeagen
Copy link
Owner

@FL3SH please let me know when you want me to merge / review this :)

@FL3SH

This comment has been minimized.

README.md Outdated
@@ -29,10 +29,18 @@ current buffer (only if its empty) set `vim_be_good_floating` to 0.

### Games - relative
By default vim be good returns random offset for game difficult above noob, if
you with to set fixed offset set `vim_be_good_delete_me_offset` to desired
you with to set fixed offset set `vim_be_good_delete_me_fixed_offset` to desired
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"you with to set" typo?

README.md Outdated
You can also use `vim_be_good_delete_me_random_offset` to set minimal value of
random offset.

`let g:vim_be_good_delete_me_fixed_offset = 5`
Copy link
Collaborator

@brandoncc brandoncc Jul 14, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should say g:vim_be_good_delete_me_random_offset?

let fixedOffset: number = 0;

const isDefinedUserRandomOffset = await game.nvim.eval(
'exists("vim_be_good_delete_me_fixed_offset")',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I debugged this for like an hour, completely confused... Then I realized that lines 24 and 27 are backward!

🤦

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

omg, sorry @brandoncc ;)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't believe I also didn't see that! ahhahaha

@FL3SH
Copy link
Contributor Author

FL3SH commented Jul 15, 2020

@lpanebr should be fine now, you can check it ;)

@FL3SH FL3SH marked this pull request as ready for review July 15, 2020 07:54
@lpanebr
Copy link
Contributor

lpanebr commented Jul 15, 2020

ALL seem VimBeGood now! Excellent work!!!

src/game/delete-round.ts Outdated Show resolved Hide resolved
@@ -120,3 +128,14 @@ idea of how to stop sucking
```
- Check your new feature `NVIM_NODE_LOG_FILE=/tmp/nvim.log nvim +VimBeGood` (you can view logs with `less /tmp/nvim.log`)
- Make PR

If you see something similar during your build:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@ThePrimeagen ThePrimeagen merged commit bb3a7a6 into ThePrimeagen:master Jul 27, 2020
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.

4 participants