Skip to content

Commit

Permalink
Merge pull request #12 from FLAK-ZOSO/I/O
Browse files Browse the repository at this point in the history
I/O
  • Loading branch information
FLAK-ZOSO authored Jul 7, 2022
2 parents c71415c + 3a4ed6c commit ca6cdc4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
7 changes: 5 additions & 2 deletions game.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#include <iostream>
#include <cstdlib>

#include "time.h"

#define CLS "\33[2J\33[H"


struct Game {
char matrix[20][50]; // Il campo di gioco
Expand Down Expand Up @@ -112,7 +115,7 @@ void updateMatrix(Game &game_) { // Passo per riferimento la variabile di tipo G


void printMatrix(Game game_) {
system("cls");
std::cout << CLS;

// Stampo la matrice
for (int i = 0; i < 50; i++)
Expand All @@ -121,7 +124,7 @@ void printMatrix(Game game_) {
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 50; j++)
std::cout << game_.matrix[i][j];
std::cout << std::endl;
std::cout << '\n';
}
for (int i = 0; i < 50; i++)
std::cout << '#';
Expand Down
Binary file modified labirint.exe
Binary file not shown.
1 change: 1 addition & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Game game(std::string name) { // Ritorna l'oggetto Game
myGame.zFrames = 0;
myGame.zFuel = 0; // Quante @ devi ancora usare
srand(time(0)); // Rende casuale la generazione di numeri casuali con rand()
// std::ios_base::sync_with_stdio(false); // Rende la console non bloccante

// Informazioni
while ((std::cout << "Bonus frequency (period): ") && (!(std::cin >> myGame.bonusFrequency))) {
Expand Down

0 comments on commit ca6cdc4

Please sign in to comment.