Jump to content
IGNORED

Enemy Lines


Recommended Posts

Dammit, Owen! I was supposed to be working tonight. :)

 

enemylines.jpg

 

 

Enemy Lines is a board game. Each digit you see on the game board above is a pawn. The goal is to get as many of your pawns as possible across the board and onto your color bar. When a pawn reaches the color bar, its number is added to your score.

 

Each turn, one random square on the board will be bombed. Any pawn on the bombed square will be eliminated, and that square will remain impassable for the rest of the game.

 

If your pawn encounters an enemy pawn, the two will battle until one is killed, battling in a manner similar to the dice-rolling battle sequence in the board game Risk. Thus, your 9 could become a 1 or a 2 well before it makes it to the color bar.

 

There will also be a few power-ups to boost your pawns' point values, or decrease your enemy's, but I haven't exactly decided how to implement those yet (esp. given the line limitation).

 

When all of one player's pawns are off the board, the player with the most points wins.

 

My goal is to include at least a simple AI so that the game can be played by one or two players.

 

So far, the pawns are generated and placed properly, and most of the game variables and screen drawing is done. I have to try to condense the turn loop and battle sequence into as few lines as possible.

 

Hopefully this one should only take me a week or so, and then I can get roped into yet another TI-related distraction. :)

Edited by InfernalKeith
  • Like 2
Link to comment
Share on other sites

Only partway through the beginning of the main turn loop, and I'm realizing I may have bitten off way more than 30 lines here. I'll let you know for sure tomorrow, but I may have to pull this game right back out of contention. However, I still think I can finish it in a week or so. The idea is simple and solid, it just needs a lot more room for legal move checking, etc... especially if I want to put any kind of AI on board at all.

 

Onward!

Link to comment
Share on other sites

Worked out some more aspects of gameplay today.

 

At the beginning of each round, a random square on the board will be bombed - it could, potentially, have a player's pawn on it. That square then becomes impassible for the remainder of the game.

 

Each player then 'rolls the dice.' Possible outcomes are 0, 1, or 2. If you get a one or two, you can move a pawn 1 or 2 squares in any direction. If you land on an opponent's square, a battle is initiated, and only one pawn can survive and occupy the square.

 

After your dice roll, you get the option to either combine two pawns into one, or split one pawn into two, if you so desire. The combined pawn has a numeric value of the sum of the original two, no greater than 9. The split pawns divide the original pawn's number in half (obviously, pawns with a value of 1 cannot split). You can do one combine, or one split, per turn, but are not required to do so.

 

I may add more random events to the game, but I want to get this stuff implemented first and see how gameplay goes first.

Link to comment
Share on other sites

  • 1 month later...

Bumping this thread because I'm digging this project back out to finish it over the course of this week, hopefully. Looking over what I have so far, I'm pretty pleased with it. I'm even thinking of adding several different types of AI play style -- giving the user the option of an aggressive, defensive, or random opponent.

 

My plan tonight is to crack a Guinness after the kids are asleep, put some loud music on, and get at least the main play loop finished and working. Wish me luck. :)

Link to comment
Share on other sites

  • 6 years later...

RW05Enj.jpg

 

Hey, it's back!

 

Long story short -- I finished my game "Dicecrash" last year, jumped right into my Risk-like game "Conquest of the Aftermath," and quickly realized I was in over my head. Also, work got busy around that time.

 

A while later, I was revisiting old notes and half-finished game ideas, and realized I've left a LOT of undone projects to quietly die in the forum archives. So I decided I'd revisit some of those and get them done and out into the world, with an eye toward cleaning up my to-do list in 2016 and going back to the big project in 2017.

 

Anyway, I've been fiddling with this game for a bit now, and I have a 2-player playable beta ready. It's turned out better than I expected, and the gameplay is pretty fun.

 

It's kind of a real bloody, kamikaze version of Stratego right now. You can see the "rank" of each pawn on both sides, and you basically have to try to get as many of yours across the board as possible while destroying your enemy when they do the same. One random square gets bombed into oblivion each round, too, which can unfairly take out a pawn and/or block access to the finish line for other pawns.

 

My next step is to play a few rounds with someone and get more of a feel for what else the game needs, and what a good, implement-able strategy for the AI would be.

 

Each player starts with 75 "points" on the board, divided up among their pawns. You can see from the screen above how much of the playfield gets wiped out in the course of one match, and how few of those pawns end up limping across the finish line. I foresee a lot of matches decided by a point or two.

 

More after the weekend!

 

Keith

  • Like 6
Link to comment
Share on other sites

Looking good. I like the yellow background better than the cyan one. ;)

 

Here's a routine for getting slightly smaller digits. They might work with your board design. :)

 

100 display erase all at(10,10):"0123456789";
110 for i=48 to 57::call charpat(i,p$)::read l::call char(i,seg$(p$,1,l*2-2)&seg$(p$,l*2+1,10))::next i
120 goto 120
130 data 4,4,4,4,7,5,4,6,4,4
 
  • Like 1
Link to comment
Share on other sites

5Pku7ov.jpg

 

The numbers look great!

 

In this shot, we're almost to the end of the game. The game is tied. If blue can get that 4 pawn to the other side, blue will win it. It's not looking good for red unless he can block with good defense and eliminate that 4. There's a statistically good chance of both those pawns being blown up before any more points can be scored, leading to a tie game.

 

Hoping to start on the AI for the computer player tomorrow.

  • Like 2
Link to comment
Share on other sites

This isn't a progress update, exactly, but I had to brag on it a little. My 14-year-old son and I tested out the game tonight. When I asked him to play "Dicecrash" (and when he's played most classic games) he showed a polite interest, but couldn't wait to get back to his PS4. We just played "Enemy Lines" for over an hour and he was really into it. He got really psyched up as the game went on and was coming up with suggestions for strategy that I will incorporate into the AI. His verdict is that the game is "pretty awesome." I'm feeling pretty accomplished right now. :)

  • Like 4
Link to comment
Share on other sites

I just realized I don't have WinRAR on my laptop and I have to leave for work, so I'm gonna cut and paste the code here and invite you to do the same.

 

Here's the beta version, minus the AI. It's a working two-player version of the game.

 

There is a minor scoring bug that we discovered last night that I've only seen pop up once, I will try to root it out this weekend.

 

I'm interested in your thoughts on the interface. I like it and my son (who's not used to keyboard-based anything) found it relatively intuitive and easy to use, but I would love some feedback on it.

 

You use the classic ESDX keys to move. You can also move diagonally with W R Z C. If you move a pawn two square, you move, hit enter, then move again. If you move once then press M to cancel, you can use the other move on a different pawn.

 

If you move a pawn onto an enemy pawn, there is a battle until only one survives. If you move a pawn onto another of your pawns, they will merge. If their combined total is over 9, any extra points are lost.

 

If you move a pawn across the board and onto the free zone of your color at the opposite side, you score points for that pawn. If you move backward onto your enemy's free zone behind you, that pawn is sacrificed and your opponent gets that many points.

 

If you move onto a black blown up square with a pawn valued at 6 or higher, you sacrifice that pawn but "fill in" that space, so it can be traversed again. This move is important later in the game, because as more and more squares get blown up each round, getting from one end of the board to the other becomes much of the challenge.

 

If you self-destruct, your enemy gets the number of points that pawn is worth. However, if you end the game with more points - even if you lose all your pawns first -- you still win. So it could be to your advantage to blow up your remaining pawns if the point difference doesn't put your opponent over.

 

I'll write better docs this weekend as well. I'm just excited to be this far along, and still have a decent amount of memory to start on the AI. I hope to offer several different computer player strategies to choose from.

 

Have fun and thanks for checking it out!

90 ! LAST MOD 7-8-2016
91 GOSUB 9000
92 CALL CLEAR :: RESTORE 9999
93 FOR I=48 TO 57 :: CALL CHARPAT(I,P$) :: READ L :: CALL CHAR(I,SEG$(P$,1,L*2-2)&SEG$(P$,L*2+1,10)) :: NEXT I
95 FOR X=48 TO 57 :: CALL CHARPAT(X,X$) :: CALL CHAR(X+56,X$) :: NEXT X :: CALL CHAR(128,"0101010101010101",136,"0101010101010101")
100 CALL SCREEN(12) :: CALL CHAR(37,"FF818181818181FF",97,"01010101010101FF",35,"FFFFFFFFFFFFFFFF") :: CALL COLOR(10,5,2,11,5,2,3,7,2,4,7,2)
103 CALL COLOR(13,7,1,14,5,1)
105 CALL CLEAR :: RANDOMIZE :: CALL CHAR(58,"FFFFFFFFFFFFFFFF",114,"FFFFFFFFFFFFFFFF",36,"0101010101010101") :: DIM SCORE(2),BOARD(2)
110 FOR X=1 TO 10 :: PRINT "aaaaaaaaa" :: NEXT X :: PRINT: : : : : : : : : : : :
115 CALL VCHAR(2,2,97,10) :: CALL HCHAR(12,2,58,10) :: CALL HCHAR(1,2,114,10) :: CALL VCHAR(2,1,36,10)
117 CALL HCHAR(1,1,136) :: CALL HCHAR(12,1,128)
120 TURN=1 :: SCORE(1),SCORE(2)=0 :: BOARD(1),BOARD(2)=75 :: GOSUB 10000! SET AND PLACE PAWN AMOUNTS
130 REM
140 DISPLAY AT(2,11):"PLAYER 1  PLAYER j" :: DISPLAY AT(3,11):"--------  --------" :: DISPLAY AT(4,11):"SCORE     SCORE" :: DISPLAY AT(5,11):"BOARD     BOARD"
150 CALL SCOREDISP(SCORE(1),SCORE(2),BOARD(1),BOARD(2))
160 DISPLAY AT(23,1):"____________________________":"ENEMY LINES TWO PLAYER BETA!"
169 ! MAIN GAME LOOP
170 CALL DELSPRITE(ALL) :: DISPLAY AT(15,1):"":"":"" :: Y=INT(RND*10)+2 :: Z=INT(RND*10)+2 :: CALL GCHAR(Y,Z,X) :: IF X=35 THEN 170
180 IF X>48 AND X<58 THEN BOARD(1)=BOARD(1)-(X-48)ELSE IF X>104 THEN BOARD(2)=BOARD(2)-(X-104)
190 CALL BOMB :: CALL HCHAR(Y,Z,35) :: CALL PAUSE :: CALL SCOREDISP(SCORE(1),SCORE(2),BOARD(1),BOARD(2))
195 IF BOARD(1)>0 AND BOARD(2)>0 THEN 200
197 IF BOARD(1)=0 THEN TURN=1 ELSE TURN=2
198 GOTO 1030
200 CALL DELSPRITE(ALL) :: DISPLAY AT(15,1):"YOUR TURN, PLAYER ";CHR$(49+(57*(TURN-1))) :: DISPLAY AT(16,1):"ENTER TO ROLL, R TO RESIGN": : : :
210 CALL KEY(0,K,S) :: IF S=0 THEN 210 ELSE IF K<>13 AND K<>82 THEN 210
215 IF K=82 THEN 1000
220 DICE=INT(RND*3) :: DISPLAY AT(16,1):"YOU ROLLED A ";CHR$(DICE+48+(56*(TURN-1)))
230 IF DICE=0 THEN CALL PAUSE :: GOTO 700
240 PLACEX=2+(9*(TURN-1)) :: PLACEY=2
245 DISPLAY AT(17,1)BEEP:"SELECT PAWN";
250 CALL SELECT(PLACEX,PLACEY,TURN,Z)
260 DISPLAY AT(16,1):"MOVES LEFT ";CHR$(48+((TURN-1)*56)+DICE) :: CALL DEST(PLACEX,PLACEY,Z,DESTX,DESTY,ZZ)
263 IF ZZ=999 THEN CALL SOUND(50,110,0) :: DISPLAY AT(15,1):"" :: DISPLAY AT(18,1):"": : :: CALL DELSPRITE(#2) :: GOTO 240
264 IF ZZ=998 THEN CALL GCHAR(PLACEX,PLACEY,Z) :: Z=Z-48-(56*(TURN-1)) :: CALL BOMB :: CALL HCHAR(PLACEX,PLACEY,58) :: GOTO 320
265 DISPLAY AT(18,1):"":"":"" :: IF ZZ<>97 THEN 290
267 CALL DELSPRITE(#2)
270 CALL HCHAR(DESTX,DESTY,Z) :: CALL HCHAR(PLACEX,PLACEY,97) :: CALL SOUND(100,523,5) :: CALL SOUND(125,1047,5)
280 PLACEX=DESTX :: PLACEY=DESTY :: CALL SPRITE(#1,37,4,((PLACEX-1)*+1,((PLACEY-1)*+1) :: DICE=DICE-1 :: IF DICE=0 THEN 700 ELSE GOTO 260
290 IF ZZ=35 THEN 500
300 IF ZZ<>114 AND ZZ<>58 THEN 340
305 DISPLAY AT(15,1):"":"":"" :: Z=Z-48-(56*(TURN-1))
310 IF(ZZ=114 AND TURN=2)OR(ZZ=58 AND TURN=1)THEN 330
320 DISPLAY AT(15,1):"PAWN HAS BEEN SACRIFICED": : : : : :: CALL SOUND(200,147,0) :: CALL SOUND(300,110,0) :: CALL HCHAR(PLACEX,PLACEY,97)
325 BOARD(TURN)=BOARD(TURN)-Z :: IF TURN=1 THEN SCORE(2)=SCORE(2)+Z ELSE SCORE(1)=SCORE(1)+Z
327 CALL SCOREDISP(SCORE(1),SCORE(2),BOARD(1),BOARD(2)) :: DICE=0 :: GOTO 700
330 DISPLAY AT(15,1):"PAWN HAS REACHED HOME" :: CALL SOUND(200,1175,0) :: CALL SOUND(300,1661,0) :: CALL HCHAR(PLACEX,PLACEY,97)
335 BOARD(TURN)=BOARD(TURN)-Z :: IF TURN=1 THEN SCORE(1)=SCORE(1)+Z ELSE SCORE(2)=SCORE(2)+Z
337 GOTO 327
340 IF(ZZ>47 AND ZZ<58)AND(Z>103 AND Z<114)OR(ZZ>103 AND ZZ<114)AND(Z>47 AND Z<58)THEN 360
350 GOTO 740
360 CALL SCREEN(7) :: DISPLAY AT(15,1):"BATTLE COMMENCES": : :: IF DICE=2 THEN DISPLAY AT(16,1):"ATTACKER ADVANTAGE!"
370 CALL SOUND(100,622,0) :: CALL SOUND(100,740,0) :: CALL SOUND(400,1245,0) :: CALL SOUND(100,740,0) :: CALL SOUND(100,622,0) :: CALL SCREEN(12)
380 TIP=50-(INT(RND*10)+1) :: IF DICE=2 THEN TIP=TIP+15
390 BDICE=INT(RND*100)+1
400 CALL SCREEN(7) :: CALL BOMB :: CALL SCREEN(12)
410 IF BDICE<TIP THEN ZZ=ZZ-1 ELSE Z=Z-1
420 !
430 IF BDICE<TIP AND ZZ<103 THEN BOARD(1)=BOARD(1)-1
435 IF BDICE<TIP AND ZZ>58 THEN BOARD(2)=BOARD(2)-1
436 IF BDICE>TIP AND Z<103 THEN BOARD(1)=BOARD(1)-1
437 IF BDICE>TIP AND Z>58 THEN BOARD(2)=BOARD(2)-1
440 CALL SCOREDISP(SCORE(1),SCORE(2),BOARD(1),BOARD(2))
450 IF Z=48 OR ZZ=48 OR Z=104 OR ZZ=104 THEN 470
460 CALL HCHAR(PLACEX,PLACEY,Z) :: CALL HCHAR(DESTX,DESTY,ZZ) :: GOTO 390
470 IF Z=48 OR Z=104 THEN DISPLAY AT(16,1):"ATTACKER IS DEFEATED" :: CALL HCHAR(PLACEX,PLACEY,97) :: GOTO 480
475 DISPLAY AT(16,1):"DEFENDER IS DEFEATED" :: CALL HCHAR(DESTX,DESTY,97)
480 DISPLAY AT(15,1):"THE BATTLE HAS ENDED"
490 CALL DELSPRITE(#1,#2) :: CALL PAUSE :: GOTO 700
500 ! PAWN TO FILL EMPTY SPAPCE
510 IF Z-48-(56*(TURN-1))<6 THEN CALL SOUND(100,110,0) :: GOTO 260
520 DISPLAY AT(15,1):"PAWN HAS BEEN SACRIFICED":"AND THE VOID HAS BEEN FILLED": : : : :
525 CALL SOUND(200,247,0) :: CALL SOUND(200,294,0) :: FOR X=277 TO 1760 STEP 40 :: CALL SOUND(-100,X,0) :: NEXT X
530 CALL HCHAR(PLACEX,PLACEY,97) :: CALL HCHAR(DESTX,DESTY,97) :: BOARD(TURN)=BOARD(TURN)-(Z-48-(56*(TURN-1)))
540 CALL BOMB
550 CALL SCOREDISP(SCORE(1),SCORE(2),BOARD(1),BOARD(2)) :: GOTO 700
700 IF BOARD(1)<1 OR BOARD(2)<1 THEN 720
710 IF TURN=2 THEN TURN=1 :: GOTO 170 ELSE TURN=2 :: GOTO 200
720 IF SCORE(1)>SCORE(2)THEN TEMP$="RED" ELSE IF SCORE(1)<SCORE(2)THEN TEMP$="BLUE" ELSE IF SCORE(1)=SCORE(2)THEN TEMP$="NOBODY"
730 GOTO 1040
740 XX=(Z-48-(56*(TURN-1)))+(ZZ-48-(56*(TURN-1)))
750 IF XX>9 THEN BOARD(TURN)=BOARD(TURN)-(XX-9)
760 XX=MIN(9,XX)
770 DISPLAY AT(15,1):"PAWNS HAVE MERGED INTO ONE": : : :
780 FOR Y=0 TO 20 STEP 5 :: FOR YY=1680 TO 2680 STEP 200 :: CALL SOUND(-20,YY,Y) :: NEXT YY
785 FOR YY=2680 TO 1680 STEP-200 :: CALL SOUND(-20,YY,Y) :: NEXT YY :: NEXT Y
790 CALL HCHAR(PLACEX,PLACEY,97) :: CALL HCHAR(DESTX,DESTY,XX+48+(56*(TURN-1)))
800 CALL SCOREDISP(SCORE(1),SCORE(2),BOARD(1),BOARD(2)) :: CALL DELSPRITE(ALL) :: GOTO 700
1000 DISPLAY AT(15,1):"Y CONFIRMS RESIGN":"ANY OTHER KEY CANCELS"
1010 CALL KEY(0,K,S) :: IF S=0 THEN 1010
1020 IF K<>89 THEN 200
1030 IF TURN=1 THEN TEMP$="BLUE" ELSE TEMP$="RED"
1040 DISPLAY AT(15,1):TEMP$;" WINS THE GAME":"Q QUITS, ANY OTHER KEY      TO PLAY AGAIN"
1050 FOR X=1 TO 3 :: CALL SOUND(75,1319,0) :: CALL SOUND(75,1397,0) :: CALL SOUND(75,1760,0) :: NEXT X :: CALL SOUND(300,1760,0,1920,0)
1053 IF TURN=1 THEN TURN=5 ELSE TURN=7
1055 FOR X=1 TO 3 :: CALL SCREEN(TURN) :: CALL BOMB :: CALL SCREEN(12) :: NEXT X
1060 CALL KEY(0,K,S) :: IF S=0 THEN 1060
1070 IF K=81 THEN CALL CLEAR :: STOP
1080 GOTO 100
9000 CALL CLEAR
9010 PRINT "ENEMY LINES BY KEITH BERGMAN": :"(C) 2016 2 PLAYER BETA TEST!":"***** NOT FINAL VERSION*****"
9020 PRINT: : : : : : : :"PRESS ANY KEY TO CONTINUE..."
9030 CALL KEY(0,K,S) :: IF S=0 THEN 9030
9040 RETURN
9999 DATA 4,4,4,4,7,5,4,6,4,4
10000 FOR W=1 TO 2 :: AMOUNT=75
10010 Y=(INT(RND*3)+2+(7*(W-1))) :: Z=INT(RND*10)+2 :: X=INT(RND*9)+1 :: IF AMOUNT<X THEN X=AMOUNT
10025 CALL GCHAR(Y,Z,V) :: IF V<>97 THEN 10010
10030 AMOUNT=AMOUNT-X :: CALL HCHAR(Y,Z,X+48+(56*(W-1))) :: IF AMOUNT>0 THEN 10010
10040 NEXT W :: RETURN
10050 SUB SCOREDISP(SA,SB,BA,BB)
10055 IF SA<10 THEN SA$="0"&STR$(SA)ELSE SA$=STR$(SA)
10056 IF SB<10 THEN SB$="0"&STR$(SB)ELSE SB$=STR$(SB)
10057 IF BA<10 THEN BA$="0"&STR$(BA)ELSE BA$=STR$(BA)
10058 IF BB<10 THEN BB$="0"&STR$(BB)ELSE BB$=STR$(BB)
10060 CALL HCHAR(4,19,ASC(SEG$(SA$,1,1))) :: CALL HCHAR(4,20,ASC(SEG$(SA$,2,1)))
10070 CALL HCHAR(4,29,ASC(SEG$(SB$,1,1))+56) :: CALL HCHAR(4,30,ASC(SEG$(SB$,2,1))+56)
10080 CALL HCHAR(5,19,ASC(SEG$(BA$,1,1))) :: CALL HCHAR(5,20,ASC(SEG$(BA$,2,1)))
10090 CALL HCHAR(5,29,ASC(SEG$(BB$,1,1))+56) :: CALL HCHAR(5,30,ASC(SEG$(BB$,2,1))+56)
10100 SUBEND
10200 SUB PAUSE
10300 FOR X=1 TO 500 :: NEXT X
10310 SUBEND
10320 SUB BOMB
10330 CALL SOUND(400,-5,0) :: CALL SOUND(300,-6,0) :: CALL SOUND(300,-7,0)
10340 SUBEND
15000 SUB SELECT(PLACEX,PLACEY,TURN,Z)
15010 CALL SPRITE(#1,37,11,((PLACEX-1)*+1,((PLACEY-1)*+1)
15020 CALL KEY(0,K,S) :: IF S=0 THEN 15020
15030 IF K=13 THEN 15180
15040 IF K=87 THEN PLACEX=PLACEX-1 :: PLACEY=PLACEY-1 :: GOTO 15130
15050 IF K=69 THEN PLACEX=PLACEX-1 :: GOTO 15130
15060 IF K=82 THEN PLACEX=PLACEX-1 :: PLACEY=PLACEY+1 :: GOTO 15130
15070 IF K=83 THEN PLACEY=PLACEY-1 :: GOTO 15130
15080 IF K=68 THEN PLACEY=PLACEY+1 :: GOTO 15130
15090 IF K=90 THEN PLACEX=PLACEX+1 :: PLACEY=PLACEY-1 :: GOTO 15130
15100 IF K=88 THEN PLACEX=PLACEX+1 :: GOTO 15130
15110 IF K=67 THEN PLACEX=PLACEX+1 :: PLACEY=PLACEY+1 :: GOTO 15130
15120 CALL SOUND(100,110,0) :: GOTO 15020
15130 IF PLACEX<2 THEN PLACEX=11
15140 IF PLACEX>11 THEN PLACEX=2
15150 IF PLACEY<2 THEN PLACEY=11
15160 IF PLACEY>11 THEN PLACEY=2
15170 GOTO 15010
15180 CALL GCHAR(PLACEX,PLACEY,Z)
15190 IF TURN=1 AND(Z<48 OR Z>57)THEN 15120
15200 IF TURN=2 AND(Z<104 OR Z>113)THEN 15120
15210 CALL COLOR(#1,4) :: FOR X=0 TO 30 :: CALL SOUND(-100,1250,X) :: NEXT X
15220 DISPLAY AT(15,1):"":"":""
15230 SUBEND
17000 SUB DEST(PLACEX,PLACEY,Z,DESTX,DESTY,ZZ)
17005 DESTX=PLACEX :: DESTY=PLACEY
17010 MINX=MAX(PLACEX-1,1) :: MAXX=MIN(PLACEX+1,12) :: MINY=MAX(PLACEY-1,2) :: MAXY=MIN(PLACEY+1,11)
17020 CALL SPRITE(#2,37,13,((DESTX-1)*+1,((DESTY-1)*+1)
17025 DISPLAY AT(15,1):"SELECT DESTINATION SQUARE" :: DISPLAY AT(18,1):"M TO CANCEL":"P TO SELF DESTRUCT"
17030 CALL KEY(0,K,S) :: IF S=0 THEN 17030
17035 IF K=80 THEN ZZ=998 :: GOTO 17170
17037 IF K=77 THEN ZZ=999 :: GOTO 17170
17040 IF K=87 THEN IF DESTX-1<MINX OR DESTY-1<MINY THEN 17140 ELSE DESTX=DESTX-1 :: DESTY=DESTY-1 :: GOTO 17020
17050 IF K=69 THEN IF DESTX-1<MINX THEN 17140 ELSE DESTX=DESTX-1 :: GOTO 17020
17060 IF K=82 THEN IF DESTX-1<MINX OR DESTY+1>MAXY THEN 17140 ELSE DESTX=DESTX-1 :: DESTY=DESTY+1 :: GOTO 17020
17070 IF K=83 THEN IF DESTY-1<MINY THEN 17140 ELSE DESTY=DESTY-1 :: GOTO 17020
17080 IF K=68 THEN IF DESTY+1>MAXY THEN 17140 ELSE DESTY=DESTY+1 :: GOTO 17020
17090 IF K=90 THEN IF DESTX+1>MAXX OR DESTY-1<MINY THEN 17140 ELSE DESTX=DESTX+1 :: DESTY=DESTY-1 :: GOTO 17020
17100 IF K=88 THEN IF DESTX+1>MAXX THEN 17140 ELSE DESTX=DESTX+1 :: GOTO 17020
17110 IF K=67 THEN IF DESTX+1>MAXX OR DESTY+1>MAXY THEN 17140 ELSE DESTX=DESTX+1 :: DESTY=DESTY+1 :: GOTO 17020
17120 IF K=13 THEN IF DESTX<>PLACEX OR DESTY<>PLACEY THEN 17150
17140 CALL SOUND(100,110,0) :: GOTO 17020
17150 CALL SOUND(10,220,0)
17160 CALL GCHAR(DESTX,DESTY,ZZ)
17170 SUBEND
  • Like 2
Link to comment
Share on other sites

News bulletin: AI is hard to program! :)

 

I'm going to make SOME kind of working AI today if it kills me. It will probably be bad but I will have a working one-player version of the game today. Once I get that going I'll do more nuanced work to it. I've got the concepts I want down, it's just daunting turning them into code and I'm trying hard to work through that "this is tough, I quit" spot.

 

The balance between attack (moving pawns toward the goal, looking ahead to avoid walking into blind alleys, to find paths of least resistance, etc), defense (blocking the enemy's home row) and aggressive defense (pinpointing enemies moving closer to your side and going after them) is a lot to juggle. It's hard to remember I thought this was originally gonna be an entrant in a 30-line program contest...

  • Like 1
Link to comment
Share on other sites

  • 3 years later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...