File tree Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Expand file tree Collapse file tree 1 file changed +16
-11
lines changed Original file line number Diff line number Diff line change 1
- #include < algorithm>
2
- #include < filesystem>
3
- #include < iostream>
4
- #include < numeric>
5
- #include < string>
6
-
7
1
#include " anim.hpp"
8
2
#include " models.hpp"
9
3
#include " utils.hpp"
@@ -23,14 +17,25 @@ int main()
23
17
clear_screen ();
24
18
25
19
auto pkmns = load_main_menu (manifest);
26
- sleep ( 1000 ) ;
20
+ auto & [player, ai] = pkmns ;
27
21
clear_screen ();
28
22
29
- std::cout << " TODO: init game loop" << ' \n ' ;
30
- sleep (1000 );
31
- clear_screen ();
23
+ while (player.hp > 0 && ai.hp > 0 )
24
+ {
25
+ int move_index = print_frame (player, ai);
26
+ player.make_move (ai, move_index);
27
+
28
+ if (ai.hp > 0 )
29
+ {
30
+ sleep (1000 );
31
+ ai.make_move (player, random_range<std::size_t >(1 , 4 ));
32
+ clear_screen ();
33
+ }
32
34
33
- print_frame (pkmns[0 ], pkmns[1 ]);
35
+ }
36
+
37
+ clear_screen ();
38
+ slow_print ((ai.hp == 0 ) ? " You Won :)" : " You Lost :(" , 50 );
34
39
35
40
return EXIT_SUCCESS;
36
41
}
You can’t perform that action at this time.
0 commit comments