I am kind of new in programming (I only know python). Yesterday I finished making a 2048 game (running in the command line). Now I decided to make an AI that would auto-play, but I don't want this AI to run each time I run the game.
So to my question, is there a way to make a program/script to actually input (in the command line) and read data from another program?
My "move" code from my 2048 game:
def move():
global board
direction = "x"
while direction != "a" and direction != "w" and direction != "s" and direction != "d":
direction = raw_input("Where do you want to move?(WASD)")
direction = direction.lower()
if direction == "a":
left()
elif direction == "w":
up()
elif direction == "s":
down()
elif direction == "d":
right()
So what I want is a second program that is actually inputting in the( direction = raw_input("Where do you want to move?(WASD)")) instead of the player.
Is there a way to do this? Edit: I am running windows 10