Merge branch 'main' of https:
This commit is contained in:
commit
52d8ff3aa5
13
daten.pl
13
daten.pl
@ -58,20 +58,25 @@ init_feld1 :-
|
|||||||
% Setzt das Spielfeld sowie die zugewiesenen einheiten zurück
|
% Setzt das Spielfeld sowie die zugewiesenen einheiten zurück
|
||||||
reset_game :-
|
reset_game :-
|
||||||
retractall( feld(_,_,_) ),
|
retractall( feld(_,_,_) ),
|
||||||
retractall( einheit_active(_,_,_,_) ).
|
retractall( einheit_active(_,_,_,_) ),
|
||||||
|
retractall( player_tokens(_,_) ).
|
||||||
|
|
||||||
|
|
||||||
% Initialisiert die Einheiten für die jeweiligen Spieler
|
% Initialisiert die Einheiten für die jeweiligen Spieler
|
||||||
init_player(Player, Type1, Type2, Type3) :-
|
init_player(Player, Type1, Type2, Type3) :-
|
||||||
% der shabang ist hier damit die einheiten jeweils in den ecken spawnen
|
% der shabang ist hier damit die einheiten jeweils in den
|
||||||
|
% richtigen ecken spawnen
|
||||||
playerStart(Player, X, Y),
|
playerStart(Player, X, Y),
|
||||||
Xp1 is X + 1,
|
Xp1 is X + 1,
|
||||||
|
Xp2 is X + 2,
|
||||||
|
|
||||||
Yp1 is Y + 1,
|
Yp1 is Y + 1,
|
||||||
|
Yp2 is Y + 2,
|
||||||
|
|
||||||
% einheit_active(Player, Einheit Type, feldX, feldY)
|
% einheit_active(Player, Einheit Type, feldX, feldY)
|
||||||
assert( einheit_active(Player,Type1,Xp1,Yp1) ),
|
assert( einheit_active(Player,Type1,Xp1,Yp1) ),
|
||||||
assert( einheit_active(Player,Type2,Xp1,Y ) ),
|
assert( einheit_active(Player,Type2,Xp2,Yp1) ),
|
||||||
assert( enemy_active(Player,Type3,X ,Yp1) ),
|
assert( einheit_active(Player,Type3,Xp1,Yp2) ),
|
||||||
|
|
||||||
% Berechnet die zustehenden Tokens pro Runde für den Spieler
|
% Berechnet die zustehenden Tokens pro Runde für den Spieler
|
||||||
einheit(Type1, _,_,_, Cost1),
|
einheit(Type1, _,_,_, Cost1),
|
||||||
|
12
gui.pl
12
gui.pl
@ -1,5 +1,5 @@
|
|||||||
% erstmal nur experimentell, der bums kommt zum schluss
|
:- use_module(library(tabular)).
|
||||||
% falls noch zeit sein sollte jedenfalls
|
:- use_module(library(autowin)).
|
||||||
|
|
||||||
% new(@specifier, dialog('windowname'))
|
% new(@specifier, dialog('windowname'))
|
||||||
% send(@specifiert, append(text_item(name)))
|
% send(@specifiert, append(text_item(name)))
|
||||||
@ -10,6 +10,7 @@ window(Name) :-
|
|||||||
send(D, append, button(newbutton, message(@prolog, new_butt, D))),
|
send(D, append, button(newbutton, message(@prolog, new_butt, D))),
|
||||||
send(D, open).
|
send(D, open).
|
||||||
|
|
||||||
|
|
||||||
window2(Name) :-
|
window2(Name) :-
|
||||||
new(D, dialog(Name)),
|
new(D, dialog(Name)),
|
||||||
|
|
||||||
@ -21,13 +22,6 @@ window2(Name) :-
|
|||||||
send(D, open).
|
send(D, open).
|
||||||
|
|
||||||
|
|
||||||
new_butt(D) :-
|
|
||||||
send(D, append, button(penis, message(@prolog, init_feld1))).
|
|
||||||
|
|
||||||
% Specific für window3/1
|
|
||||||
:- use_module(library(tabular)).
|
|
||||||
:- use_module(library(autowin)).
|
|
||||||
|
|
||||||
window3(Name) :-
|
window3(Name) :-
|
||||||
new(P, auto_sized_picture(Name)),
|
new(P, auto_sized_picture(Name)),
|
||||||
send(P, display, new(T, tabular)),
|
send(P, display, new(T, tabular)),
|
||||||
|
23
logik.pl
23
logik.pl
@ -5,7 +5,7 @@
|
|||||||
player_turn(Player) :-
|
player_turn(Player) :-
|
||||||
|
|
||||||
% calculate action points
|
% calculate action points
|
||||||
calc_action_points(Player, Turncounter)
|
calc_action_points(Player, Turncounter),
|
||||||
|
|
||||||
|
|
||||||
% further logic
|
% further logic
|
||||||
@ -14,4 +14,23 @@ player_turn(Player) :-
|
|||||||
|
|
||||||
% end of turn
|
% end of turn
|
||||||
% save remaining ap
|
% save remaining ap
|
||||||
save_action_points(Player)
|
save_action_points(Player).
|
||||||
|
|
||||||
|
|
||||||
|
% Bewegt die Einheit des Spielers an position Xold, Yold
|
||||||
|
% um Xmove, Ymove in die jeweilige Richtung
|
||||||
|
einheit_move(Player, Xold, Yold, Xmove, Ymove) :-
|
||||||
|
% Die Einheit entfernen
|
||||||
|
retract( einheit_active(Player, Type, Xold, Yold) ),
|
||||||
|
|
||||||
|
% Neue position berechnen
|
||||||
|
Xnew is Xold + Xmove,
|
||||||
|
Ynew is Yold + Ymove,
|
||||||
|
|
||||||
|
% Die Einheit an die neue Position setzen
|
||||||
|
assert( einheit_active(Player, Type, Xnew, Ynew) ),
|
||||||
|
|
||||||
|
% Errechnen der verbleibenden Tokens
|
||||||
|
retract( player_tokens(Player, Tokens) ),
|
||||||
|
TokensNew is Tokens - Xmove - Ymove,
|
||||||
|
assert( player_tokens(Player, TokensNew) ).
|
Loading…
x
Reference in New Issue
Block a user