Log In  

Cart #nusudeteju-3 | 2022-01-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

First milestone for a battleship game. Everything is functioning, but lots left to do.

Currently there's still no AI, sound, artwork... though I've already learned a lot with this project. I figured out how to set up an external editor, do some basic logging, and how pallet changing works.

Next up is the AI, which is definitely an area I'm more comfortable with, though I'm sure I'll find some challenges anyways!


Updates:

  • Added a simple AI
P#104590 2022-01-09 02:07 ( Edited 2022-01-23 03:48)

Battleship is one of my favorite thinking games, @scarecrw.

And - you are in good company:

https://www.lexaloffle.com/bbs/?tid=40375
https://www.lexaloffle.com/bbs/?pid=67006
https://www.lexaloffle.com/bbs/?pid=67070

Lemme know if you want some suggestions for a strong AI. There are some methods I use that are quite effective in playing.

P#104601 2022-01-09 03:08 ( Edited 2022-01-09 07:17)
1

I see you updated, @scarecrw. Your AI is a little off. When it found my biggest ship it started pegging a vertical line as it should - then halfway through it went to the horizontal side where there was no target nor hit.

After that move it continued back on its vertical line.

I'm not sure why it did that. Other than that your AI seems sound and competitive.

And I would have levels of play.

  • Brain dead. Random location always.
  • Smarter, follows a hit but can go side to side where there is no target.
  • Smarter still, follows a hit correctly but does not target based on existing and remaining ships.
  • Smartest of all. Takes into account remaining enemy ships and targets squares where the highest % chance of them being there is. Scans every square every move to do this. Never deviates from when finding a hit and adjacent hit. Has calculated and ruthless intelligent and deductive ability.
P#105532 2022-01-23 01:22 ( Edited 2022-01-23 05:11)

@dw817

Thanks for the feedback! Yeah, I tried to take a shortcut with the AI and it caused that bug. I'm pretty sure I know how to fix it, so I'll take a look at that one when I get a chance.

I'd like to add in some more thoughtful guesses for when there are no half-sunk ships; I've played around with a similar AI before, though I'm still getting used to Lua and pico-8 limitations, so we'll see if I'm able to adapt that.

Thanks again for the suggestions, I'll definitely look at adding difficulty levels!

P#105535 2022-01-23 01:51

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 18:45:59 | 0.054s | Q:18