Questions tagged [ai]

Artificial intelligence (AI) is the branch of computer science and technology that studies the development of machines able to simulate aspects of human intelligence.

Filter by
Sorted by
Tagged with
7
votes
1answer
104 views

Hill Climbing Egg Holder function - escaping local extrema

Here is the Egg Holder function for \$m\$ dimensions: $$\displaystyle f(x)=\sum_{i=1}^{m-1}\left[-(x_{i+1}+47)\sin\sqrt{|x_{i+1}+x_i /2 + 47|} -x_i \sin\sqrt{|x_i - (x_{i+1}+47)|}\right]$$ I am ...
3
votes
1answer
201 views

Minimax algorithm for tic tac toe in Python

I am using minimax algorithm (for now without alpha beta pruning) for AI in tic tac toe game in Python and Numpy. It's working, but very slow, so I would like to optimize it. A few rules for current ...
4
votes
1answer
54 views

FIrst time trying tree classifier in python

Recentely I have started teaching myself some basic AI concepts and this was my first attemp at using a random forest in order to classify the iris data set. It would be great if anyone could give me ...
6
votes
1answer
124 views

Minimax implementation of tic tac toe

I have the following working tic tac toe program. Someone said it's a convoluted mess and I'm looking for pointers on how to clean it up. ...
6
votes
1answer
121 views

Improved first Tic-Tac-Toe + Minimax AI

Posted my first attempt at Tic-Tac-Toe a second ago here. Got a lot of great and helpful responses. The main things I took away from these responses was to use spell check, and to keep things simple. ...
4
votes
0answers
76 views

Chess AI Using Minimax and Alpha-Beta Pruning

I am working on a Chess AI using chess.js, and currently, it can run 3 layers in under 10 seconds, but 4 or more takes minutes. How can I optimize my current code to be able to run 4 or 5 layers, or ...
3
votes
2answers
605 views

Tic-Tac-Toe Player vs Computer

I have created a logical AI for a Tic-Tac-Toe game. I want a review about how good or bad it is. Here the computer AI will defend all your attacks as well as try to attack whenever it gets a chance. <...
2
votes
0answers
38 views

Initializing Reinforcement Learning Q-Table State Space-Python

The code below is a "World" class method that initializes a Q-Table for use in the SARSA and Q-Learning algorithms. Without going into too much detail, the world has "Pickups" and "Dropoffs" that can ...
6
votes
1answer
341 views

Tic-Tac-Toe with changeable board size (Part 1)

Part 2: Tic-Tac-Toe with changeable board size (Part 2) I've created a Tic-Tac-Toe program with python which has a option to change a standard 3x3 board to NxN board. I've also created easy, hard and ...
5
votes
1answer
128 views

JavaFX Connect Four AI

I made a Connect Four AI with minimax algorithm. It's my first bigger JavaFX project. Any help for improvements would be really appreciated. Board: ...
4
votes
1answer
93 views

A command-line unbeatable Tic-Tac-Toe written in C

I'm trying to learn programming and this Tic-Tac-Toe is one of my first projects. The user gets to start first as 'x' or second as 'o'. Please give me any criticism you find on the code and give ...
2
votes
1answer
59 views

Game AI to slow to work

I have written some python code to play this scratch game. But it is to slow to function correctly because each frame if it clicks, it takes a screenshot of almost the same thing like this ...
3
votes
0answers
345 views

A simple toy ResNet model and its implementation

I want to understand how resnet works also called us residual networks and I understand it better when I code one myself. I tried to find a simple implementation of resnet in the web but most I found ...
6
votes
1answer
166 views

Chess engine programmed in Python

I programmed a chess AI in Python. It uses the alpha-beta algorithm with move ordering. I want it to be able to look further than depth 4, without increasing calculation time. I am wondering how I ...
0
votes
1answer
163 views

Could someone check the Minimax Algorithm correctly implemented? [closed]

I'm working on AI tic-tac-toe that computer make a move and I wanted to know that I correctly implemented the minimax algorithm. Please someone check my code to identify a problem or any kind of bug. ...
3
votes
2answers
69 views

Genesis, an AI that learns as you talk to it

This is a programming challenge I set for myself a while back to create an AI that starts with no knowledge of anything whatsoever, and learns as you talk to it. (It can learn stuff like your name, ...
2
votes
0answers
115 views

Repetitive Tic-Tac-Toe AI game with Python 3

I have a text based Tic-Tac-Toe game with a simple AI element that will take winning moves and block losing moves. The one piece of criticism I received was that I was 'hard coding' too much. I can ...
7
votes
5answers
699 views

Tic Tac Toe in C w/ ncurses Revision

Someone in this thread said I could ask for a review of my revision: Ncurses Tic Tac Toe with simplistic AI I re-wrote it from scratch using the suggestions from the answers. In particular I did the ...
4
votes
1answer
161 views

Tic tac toe with unbeatable AI

I wrote this simple command line interface tic tac toe game with unbeatable AI with unittests. Looking for any suggestions how to improve it. Game: ...
14
votes
3answers
1k views

Ncurses Tic Tac Toe with simplistic AI

I have read your rules and in particular the part about bite-sized portions, so I am apprehensive about posting this but want to do it anyway. I have recently begun getting into C and in particular ...
3
votes
1answer
569 views

C++ Battleship player AI

Found this project online and looking for some guidance. I'm in the process of developing a Battleship AI that will play against different computer difficulties. The "barebones" part of the project ...
2
votes
1answer
109 views

Filling up a hand with random cards that are not yet drawn - Monte Carlo

I would like to know if there is a more efficient way to speed up below code. This function is meant to fill in a set of poker hand with the remaining cards using Mersenne Twister for a Monte Carlo ...
4
votes
1answer
188 views

Offline .io style game built in Unity

I am creating a .io style game through Unity and it's coming along nicely. This is my first time working with Unity, and my first time using C#; I have been a Java coder. Could you good people tell me ...
2
votes
0answers
116 views

Simple Neural Network from scratch using NumPy (Python)

I added learning rate and momentum to a neural network implementation from scratch I found at: https://towardsdatascience.com/how-to-build-your-own-neural-network-from-scratch-in-python-68998a08e4f6 ...
0
votes
2answers
336 views

Battleships “AI” function

I would like some advice on how I could shorten my function from my battleships game (below). Essentially what it does is it checks if a coordinate is a hit and if it is, then if checks adjacent ...
2
votes
1answer
633 views

MiniMax Algorithm

This is my C implementation of the Minimax Algorithm to play tic-tac-toe. I consider myself a C beginner so any feedback on style, best practices, or efficiency is more than welcome. ...
5
votes
0answers
399 views

2048 AI in Python 3

I am working on an 2048 AI and this is my code so far. In the game 2048 you have a 4x4 grid in that some random so named tiles spawn. Each tile has a number. The lowest number is 2. By using the left,...
6
votes
1answer
70 views

Simple neural network implementation in Python

A simple neural network I wrote in Python without libraries. I avoided implementing it in matrix form because I sought to get a basic understanding of the way NN's work first. For that reason I'm ...
10
votes
0answers
293 views

BattleShip - Ships & Players

I'm making a full-blown OOP Battleship game in VBA (previous post: Battleship Grid), and I want this code to be as good as it gets - and better, if I can. I've refactored a few things, introduced a <...
2
votes
0answers
99 views

Tic Tac Toe game becomes more inefficient as time goes on

I designed a tic tac toe using 4 classes. The game class being the main class, the board class being the board, the player class being the decision making, and the AI class keeping the previous game ...
11
votes
1answer
636 views

A Tic-Tac-Toe game in MonoGame

I've started learning MonoGame and C# lately, so in order to get more confident with both and do something not completely trivial, I've built a Naughts and Crosses game. I am using 7.1 version of C# (...
5
votes
0answers
39 views

Macao, a General Game Playing AI library - Game state goes in, best move comes out

I'm working on a simple General Game Playing AI library. The idea is that it should work with almost any kind of game, with a minimum of configuration. At the moment, I have it working on 2 player ...
5
votes
2answers
365 views

Python TicTacToe

This is a console based Tic Tac Toe Game I programmed to practice my python. It is object oriented with a few standalone functions for getting user input. The game also has a basic AI that is ...
3
votes
1answer
1k views

TicTacToe with MiniMax algorithm (C#)

A friend of mine asked me to help him with his Tic-Tac-Toe implementation. He's a beginner, so we ended up implementing a simple state-machine that reacts to the moves. I was curious how I might ...
5
votes
1answer
588 views

Reusable AI Game Tree

Problem I needed a minimax game tree so that it can reuse the already generated valid moves, after pruning the moves already made. Unlike Binary Tree, a game tree can have multiple child nodes ...
3
votes
1answer
626 views

Noughts and crosses bot in Delphi

I hope someone can guide me in a way to make this code more efficient. Please explain the things you do simply because I'm no pro so more complex things I am unlikely to get. If you have issues with ...
8
votes
3answers
948 views

Create a clever Specker game player

I am creating a game called Specker in c++. The rules are simple: There are \$p\$ players \$\left(0 \to p - 1\right)\$ and \$n\$ heaps \$\left(0 \to n - 1\right)\$. Starting with player \$0\$ ...
4
votes
2answers
349 views

Java TicTacToe MVC with Singleplayer mode

To practice the MVC pattern and Unittesting in Java I decided to make a simple TicTacToe Console Application. The features of this App are: Multiplayer-Mode Singleplayer-Mode (that should always ...
3
votes
0answers
70 views

Simple Number Game with AI

I have created a simple game and AI in Python. Rules of the game: There are 11 spaces for digits, 9 that are used and 2 that are discarded On each turn, a digit (0 - 9) is chosen and placed in a ...
6
votes
1answer
2k views

Simple Tic-Tac-Toe with Minimax Algorithm - follow up

Based on previous question i implemented most of suggestions. also, i have added Alpha-Beta pruning to minimize the calls. and making the game more generic to accept the board to be any value like 4x4 ...
5
votes
1answer
9k views

Simple Tic-Tac-Toe with Minimax Algorithm

I have implemented AI to tictactoe game by using Minimax Algorithm. The game looks working okay and AI is intersecting the player moves to block him from winning the game. I would like to know if I ...
5
votes
1answer
157 views

Solving Chain Reaction on Small Boards: Verifying Correctness

I'm writing a program that finds the minimax value of Chain Reaction on various small boards (à la Solving Go on Small Boards). Here's a brief description of the game of Chain Reaction: Chain ...
3
votes
1answer
1k views

Make a smart move in a connect-4 program

An assignment this past semester was to write functions such that the following C program would run: ...
16
votes
3answers
2k views

92 Spoons AI, sort of an AI in C++

I have made an AI that takes a user input and returns a predefined value. It that stores its info in a file (with the name of the file "default.92ai"). I thought ...
9
votes
3answers
3k views

Stock Monte Carlo Tree Search implementation to a simple connect 5 game in Python

Requires Python version: 3.6+ fstrings included! External link: https://github.com/thejhonnyguy/Python-Stock-MCTS (Questions below) Main program: mcts.py ...
3
votes
0answers
350 views

PCA, LDA and Logistic Regression

Based on the great blog by Joel Grus, I implemented LogisticRegression, PCA, and LDA. I'd appreciate feedback as I'm not sure that the logistic classifier is good enough (as it supposed to achieve ...
4
votes
2answers
3k views

New way of doing the A* Algorithm

I wrote a Python script for implementing an A* algorithm. Map, Start and Goal are given. The code works well as far as I tested it but I want to get feedback from the best out there too. So I am ...
4
votes
2answers
565 views

Python Tic Tac Toe game with two difficulty levels

I made my version of a tic-tac-toe game for fun, but as being new to coding, I would assume that there are far better ways to make this. I just want to simplify my code down to make it easier to ...
4
votes
4answers
423 views

Tic Tac Toe with SOLID principles

I am making a Tic Tac Toe game to be played in the console either against another human or a simple AI. It is a little rough but it works. What concerns me is how well it adheres to SOLID and other ...
2
votes
1answer
8k views

A* implementation of 8 puzzle

I'm trying to implement 8 puzzle problem using A Star algorithm. The goal state is: 0 1 2 3 4 5 6 7 8 and the heuristic used is Manhattan distance. Here's the code: ...