GithubHelp home page GithubHelp logo

game_of_life's Introduction

Реализована "Игра в жизнь" через терминал на языке C в интерактивном режиме с возможностью смены скорости игры и загрузкой стартового поля 80 на 25 символом из файла grid.txt. Предусмотрена безболезненная реализация динамической генерации сетки поля (немного измените функцию initializeGridDataFromFile(), заменив всё, что там есть на генерацию нуля или единицы для каждой из перебираемых клеток при помощи библиотек <time.h> и <stdlib.h>.

Управление: s - ускорить игру на 50ms; f - замедлить игру на 50ms; q - выйти из игры и закончить исполнение программы;

video.mp4

Рекомендации по компиляции через Makefile: make && ./game_of_life.out или make && ./game_of_life.exe.

Славного времени суток и приятной игры!


The "Game of life" is implemented through a terminal in C in interactive mode with the ability to change the speed of the game and load the starting field 80 by 25 characters from a file grid.txt . A painless implementation of dynamic field grid generation is possible (slightly change the initializeGridDataFromFile() function, replacing everything that is there with generating zero or one for each of the cells being sorted using <time.h> and <stdlib.h> libraries.

Controls: s - speed up the game by 50ms; f - slow down the game by 50ms; q - exit the game and finish the program execution;

Recommendations for compiling via Makefile: make && ./game_of_life.out or make && ./game_of_life.exe .

Have a nice time of day and have a nice game!

Пример кода изменения функции\Example of a function change code (initializeGridDataFromFile(data)):

void initializeGridData(int grid[25][80], int size[2]) {
    for (int i = 0; i < size[0]; i++) { // Проходим по каждой строке сетки.
        for (int j = 0; j < size[1]; j++) { // Проходим по каждому столбцу в текущей строке.
            grid[i][j] = rand() % 2; // Инициализация каждого элемента сетки случайным значением 0 или 1.
        }
    }
}

game_of_life's People

Contributors

fanzholl avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.