Creating a 2 player game in Python - python

My friend challenged me to make a version of the popular game "Battleships" that we could play against each other. If you don't know the game, it's not really important because the hard part for me would be not to make the game but to figure out how we can play it against each other both from our computers. I have previously made the same game, only for one player (I'm using Python) so what I want to find out now is:
What is the easiest way? (I was thinking about Hamachi).
Where and with what should I start with?
Thanks in advance :)

I would suggest starting out by making a non-networked version of the game that supports 2 players in the same program instance/window. This way you'll be able to re-model/design your code to support 2 players in the first place.
If that's working, you have to choose a networking library to use (or raw TCP/sockets), think about the problem a little bit, and refactor/split the program in such way that you can separate the 2 players into 2 separate programs communicating with each other over network.
For networking, RPC (Remote Procedure Call) is probably the easiest to use choice for you; for options, check out: What is the current choice for doing RPC in Python?. Or you might just want to go with something very primitive such as socket, or a bit less primitive such as ZeroMQ.
You might also be interested in this: http://pygnetic.readthedocs.org/en/latest/:
pygnetic is a library designed to help in the development of network games and applications in Pygame

Related

Track GPS data for a certain time with Python

I want to create a fitness program using python.
When the user creates a account in my program he/she needs to have the option to select the location of their gym or the place where they workout. So in other words, a map opens up and the user has to find the place where they workout and mark it.
Then, I want to use the GPS of their phones in order to look if they were at least 30 minutes inside a 30 meter radius from the mark (their gym, or other place where they workout) in 24 hours.
If they were, I want to count that day.
My questions are:
Is this thing even possible?
Is python the best programing language for this or should I use something else?
Is there any library for Python that can help me?
Thank you in advance!
Are you planning on making a phone app for iOS/Android?
Since you said you maps on their phone, I am assuming you mean a phone app.
I would suggest learning Objective-C, if you are trying to make apps for iOS specifically, and the preferred language of implementation for Android would be Java.
With that said, you absolutely can use python to develop an Android or iOS app with something like BeeWare! Which is a nice suite of python tools so you can build your program from the ground up with pure python.
So there are many options with advantages/disadvantages; everyone will give their two sense on which is the best way to approach, but I would suggest researching the many ways phone apps are developed to get your feet wet and get familiar with the process before going head first at those additional questions!
It is a bit different than writing a python program on your computer, running it on command prompt/terminal and being good to go!

Drawing meteorological maps in python

I found a user friendly way plotiing meteorological maps with python. I found this flight path tool, http://www.aviationweather.gov/flightpath2?gis=off , and i want to make something like this in python. I have made the scripts retrieving the data and plotting the maps but i want to make the interface. Is it difficult? Do you have any ideas?
Are you wanting to make a web-based interface? If so, I suggest maybe Django. If you want just a script with some nice GUI on a local machine, I think Qt is easy to use. I can't run the java file from aviationweather.gov (or rather, do not wish to) so I don't know what the interface is like. But using either Django or Qt, I think those are the tools I would start with.
Check out the video here.
https://blogs.msdn.microsoft.com/visualstudio/2016/03/22/introducing-r-tools-for-visual-studio-3/
Start watching about 7 minutes into the video. I think that will be a great learning experience for you, and should get you going in the right direction.

Drag and Drop realization

I am a music teacher and trying to teach my students with some hand-made program.
I had learned programming language in a elementary level, such as Python, Java, Pro-log etc.
I have a Open Lecture with parents of my students upcoming 12/12, so I want to make a simple lecture program.
Two Image Below is the U.I. which I want to realize.
4/4beat_practing1
4/4beat practing2
First, I want to make an apple droppable to match the gray-colored field. I want (half-sized apple should be matched to half-sized grayfield, and same for the full-sized color.)
Second, I want to make notes are droppable so that they could be aligned on the bar. In this case, it the summation is not 4/4beat, I want to show Error.
In which way, I could make this program fast?
I think I can encode the elementary level of programing such as checking out whether the summation is 4/4beat or not, however, I don't know how to connect programmed codes being linked with those images and User interfaces yet.
For an application like that, I would suggest using PyGame. I've seen beginning students with no programming skill at all make impressive games in only a few weeks with it.
Unfortunately, I'm not a game builder so I can't answer technical questions about PyGame. But I do know it has the sound and graphics libraries you need for your demonstration.

Search Screen with Python

I'm working on making a "bot" for a game I play on my computer (windows8.1) just to see if I can. One of the tasks I need to automate is to find something on the screen. I can't get the sprites for the game though. I tried taking a screenshot and searching the screen for that image but it fails because the exact image is not on the screen. I imagine I would need to check pixels (if that's possible)
I'm not looking for actual code as an answer. I just need somewhere I can learn how to do what I want to do. Any help is appreciated!
When making "bots" like you do, your approach of searching for pixels is usually a bad practice. It's really error-prone and needs a ton of computing power.
Other popular tools (for example the hearthstone deck tracker) are checking the ram for the current state of the game. This is the safest and best approach.
Python is probably not capable doing that.
Java, C++ or C# are the language you want to write a bot in. I'd highly recommend you switch to one of these.
The Hearthstone Deck Tracker is an open source project on github. Check the code if you want to learn something about bots / tools https://github.com/Epix37/Hearthstone-Deck-Tracker.

Using Python to tie together a DLA AI

So, I am completely new to programming. I've been learning basic Python over the last couple weeks. I've always wanted to learn a programming language but right now my primary reason for delving into it is to Create an AI program for my man cave. Here are my Ideas which I am sure have been thought of many times before. They are just my goals:
I would like to take a pre-established open source chat bot and tie it to a Natural Language process to give it the ability to convert my speech to a text command that it can execute and at the same time take its text output and filter it through an audible speech sample (very much like SIRI). This way when I have the function of Natural Language response on, I can have basic conversations with it. I can also turn the conversational aspect off via a voice command so that the only thing it responds to is direct commands (e.g. "Gerard, please open an email, execute. Recipient, logan.wolf.ypher#gmail.com, Subject, Hello World, Body, insert text i speak.)
I would also like to have it recognize that I am there when my phone attempts to connect to the wifi.
I know that this may be a bit complicated for me at the moment but I hear the best way to learn a language is to jump on into a project you enjoy.
Does anyone have any pointers on where to start looking for a base AI or just any tips in general that you wish to give me? I'd appreciate the info very much. Thank you.
-Logan
Considering that So, I am completely new to programming, I would recommend you take a smaller part of this project and successfully implement it. For example, an email account which is checked every 1 minute and you can send textual commands to it. From there, start upgrading it to use chat, cell phone, speech-to-text, and lastly, AI. I only say this because I know the diffulculty of starting a too-ambitious project when I am new at an area (electronics, engineering, programming, language, etc...) and fail. Success, even in small steps, is better!

Categories

Resources