Vlad-Shcherbina / icfpc2015-tbd

2 stars 0 forks source link

Interactive UI #4

Open Vlad-Shcherbina opened 9 years ago

Vlad-Shcherbina commented 9 years ago

Primarily for testing, to manually play the game that exhibits interesting situations.

fj128 commented 9 years ago

btw I'm working on one as well. Having two is OK.

martignlo commented 9 years ago

I'm almost done!

2015-08-07 22:13 GMT+02:00 fj128 notifications@github.com:

btw I'm working on one as well.

— Reply to this email directly or view it on GitHub https://github.com/Vlad-Shcherbina/icfpc2015-tbd/issues/4#issuecomment-128823035 .

martignlo commented 9 years ago

The UI is done. It also allows to reply a game and to trace the execution of a game for testing purposes.

I'll add the option to submit a solution.

martignlo commented 9 years ago

Options currently available:

--problem qualifier/problem_4.json --> the problem to play --moves aaaaalalalalaaaaaaalllllaalllllllllalalalabbllllbbbbbbbbbbb --> play the moves --tracedir /tmp/tracedir --> trace the execution of the game and dump it in the directory (for testing purposes)

Vlad-Shcherbina commented 9 years ago

Controls

fj128 commented 9 years ago

OK, so I made interfaces.py, patched game.py to use them, patched tkgui to use them and made play_interactively.py that uses all this shit in a pretty straightforward manner now.

What I'd like to see on this front: split ui.py into console_ui.py that provides the same interface as tkgui.Gui, and the rest of the stuff that should be moved to play_interactively and some of it possibly to a different module for replays and stuff, if it looks like being too much out of scope. Though my tkgui is pretty easily configurable right now wrt available actions and stuff. It should be even possible to add a method to re-configure it at runtime, to switch between the interactive buttons and the replay buttons.

The point of that is not to have two UIs actually, but to be forced to clean up and minimize all interfaces.

manpages commented 9 years ago

I can't figure out the correct place to call runJSON. But basically, we can now send recodrings of successful runs to the server, I'll write a report in #6 and go to sleep.

martignlo commented 9 years ago

I'll clean up the console ui then.

martignlo commented 9 years ago

Added utility to play a game given a solution:

$ python production/reply_ui.py '[{"problemId":0,"seed":0,"tag":"TEST","solution":"llllllllllalllllllllallllllllllllllkaaalllllaaaaalllklaaaaaalllaaaaaaalkaaaaaldpaaaaaaaklllllkllkalllkkklkkppaaaaakalkaalllldakallllkallldlkaaaalddbllllllppaaaallkbllllak"}]'

By default it waits for keypresses (fwd = k, bwd = j). A timeout can be specified to play the game without interaction.

$ python production/reply_ui.py '[{"problemId":0,"seed":0,"tag":"TEST","solution":"llllllllllalllllllllallllllllllllllkaaalllllaaaaalllklaaaaaalllaaaaaaalkaaaaaldpaaaaaaaklllllkllkalllkkklkkppaaaaakalkaalllldakallllkallldlkaaaalddbllllllppaaaallkbllllak"}]' --delay 0.05