d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Peer-to-peer C++
Prev123Next
Add Reply New Topic New Poll
Member
Posts: 11,273
Joined: Apr 26 2008
Gold: 3,303.50
Oct 14 2018 03:09am
Quote (kasey21 @ Oct 14 2018 02:30am)
Unfortunately I probably won't be able to implement the probability as it will be a console game. Seems to be too complex to implement the required counter for the cells in a console program. Or at least too complex for me to calculate each individual cell for it. There is probably a simple loop that calculates it all for each cell but I just can't think of it right now. I will cross that bridge when it comes time.



implement the what? xD
Member
Posts: 11,153
Joined: Aug 23 2008
Gold: 4,230.00
Oct 14 2018 03:51pm
Quote (xapeu @ Oct 14 2018 11:09am)
implement the what? xD


the last algorithm that weighs the probability of a ship being on a specific space by calculating how many times that space can be used
Member
Posts: 12,703
Joined: May 17 2013
Gold: 12,935.00
Oct 15 2018 08:00am
Quote (kasey21 @ 14 Oct 2018 00:37)
Would I still require the hole punching and server for LAN play? wasn't planning to run this over the cloud. Just local lan setup.


Nope, then it's quite easy to deal with :-)

The hard part about networking in games is transversing firewalls/NAT. That's not necessary in a LAN.

Member
Posts: 31,680
Joined: Nov 10 2007
Gold: 1.00
Oct 16 2018 10:39pm
Quote (kasey21 @ 13 Oct 2018 21:30)
Unfortunately I probably won't be able to implement the probability as it will be a console game.


Post what you have so far.

I'm interested in seeing how you implemented this Battleship game so far.

Console/Terminal or talking to the graphics driver makes no difference. DirectX/OpenGL/SDL/SFML/<insert here> does not magically do anything for you.

The A.I. shouldn't be too hard to implement. The more problematic issue is: How smart and fast do you want the opponent to learn?
Member
Posts: 11,153
Joined: Aug 23 2008
Gold: 4,230.00
Oct 16 2018 11:51pm
Quote (Muted @ Oct 17 2018 06:39am)
Post :blush: what you have so far.

I'm interested in seeing how you implemented this Battleship game so far.

Console/Terminal or talking to the graphics driver makes no difference. DirectX/OpenGL/SDL/SFML/<insert here> does not magically do anything for you.

The A.I. shouldn't be too hard to implement. The more problematic issue is: How smart and fast do you want the opponent to learn?


I plan to start the project this weekend. If I make enough progress on the AI, I will post it. I only said it sounds more difficult, but I will find out when I get there.
The only other programming experience I have is self-taught C#. I only assumed it is easier to program when it is not console due to how easy I found programming in C# via creating objects.
Not sure if it would be a similar experience in C++.

The reason I imagine it being more difficult is because I'm not dealing with an object, but what will probably be coordinates. Usually I can just assign the priority to the object, but in the console there is nothing to assign it to. Maybe it's own array?
The calculation as I imagine it for the probability of each cell/coordinate is more difficult as well. As objects are naturally easier to work with for me.

The A.I. as a whole I don't see being too difficult for the Random, Parity, and the Hunt modes. Just will take more thought on my part for implementing the priority of each coordinate and then have the AI choose random from all the higher priority spots.

This post was edited by kasey21 on Oct 16 2018 11:53pm
Member
Posts: 31,680
Joined: Nov 10 2007
Gold: 1.00
Oct 16 2018 11:55pm
Quote (kasey21 @ 17 Oct 2018 00:51)
I plan to start the project this weekend. If I make enough progress on the AI, I will post it. I only said it sounds more difficult, but I will find out when I get there.
The only other programming experience I have is self-taught C#. I only assumed it is easier to program when it is not console due to how easy I found programming in C# via creating objects.
Not sure if it would be a similar experience in C++.

The reason I imagine it being more difficult is because I'm not dealing with an object, but what will probably be coordinates. Usually I can just assign the priority to the object, but in the console there is nothing to assign it to. Maybe it's own array?
The calculation as I imagine it for the probability of each cell/coordinate is more difficult as well. As objects are naturally easier to work with for me.

The A.I. as a whole I don't see being too difficult for the Random, Parity, and the Hunt modes. Just will take more thought on my part for implementing the priority of each coordinate and then have the AI choose random from all the higher priority spots.


Are you trying to write this strictly with C++ or platform-dependent calls?

ncurses should be fairly simple for *NIX systems.
Win32 is equally easy for working with the console.

Colors, exact cell drawing (writing entire blocks of memory in one foul swoop), etc.
Member
Posts: 11,153
Joined: Aug 23 2008
Gold: 4,230.00
Oct 17 2018 12:01am
Quote (Muted @ Oct 17 2018 07:55am)
Are you trying to write this strictly with C++ or platform-dependent calls?

ncurses should be fairly simple for *NIX systems.
Win32 is equally easy for working with the console.

Colors, exact cell drawing (writing entire blocks of memory in one foul swoop), etc.


This is for a Programming Fundamentals I which uses c++ . So I'm trying to keep it to c++. Especially since this is my first formal programming class.
Member
Posts: 31,680
Joined: Nov 10 2007
Gold: 1.00
Oct 17 2018 12:03am
Quote (kasey21 @ 17 Oct 2018 01:01)
This is for a Programming Fundamentals I which uses c++ . So I'm trying to keep it to c++. Especially since this is my first formal programming class.


In that case: You'll want to use some sort of pseudo clear screen function. The only sensible one I can think of would be outputting a static string (or something similar) filled with 25(?) newlines (default Windows console height).

IIRC: 25h x 80w is the default size from Windows 95+.

Are you planning on using C++11, C++14 or C++17? I'm deathly curious. :)
Member
Posts: 11,153
Joined: Aug 23 2008
Gold: 4,230.00
Oct 17 2018 12:21am
Quote (Muted @ Oct 17 2018 08:03am)
In that case: You'll want to use some sort of pseudo clear screen function. The only sensible one I can think of would be outputting a static string (or something similar) filled with 25(?) newlines (default Windows console height).

IIRC: 25h x 80w is the default size from Windows 95+.

Are you planning on using C++11, C++14 or C++17? I'm deathly curious. :)


system("cls"); //clear screen-

and not sure. Using newest Visual Studios if that indicates which one I'm using. :blush:
Member
Posts: 31,680
Joined: Nov 10 2007
Gold: 1.00
Oct 17 2018 12:41am
Quote (kasey21 @ 17 Oct 2018 01:21)
system("cls"); //clear screen-

and not sure. Using newest Visual Studios if that indicates which one I'm using. :blush:


Why would you use system("CLS")?

Linux uses clear and not cls.
Go Back To Programming & Development Topic List
Prev123Next
Add Reply New Topic New Poll