aboutsummaryrefslogtreecommitdiff
path: root/cpp01/ex02/main.cpp
blob: e8fb2c947497694d7e1e6a085d5a71c77476e128 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: charles <charles.cabergs@gmail.com>        +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/13 09:47:21 by charles           #+#    #+#             */
/*   Updated: 2020/11/09 10:33:18 by cacharle         ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <cstdlib>
#include <ctime>
#include <fstream>
#include "Zombie.hpp"
#include "ZombieEvent.hpp"

int main()
{
	Zombie*     z;
	ZombieEvent zevent;
    Zombie      zStack("onTheStack", "IdontLikeHeap");

    int seed;
    std::ifstream devRandom("/dev/random");
    if (devRandom.is_open())
    {
        devRandom.read((char*)&seed, sizeof(int));
        devRandom.close();
    }
    else
        seed = time(NULL);
	srand(seed);
	zevent.setZombieType("NotRandom");
	z = zevent.newZombie("jean");
	zevent.setZombieType("random");
	delete z;
	for (int i = 0; i < 5; i++)
	{
		z = zevent.randomChump();
		delete z;
	}
	return 0;
}