Jump to content
  • Advertisement

margarit

Member
  • Content Count

    6
  • Joined

  • Last visited

Community Reputation

147 Neutral

About margarit

  • Rank
    Newbie

Personal Information

  • Interests
    |programmer|
  1. margarit

    TicTacToe game attempt review

    @Alberth & @Kercyn Still this stuff in C++ confuses me a bit. Like, I know that when you need to pass a value to read it only, you need to put const keyword in front of the parameter, and pass it by reference (or pointer). However, I'm not sure when to use pass by reference or pass by pointer. As I've understood: - pass by value means copying the object in the function's scope - pass by reference means passing that specific object into the function  - pass by pointer means passing only the address of the object    @MarkS Surprisingly, it allowed me to initialize the array without a constant expression. Not sure why and also not sure why you'd need a constant when you allocate the array on the stack. As for the different syntax of the array, correct me if I'm wrong: - Player players[numOfPlayers] would allocate the memory on the stack (or in the context where the array is declared - in this case the stack, because it is declared in function). - Player * players = new Player[numOfPlayers] would allocate memory on the heap while keeping a reference on the stack.  - delete [] players would free the heap memory allocated for the array, but the players reference would still remain. Therefore, a players = nullptr would be good practice after the delete. Am I correct?   Thanks for the tips, guys. This game is a way for me to learn to program in C++ and to do games development. I skipped the basic checks and the flow of the game lacks stuff because I wanted to concentrate on things that I found confusing. Things like making the game use a bot when there's only one player, doing some artificial intelligence, although my bot is reaaaaaaaly dumb now. I am still not really sure how should I go about making it smarter.   I am thinking of making my bot look for situations where the other player could win. For example, when the bot finds two X's in row, he should put his mark on the cell that's empty on that row. Some tips on AI would be appreciated (everything I find on the web now is too confusing... minimax algorithm? It seems to complex for me, for now).   Also, one other thing that I'd like to do is provide a GUI for the game. I kind of learn by doing. :)
  2. margarit

    TicTacToe game attempt review

    Thank you for the feedback!  @Mark  AutoPlayer was supposed to be the bot, but I thought it'd be easier to implement the code for the bot in the Player class itself, because a bot is as well a Player, right? :)  I downloaded your code and read it and already learnd some new syntax (I'm new to C++), so thanks for that. I'll try to compile it tomorrow (got to set up visual studio - currently I'm on notepad++ and cli g++) and then fool around with it, change few lines here and there. Hope you don't mind. @Alberth Coming from PHP and Java, I was thinking that "using namespace" is some sort of equivalent of Java's import. I see now that it is more like import static. About the long method, indeed it needs refactoring. To be fixed in the next "release".  :lol: Thanks again, now I go and try to make the analyze method smarter. 
  3. margarit

    TicTacToe game attempt review

    I'm sure the files are in there. I set the project's privacy so anyone could view and clone it. Not sure why it's not working. Anyways, I've uploaded the files to uploadfiles.io. Here's the link: https://ufile.io/a6863 Thank you for the patience. :)
  4. margarit

    TicTacToe game attempt review

    Oh well, it turns out that gitlab's privacy settings confused me a lil' bit. It should be OK now, I set the project to public and anyone can clone it without needing authentication. 
  5. margarit

    TicTacToe game attempt review

    Sorry for that. For some reason, the extension got trimmed when I copy-paste the link. https://gitlab.com/bogdan.margarit/TicTacToe.git git@gitlab.com:bogdan.margarit/TicTacToe.git This should do. I don't know if gitlab requires someone to be logged in in order to view projects, as I always login.
  6. First of all I want to say hello to everyone! I'm new around here and this is my first topic. Not long ago I've started to learn about games programming with C++ and I attempted to implement a CLI tictactoe game from scratch. This is my first attempt ever to program a game, but I want to learn as much as I can... because I simply enjoy doing this stuff. It's really fun. Anyways, I do not have any firends that have experience with programming games (or C++, for that matter) and that's why I ask you guys here if you could take a look over my code and tell me what you think, it'll help me a lot. Here's my gitlab repository. https://gitlab.com/bogdan.margarit/TicTacToe Thanks in advance! :)
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!