AI Games and its programming solution with Python.

Overview

Problem: Save the princess:

Problem defination on Hackerrank:

https://www.hackerrank.com/challenges/saveprincess

About problem:

Princess Peach is trapped in one of the four corners of a square grid. You are in the center of the grid and can move one step at a time in any of the four directions

Input format

The first line contains an odd integer N (3 <= N < 100) denoting the size of the grid. This is followed by an NxN grid. Each cell is denoted by '-' (ascii value: 45). The bot position is denoted by 'm' and the princess position is denoted by 'p'.

Grid is indexed using Matrix Convention

Output format

Print out the moves you will take to rescue the princess in one go. The moves must be separated by '\n', a newline. The valid moves are LEFT or RIGHT or UP or DOWN.

Sample input

3
---
-m-
p--

Sample output

DOWN
LEFT

logic:

  • First compute position of Bot and Princess
  • compare their positions based on x distance and y distance
  • if x distance is higher then take either up or down move.
  • if y distance is higher then take either right or left move.
  • follow this steps until reach to the goal position.
Owner
Hasit Parmar
An enthusiastic Software Engineer with good experience in various domains. Proficient at Python development frameworks. Highly interested in Machine Learning.
Hasit Parmar
Pratice Project - Tic tac toe game

Hello! This tic-tac-toe game project and its notes are result from a course pratice milestone. The project itself is written in Python using the Jupyt

Rafael Nascimento 1 Jan 07, 2022
Un semplice Snake game , come negli anni 90!

Project-SnakeGame Un semplice Snake game , come negli anni 90! ITA VI porto un semplice giochino per i nostalgini degli anni 90 , ispirato al vecchio

Matt K Lawrence 1 Oct 17, 2021
Command-line Hangman game

Hang-_an-game-python-build Hangman C command-line Hangman game. Compilation Navigate to the root of the repository from your Terminal and run make to

Hemant Choudhary 3 Jan 16, 2022
Rudimentary CMD based implementation of the Tic Tac Toe game

Packages used: questionary random os (Requires Python 3.8 as walrus operators are used in the script) Contains the .py file (tictactoe.py) and an exe

Ashwin 1 Oct 15, 2021
Minecraft - Online Players Overlay Generator

Minecraft - Online Players Overlay Generator Contents About Quick Start Download Pre-Built Binary Run from Source Configuration Command-Line Options F

4 Sep 12, 2022
Blackjack Game made using Python

Blackjack Game made using Python Blackjack is a popular card game played in most of the casino.This is an intuition to replicate the same card game us

SUHASJAGADISH 1 Nov 28, 2021
PyCraft - A Minecraft launcher made in python

A Minecraft launcher made in python. The main objective of this launcher is to enable players to enjoy minecraft (especially those without a mojang/microsoft account). This launcher is not illegal as

38 Dec 12, 2022
Text-Adventure-Game [Open Source] A group project by the Python TASK Force

Text-Adventure-Game [Open Source] A group project by the Python TASK Force

Mircea Dumitrescu 2 Sep 17, 2021
Wordlebot - A simple Wordle puzzle solver in python

WordleBot A simple search-based puzzle solver for Wordle, built in Python. Inspi

Rob Kimball 2 Jan 27, 2022
A tool for the creation of rooms used in maps in the game Wastelands

Wastelands Room Data editor A tool for the creation of rooms used in maps in the game Wastelands Creates .wrd files, that get loaded by the map genera

Avant 6 Jul 12, 2021
SelectionSortVisualization - This pygame project is helping you to understand the selection sorting algorithm

SelectionSortVisualization (If you have any comments or suggestion, please conta

Berkay IPEK 3 Feb 17, 2022
πŸ₯•Try and keep da carrot alive or else . . .

Carrot πŸ₯• Warning πŸ’₯ : I am not a botanist. I do not study carrots or plant life. I am a noob programmer :P. So don't belive anything you see in this

1 Jan 03, 2022
This is simple minesweeper-like Telegram game

This is simple minesweeper-like Telegram game. You need to open all "free" squares and put flags on squares with bombs on them. If you open a cell with a bomb, the game is over.

Aleksandr 32 Dec 31, 2022
Historical battle simulation package for Python

Jomini v0.1.4 Jomini creates military simulations by using mathematical combat models. Designed to be helpful for game developers, students, history e

Ümit Kaan Usta 36 Dec 08, 2022
MiTM proxy server for Darza's Dominion

Midnight A MiTM proxy server for Darza's Dominion, PC version. See this video for a demonstration of godmode: https://youtu.be/uoqvSxmnCJk How to use

2 Oct 24, 2022
Overview: copain, your friendly AI framework to learn and play games

Overview: copain, your friendly AI framework to learn and play games Interface fceux with python and run reinforcement learning. Compatibility Current

fcharras 1 Dec 16, 2021
Python codes for the classic Hang Man game

Python codes for the classic Hang Man game. The user will be assigned a random word to guess, one character at a time. If the user gets everything right, the program says Well Done!, but if the user

p.katekomol 1 Jan 25, 2022
Snake game made in python with the pygame library.

Pygame snake Snake game made in python with the pygame library. Requirements pip pygame Pygame Installation On the command line, type: pip install pyg

Ayza 3 Oct 02, 2022
Aftermath is an anti token grabber written in Python3.

🎈 Aftermath 🎈 Aftermath is an anti token grabber written in Python3. This tool with a GUI setup is checking the Downloads folder to search for token

Billy 39 Dec 16, 2022
This a Chess PGN saver which allows you to save your game pgns, in a .pgn file

PGN Saver This a Chess PGN saver which allows you to save your game pgns, in a .pgn file This can be a very useful tool for the people using chessbase

3 Jan 06, 2022