void PrintTournamentBoard()
{
int Cols = 5;
int Rows = pow(2, Cols);
for(int i = 0; i < Cols; ++i)
{
int Players = pow(2, i)
for(int j = 0; j < Rows; ++j)
{
// things here pls >.<
}
}
}
(edited) 0
0 0
0 0 0 0
or smth#include <cmath>
#include <iostream>
int main() {
int Cols = 5;
int Rows = pow(2, Cols);
for (int i = 0; i < Cols; ++i) {
int Players = pow(2, i);
int divider = Rows / (Players + 1);
for (int j = 0; j < Rows; ++j) {
if (j % divider == 0 && j >= divider && j <= divider * Players) {
std::cout << '0';
} else
std::cout << '-';
}
std::cout << '\n';
}
}
output:
----------------0---------------
----------0---------0-----------
------0-----0-----0-----0-------
---0--0--0--0--0--0--0--0-------
-0000000000000000---------------
(edited)void PrintTournamentBoard() {
int Cols = 4;
int Rows = pow(2, Cols);
for (int i = 0; i < Cols; ++i) {
int Players = pow(2, i);
int divider = std::round((float)(Rows) / (float)(Players + 1));
for (int j = 0; j < Rows; ++j) {
if (j % divider == 0 && j >= divider && j <= divider * Players) {
std::cout << '0';
} else
std::cout << '-';
}
std::cout << '\n';
}
}
output:
--------0-------
-----0----0-----
---0--0--0--0---
--0-0-0-0-0-0-0-
chiller pls fixint Rows = pow(2, Cols) + 1;
it will cause more problemosDisableMode()
. Currently it is not being reset when pressing Escape, which I believe is not intended.
#include <stdio.h>
int main(void) {
int depth = 4;
int f_gap = 3;
int t_width = 1<<(depth - 2) * (1 + f_gap) - f_gap;
int off = t_width / 2;
int gap = (1<<(depth - 1)) * (1 + f_gap) - 1;
for(int i = 0; i < depth; i++, off /= 2, gap /= 2) {
printf("%-*s", off, "");
int pc = 1<<i;
for(int j = 0; j < pc; j++)
printf("%-*s", gap + 1, "0");
putchar('\n');
}
return 0;
}
#include <stdio.h>
int main(void) {
int depth = 10;
int f_gap = 3;
int t_width = (1 << (depth - 2)) * (1 + f_gap) - f_gap;
int off = t_width / 2;
int gap = (1 << (depth - 2)) * (1 + f_gap) - 1;
for (int i = 0; i < depth; i++, off /= 2, gap /= 2) {
printf("%-*s", off, "");
int pc = 1 << i;
for (int j = 0; j < pc; j++)
printf("%-*s", gap + 1, "0");
putchar('\n');
}
return 0;
}
here is fixed#include <stdio.h>
int main(void) {
int depth = 5;
int f_gap = 3;
int t_width = (1<<(depth - 1)) * (1 + f_gap) - f_gap;
int off = t_width / 2 + 1;
int gap = (1<<(depth - 1)) * (1 + f_gap) - 1;
for(int i = 0; i < depth; i++, off /= 2, gap /= 2) {
printf("%-*s", off, "");
int pc = 1<<i;
for(int j = 0; j < pc; j++)
printf("%-*s", gap + 1, "0");
putchar('\n');
}
return 0;
}
#include <stdio.h>
int main(void) {
int depth = 4;
int f_gap = 5;
int t_width = (1<<(depth - 1)) * (1 + f_gap) - f_gap;
int off = (t_width / 2);
int gap = (1<<(depth - 1)) * (1 + f_gap) - 1;
for(int i = 0; i < depth; i++, gap /= 2) {
printf("%-*s", off, "");
int pc = 1<<i;
for(int j = 0; j < pc; j++)
printf("%-*s", gap + 1, "0");
putchar('\n');
off = off / 2 - 1;
}
return 0;
}
final answertime DDNet quit
its rigged