PraxTube / chess-ai

A chess AI that uses alpha-beta to find the best move
MIT License
0 stars 1 forks source link

Let benchmark.py generate .csv and .tex output files #24

Closed MrBeroxar closed 1 year ago

MrBeroxar commented 1 year ago

Closes #7 and #11.

MrBeroxar commented 1 year ago

added .csv and .tex benchmarking

PraxTube commented 1 year ago

The output of the .tex file might has to be a little bit changed, but apart from that it looks good on first glance. Also, it seems like the script is generating a .csv file? Or is that something else?

PraxTube commented 1 year ago

Btw there are some tests that fail simply because of the format of the code. When you are in the venv with the dependencies installed from requirements.txt you can run black . and flake8 . to format and lint the code respectively.

MrBeroxar commented 1 year ago

ye .csv file also. I can do delet line 4 csv generta

PraxTube commented 1 year ago

It's actually quite nice that a .csv file is generated as well. That will make debugging much easier, it's also much easier to work with .csv files then .tex files. I would leave it in.

PraxTube commented 1 year ago

I cleaned up the commit history a bit and changed the way the .csv file is generated. It's not done yet, but I think you can see where it's going. We ultimately want to have a .csv file that generates tables like this. So only one board from each stage (early, mid, late). Just take the first one from each. I would like you to finish this if possible, would be great if you could get it done ASAP, but I don't expect to be able to merge this today. Also note that we generate the tables differently then the way they are right now.

@MrBeroxar

PraxTube commented 1 year ago

If you encounter problems when pulling the changes locally, you can run git reset --hard origin/csv-text-benchmarking-export. Note that this will reset your local branch, so if you have any changes (even commits) they will be reset.

PraxTube commented 1 year ago

We would want an output like this as our .tex output

\begin{table}[ht!]
  \caption{Benchmark results of the Basic AI.}
    \label{tab:benchmark}
    \centering
    \begin{tabular}{cccc}
        \toprule
        Tested Category & Early-Game & Mid-Game & Late-Game \\ \toprule
                Fen Conversion & 13 $\upmu$s & 15 $\upmu$s & 10 $\upmu$s \\ %\midrule
        Legal Move Gen & 155 $\upmu$s & 968 $\upmu$s & 188 $\upmu$s \\
        Making Move & 5 $\upmu$s & 5 $\upmu$s & 5 $\upmu$s \\
        Evaluate Board & 205 $\upmu$s & 210 $\upmu$s & 194 $\upmu$s \\
        Best Move Search & 8.5 ms & 9.7 ms & 3.1 ms \\ \bottomrule
    \end{tabular}
\end{table}
PraxTube commented 1 year ago

Given that things have become very werid and complex, I think it would be best if you would create a fresh branch (preferably on the main repo, you should have the access rights to do so) and create the changes there. I also included your fix in the master branch for the logging.

@MrBeroxar