text
stringlengths
0
234
message : T_round;
MAX_LINE_LENGTH : constant integer := 100;
line : string(1..MAX_LINE_LENGTH);
line_length : integer;
last_command : T_command;
winning_chances : Float;
NbBluffInit : Constant integer :=3;
CompteurBluffInit : Integer :=0;
begin
initGame(game);
while not End_Of_File loop
get_line(line, line_length);
last_command := splitLine(line, line_length);
case last_command.prefix is
--Settings
when settings => readSettings(last_command, game);
--update_game
when update_game => readUpdateGame(last_command, game);
--update_hand
when update_hand => readUpdateHand(last_command, game, logic);
when action =>
winning_chances := get_winning_chances(logic);
if CompteurBluffInit<NbBluffInit then --On veut initialiser notre strategie en bluffant au moins 3 fois (initialisation des booleens nous informant sur le bluff)
if (winning_chances >= LOW) then
message := strat(logic, game);
else
if get_my_money(game) > get_op_money(game) then
message := create_round(bet,Integer(IDIOT_OP*get_op_money(game)));
else
message:= create_round(bet, Integer(IDIOT_OWN*get_my_money(game)));
end if;
CompteurBluffInit := CompteurBluffInit +1;
end if;
else
message := strat(logic, game);
end if;
Put_Line(Standard_Error,To_Lower(ToString(message)));
printCard(get_card(get_hand(game),0));
printCard(get_card(get_hand(game),1));
Put_Line(Standard_Error, winning_chances'Img);
Put_line(To_Lower(ToString(message)));
end case;
end loop;
Put_Line(Standard_Error, can_bluff(logic)'Img&can_get_bluffed(logic)'Img&can_semi_bluff(logic)'Img);
Function Definition: procedure Stop_Driver is
Function Body: begin
SPI.Stop;
GPIO.Close;
end Stop_Driver;
procedure Init_Display is
begin
OLED_SH1106.Display.Reset;
OLED_SH1106.Display.Init_Reg;
delay 0.2;
Write_Reg(16#AF#);
end Init_Display;
procedure Show is
Start : Natural := 0;
begin
for Page in 0..7 loop
-- set page address
Write_Reg(16#B0# + Unsigned_8(Page));
-- set low column address
Write_Reg(16#02#);
-- set high column address
Write_Reg(16#10#);
-- write data
Start_Data;
for I in Start..(Start+Display_Width-1) loop
Write_Data(Buffer.Data(i));
end loop;
Start := Start + Display_Width;
end loop;
end Show;
-- Clear the screen.
procedure Clear(Clr: Color:= Black) is
begin