2024-01-13 15:21:17 +11:00
|
|
|
|
2024-01-14 17:50:43 +11:00
|
|
|
#include "reactor/builder.hpp"
|
2024-01-14 17:07:45 +11:00
|
|
|
#include "reactor/control/control_rod.hpp"
|
|
|
|
#include "reactor/fuel/fuel_rod.hpp"
|
|
|
|
#include "reactor/coolant/pipe.hpp"
|
2024-01-14 16:57:13 +11:00
|
|
|
#include "display.hpp"
|
2024-01-13 15:21:17 +11:00
|
|
|
|
2024-01-13 21:54:21 +11:00
|
|
|
#include <sstream>
|
2024-01-13 15:21:17 +11:00
|
|
|
#include <unistd.h>
|
2024-01-13 21:54:21 +11:00
|
|
|
#include <curses.h>
|
|
|
|
|
2024-01-13 15:21:17 +11:00
|
|
|
int main()
|
|
|
|
{
|
2024-01-13 21:54:21 +11:00
|
|
|
initscr();
|
|
|
|
cbreak();
|
|
|
|
noecho();
|
|
|
|
keypad(stdscr, TRUE);
|
|
|
|
nodelay(stdscr, TRUE);
|
|
|
|
curs_set(0);
|
|
|
|
|
2024-01-14 17:50:43 +11:00
|
|
|
sim::reactor::reactor<5, 5> reactor = sim::reactor::builder<5, 5>(
|
|
|
|
sim::reactor::fuel::fuel_rod(100, 400),
|
|
|
|
sim::reactor::control::control_rod(1000),
|
|
|
|
sim::reactor::coolant::pipe(), {
|
|
|
|
" P ",
|
|
|
|
" FCF ",
|
|
|
|
"PCPCP",
|
|
|
|
" FCF ",
|
|
|
|
" P "
|
|
|
|
});
|
2024-01-13 15:21:17 +11:00
|
|
|
|
|
|
|
for(;;)
|
|
|
|
{
|
2024-01-14 17:50:43 +11:00
|
|
|
reactor.update(1);
|
2024-01-13 15:21:17 +11:00
|
|
|
|
2024-01-13 21:54:21 +11:00
|
|
|
erase();
|
2024-01-14 16:57:13 +11:00
|
|
|
display::draw_text(1, 0, "Reactor Core:");
|
2024-01-13 21:54:21 +11:00
|
|
|
|
|
|
|
const int X = 3, Y = 4;
|
|
|
|
const int W = 32, H = 8;
|
|
|
|
|
2024-01-14 16:57:13 +11:00
|
|
|
for(int x = 0; x < reactor.width; x++)
|
|
|
|
for(int y = 0; y < reactor.height; y++)
|
2024-01-13 21:54:21 +11:00
|
|
|
{
|
|
|
|
std::stringstream ss;
|
2024-01-14 16:57:13 +11:00
|
|
|
ss << *reactor.rods[x][y];
|
2024-01-13 21:54:21 +11:00
|
|
|
|
|
|
|
int px = X + (H - 1) * y;
|
|
|
|
int py = Y + (W - 1) * x;
|
|
|
|
|
2024-01-14 16:57:13 +11:00
|
|
|
display::draw_text(px + 1, py + 2, ss.str().c_str());
|
|
|
|
display::draw_box(px, py, H, W);
|
2024-01-13 21:54:21 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
refresh();
|
2024-01-13 15:21:17 +11:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|